@cyberskill/cyber-editor 3.5.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),Oe=require("@tiptap/react"),xe=require("antd"),Zr=require("@tiptap/extension-list-item"),Qr=require("@tiptap/extension-color"),Yt=require("@tiptap/extension-text-style"),en=require("@tiptap/starter-kit"),tn=require("@tiptap/extension-highlight"),rn=require("@tiptap/extension-underline"),nn=require("@tiptap/extension-subscript"),on=require("@tiptap/extension-superscript"),an=require("@tiptap/extension-text-align"),sn=require("@tiptap/extension-task-list"),ln=require("@tiptap/extension-task-item"),cn=require("@tiptap/extension-table"),un=require("@tiptap/extension-table-row"),dn=require("@tiptap/extension-table-header"),fn=require("@tiptap/extension-table-cell"),Ue=require("@tiptap/core"),mn=require("@tiptap/extension-image"),mr=require("react-dom");function pn(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var gt={exports:{}},Le={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),qr=require("react-dom"),ft=require("antd");function bd(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var ro={exports:{}},ir={};/**
2
2
  * @license React
3
3
  * react-jsx-dev-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Ft;function bn(){if(Ft)return Le;Ft=1;var e=Symbol.for("react.fragment");return Le.Fragment=e,Le.jsxDEV=void 0,Le}var We={};/**
9
+ */var Os;function vd(){if(Os)return ir;Os=1;var n=Symbol.for("react.fragment");return ir.Fragment=n,ir.jsxDEV=void 0,ir}var or={};/**
10
10
  * @license React
11
11
  * react-jsx-dev-runtime.development.js
12
12
  *
@@ -14,230 +14,354 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ut;function hn(){return Ut||(Ut=1,process.env.NODE_ENV!=="production"&&function(){var e=X,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),v=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),A=Symbol.iterator,$="@@iterator";function B(i){if(i===null||typeof i!="object")return null;var f=A&&i[A]||i[$];return typeof f=="function"?f:null}var L=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(i){{for(var f=arguments.length,h=new Array(f>1?f-1:0),w=1;w<f;w++)h[w-1]=arguments[w];N("error",i,h)}}function N(i,f,h){{var w=L.ReactDebugCurrentFrame,W=w.getStackAddendum();W!==""&&(f+="%s",h=h.concat([W]));var K=h.map(function(I){return String(I)});K.unshift("Warning: "+f),Function.prototype.apply.call(console[i],console,K)}}var E=!1,c=!1,Y=!1,T=!1,ee=!1,fe;fe=Symbol.for("react.module.reference");function me(i){return!!(typeof i=="string"||typeof i=="function"||i===n||i===a||ee||i===o||i===p||i===y||T||i===S||E||c||Y||typeof i=="object"&&i!==null&&(i.$$typeof===O||i.$$typeof===v||i.$$typeof===l||i.$$typeof===u||i.$$typeof===d||i.$$typeof===fe||i.getModuleId!==void 0))}function ye(i,f,h){var w=i.displayName;if(w)return w;var W=f.displayName||f.name||"";return W!==""?h+"("+W+")":h}function Se(i){return i.displayName||"Context"}function te(i){if(i==null)return null;if(typeof i.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case n:return"Fragment";case r:return"Portal";case a:return"Profiler";case o:return"StrictMode";case p:return"Suspense";case y:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case u:var f=i;return Se(f)+".Consumer";case l:var h=i;return Se(h._context)+".Provider";case d:return ye(i,i.render,"ForwardRef");case v:var w=i.displayName||null;return w!==null?w:te(i.type)||"Memo";case O:{var W=i,K=W._payload,I=W._init;try{return te(I(K))}catch{return null}}}return null}var Q=Object.assign,pe=0,ae,ce,ge,we,m,x,P;function R(){}R.__reactDisabledLog=!0;function C(){{if(pe===0){ae=console.log,ce=console.info,ge=console.warn,we=console.error,m=console.group,x=console.groupCollapsed,P=console.groupEnd;var i={configurable:!0,enumerable:!0,value:R,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}pe++}}function z(){{if(pe--,pe===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Q({},i,{value:ae}),info:Q({},i,{value:ce}),warn:Q({},i,{value:ge}),error:Q({},i,{value:we}),group:Q({},i,{value:m}),groupCollapsed:Q({},i,{value:x}),groupEnd:Q({},i,{value:P})})}pe<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var k=L.ReactCurrentDispatcher,_;function j(i,f,h){{if(_===void 0)try{throw Error()}catch(W){var w=W.stack.trim().match(/\n( *(at )?)/);_=w&&w[1]||""}return`
18
- `+_+i}}var q=!1,M;{var re=typeof WeakMap=="function"?WeakMap:Map;M=new re}function b(i,f){if(!i||q)return"";{var h=M.get(i);if(h!==void 0)return h}var w;q=!0;var W=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var K;K=k.current,k.current=null,C();try{if(f){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(se){w=se}Reflect.construct(i,[],I)}else{try{I.call()}catch(se){w=se}i.call(I.prototype)}}else{try{throw Error()}catch(se){w=se}i()}}catch(se){if(se&&w&&typeof se.stack=="string"){for(var V=se.stack.split(`
19
- `),ie=w.stack.split(`
20
- `),J=V.length-1,Z=ie.length-1;J>=1&&Z>=0&&V[J]!==ie[Z];)Z--;for(;J>=1&&Z>=0;J--,Z--)if(V[J]!==ie[Z]){if(J!==1||Z!==1)do if(J--,Z--,Z<0||V[J]!==ie[Z]){var he=`
21
- `+V[J].replace(" at new "," at ");return i.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",i.displayName)),typeof i=="function"&&M.set(i,he),he}while(J>=1&&Z>=0);break}}}finally{q=!1,k.current=K,z(),Error.prepareStackTrace=W}var je=i?i.displayName||i.name:"",_e=je?j(je):"";return typeof i=="function"&&M.set(i,_e),_e}function be(i,f,h){return b(i,!1)}function Te(i){var f=i.prototype;return!!(f&&f.isReactComponent)}function De(i,f,h){if(i==null)return"";if(typeof i=="function")return b(i,Te(i));if(typeof i=="string")return j(i);switch(i){case p:return j("Suspense");case y:return j("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case d:return be(i.render);case v:return De(i.type,f,h);case O:{var w=i,W=w._payload,K=w._init;try{return De(K(W),f,h)}catch{}}}return""}var Ve=Object.prototype.hasOwnProperty,Pt={},jt=L.ReactDebugCurrentFrame;function He(i){if(i){var f=i._owner,h=De(i.type,i._source,f?f.type:null);jt.setExtraStackFrame(h)}else jt.setExtraStackFrame(null)}function Pr(i,f,h,w,W){{var K=Function.call.bind(Ve);for(var I in i)if(K(i,I)){var V=void 0;try{if(typeof i[I]!="function"){var ie=Error((w||"React class")+": "+h+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ie.name="Invariant Violation",ie}V=i[I](f,I,w,h,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(J){V=J}V&&!(V instanceof Error)&&(He(W),g("%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).",w||"React class",h,I,typeof V),He(null)),V instanceof Error&&!(V.message in Pt)&&(Pt[V.message]=!0,He(W),g("Failed %s type: %s",h,V.message),He(null))}}}var jr=Array.isArray;function tt(i){return jr(i)}function Mr(i){{var f=typeof Symbol=="function"&&Symbol.toStringTag,h=f&&i[Symbol.toStringTag]||i.constructor.name||"Object";return h}}function Vr(i){try{return Mt(i),!1}catch{return!0}}function Mt(i){return""+i}function Vt(i){if(Vr(i))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Mr(i)),Mt(i)}var Ae=L.ReactCurrentOwner,Ar={key:!0,ref:!0,__self:!0,__source:!0},At,$t,rt;rt={};function $r(i){if(Ve.call(i,"ref")){var f=Object.getOwnPropertyDescriptor(i,"ref").get;if(f&&f.isReactWarning)return!1}return i.ref!==void 0}function zr(i){if(Ve.call(i,"key")){var f=Object.getOwnPropertyDescriptor(i,"key").get;if(f&&f.isReactWarning)return!1}return i.key!==void 0}function Ir(i,f){if(typeof i.ref=="string"&&Ae.current&&f&&Ae.current.stateNode!==f){var h=te(Ae.current.type);rt[h]||(g('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',te(Ae.current.type),i.ref),rt[h]=!0)}}function qr(i,f){{var h=function(){At||(At=!0,g("%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)",f))};h.isReactWarning=!0,Object.defineProperty(i,"key",{get:h,configurable:!0})}}function Hr(i,f){{var h=function(){$t||($t=!0,g("%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)",f))};h.isReactWarning=!0,Object.defineProperty(i,"ref",{get:h,configurable:!0})}}var Lr=function(i,f,h,w,W,K,I){var V={$$typeof:t,type:i,key:f,ref:h,props:I,_owner:K};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:w}),Object.defineProperty(V,"_source",{configurable:!1,enumerable:!1,writable:!1,value:W}),Object.freeze&&(Object.freeze(V.props),Object.freeze(V)),V};function Wr(i,f,h,w,W){{var K,I={},V=null,ie=null;h!==void 0&&(Vt(h),V=""+h),zr(f)&&(Vt(f.key),V=""+f.key),$r(f)&&(ie=f.ref,Ir(f,W));for(K in f)Ve.call(f,K)&&!Ar.hasOwnProperty(K)&&(I[K]=f[K]);if(i&&i.defaultProps){var J=i.defaultProps;for(K in J)I[K]===void 0&&(I[K]=J[K])}if(V||ie){var Z=typeof i=="function"?i.displayName||i.name||"Unknown":i;V&&qr(I,Z),ie&&Hr(I,Z)}return Lr(i,V,ie,W,w,Ae.current,I)}}var nt=L.ReactCurrentOwner,zt=L.ReactDebugCurrentFrame;function Pe(i){if(i){var f=i._owner,h=De(i.type,i._source,f?f.type:null);zt.setExtraStackFrame(h)}else zt.setExtraStackFrame(null)}var it;it=!1;function ot(i){return typeof i=="object"&&i!==null&&i.$$typeof===t}function It(){{if(nt.current){var i=te(nt.current.type);if(i)return`
17
+ */var Ds;function xd(){return Ds||(Ds=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"),o=Symbol.for("react.profiler"),s=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"),d=Symbol.for("react.memo"),f=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 E=p&&y[p]||y[m];return typeof E=="function"?E:null}var b=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(y){{for(var E=arguments.length,A=new Array(E>1?E-1:0),$=1;$<E;$++)A[$-1]=arguments[$];S("error",y,A)}}function S(y,E,A){{var $=b.ReactDebugCurrentFrame,te=$.getStackAddendum();te!==""&&(E+="%s",A=A.concat([te]));var se=A.map(function(Z){return String(Z)});se.unshift("Warning: "+E),Function.prototype.apply.call(console[y],console,se)}}var k=!1,v=!1,N=!1,O=!1,B=!1,_;_=Symbol.for("react.module.reference");function oe(y){return!!(typeof y=="string"||typeof y=="function"||y===r||y===o||B||y===i||y===c||y===u||O||y===h||k||v||N||typeof y=="object"&&y!==null&&(y.$$typeof===f||y.$$typeof===d||y.$$typeof===s||y.$$typeof===l||y.$$typeof===a||y.$$typeof===_||y.getModuleId!==void 0))}function ge(y,E,A){var $=y.displayName;if($)return $;var te=E.displayName||E.name||"";return te!==""?A+"("+te+")":A}function Ee(y){return y.displayName||"Context"}function ye(y){if(y==null)return null;if(typeof y.tag=="number"&&x("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 o:return"Profiler";case i:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof y=="object")switch(y.$$typeof){case l:var E=y;return Ee(E)+".Consumer";case s:var A=y;return Ee(A._context)+".Provider";case a:return ge(y,y.render,"ForwardRef");case d:var $=y.displayName||null;return $!==null?$:ye(y.type)||"Memo";case f:{var te=y,se=te._payload,Z=te._init;try{return ye(Z(se))}catch{return null}}}return null}var pe=Object.assign,We=0,xe,Ne,ut,vt,M,R,K;function U(){}U.__reactDisabledLog=!0;function j(){{if(We===0){xe=console.log,Ne=console.info,ut=console.warn,vt=console.error,M=console.group,R=console.groupCollapsed,K=console.groupEnd;var y={configurable:!0,enumerable:!0,value:U,writable:!0};Object.defineProperties(console,{info:y,log:y,warn:y,error:y,group:y,groupCollapsed:y,groupEnd:y})}We++}}function X(){{if(We--,We===0){var y={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:pe({},y,{value:xe}),info:pe({},y,{value:Ne}),warn:pe({},y,{value:ut}),error:pe({},y,{value:vt}),group:pe({},y,{value:M}),groupCollapsed:pe({},y,{value:R}),groupEnd:pe({},y,{value:K})})}We<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var F=b.ReactCurrentDispatcher,W;function J(y,E,A){{if(W===void 0)try{throw Error()}catch(te){var $=te.stack.trim().match(/\n( *(at )?)/);W=$&&$[1]||""}return`
18
+ `+W+y}}var Q=!1,Y;{var Ae=typeof WeakMap=="function"?WeakMap:Map;Y=new Ae}function D(y,E){if(!y||Q)return"";{var A=Y.get(y);if(A!==void 0)return A}var $;Q=!0;var te=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var se;se=F.current,F.current=null,j();try{if(E){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch(qe){$=qe}Reflect.construct(y,[],Z)}else{try{Z.call()}catch(qe){$=qe}y.call(Z.prototype)}}else{try{throw Error()}catch(qe){$=qe}y()}}catch(qe){if(qe&&$&&typeof qe.stack=="string"){for(var G=qe.stack.split(`
19
+ `),Ve=$.stack.split(`
20
+ `),me=G.length-1,be=Ve.length-1;me>=1&&be>=0&&G[me]!==Ve[be];)be--;for(;me>=1&&be>=0;me--,be--)if(G[me]!==Ve[be]){if(me!==1||be!==1)do if(me--,be--,be<0||G[me]!==Ve[be]){var nt=`
21
+ `+G[me].replace(" at new "," at ");return y.displayName&&nt.includes("<anonymous>")&&(nt=nt.replace("<anonymous>",y.displayName)),typeof y=="function"&&Y.set(y,nt),nt}while(me>=1&&be>=0);break}}}finally{Q=!1,F.current=se,X(),Error.prepareStackTrace=te}var pn=y?y.displayName||y.name:"",Ut=pn?J(pn):"";return typeof y=="function"&&Y.set(y,Ut),Ut}function tt(y,E,A){return D(y,!1)}function fn(y){var E=y.prototype;return!!(E&&E.isReactComponent)}function qt(y,E,A){if(y==null)return"";if(typeof y=="function")return D(y,fn(y));if(typeof y=="string")return J(y);switch(y){case c:return J("Suspense");case u:return J("SuspenseList")}if(typeof y=="object")switch(y.$$typeof){case a:return tt(y.render);case d:return qt(y.type,E,A);case f:{var $=y,te=$._payload,se=$._init;try{return qt(se(te),E,A)}catch{}}}return""}var Rn=Object.prototype.hasOwnProperty,ys={},bs=b.ReactDebugCurrentFrame;function rr(y){if(y){var E=y._owner,A=qt(y.type,y._source,E?E.type:null);bs.setExtraStackFrame(A)}else bs.setExtraStackFrame(null)}function Zu(y,E,A,$,te){{var se=Function.call.bind(Rn);for(var Z in y)if(se(y,Z)){var G=void 0;try{if(typeof y[Z]!="function"){var Ve=Error(($||"React class")+": "+A+" type `"+Z+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof y[Z]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ve.name="Invariant Violation",Ve}G=y[Z](E,Z,$,A,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(me){G=me}G&&!(G instanceof Error)&&(rr(te),x("%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).",$||"React class",A,Z,typeof G),rr(null)),G instanceof Error&&!(G.message in ys)&&(ys[G.message]=!0,rr(te),x("Failed %s type: %s",A,G.message),rr(null))}}}var Qu=Array.isArray;function pi(y){return Qu(y)}function ed(y){{var E=typeof Symbol=="function"&&Symbol.toStringTag,A=E&&y[Symbol.toStringTag]||y.constructor.name||"Object";return A}}function td(y){try{return vs(y),!1}catch{return!0}}function vs(y){return""+y}function xs(y){if(td(y))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ed(y)),vs(y)}var Pn=b.ReactCurrentOwner,nd={key:!0,ref:!0,__self:!0,__source:!0},Ss,ws,mi;mi={};function rd(y){if(Rn.call(y,"ref")){var E=Object.getOwnPropertyDescriptor(y,"ref").get;if(E&&E.isReactWarning)return!1}return y.ref!==void 0}function id(y){if(Rn.call(y,"key")){var E=Object.getOwnPropertyDescriptor(y,"key").get;if(E&&E.isReactWarning)return!1}return y.key!==void 0}function od(y,E){if(typeof y.ref=="string"&&Pn.current&&E&&Pn.current.stateNode!==E){var A=ye(Pn.current.type);mi[A]||(x('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',ye(Pn.current.type),y.ref),mi[A]=!0)}}function sd(y,E){{var A=function(){Ss||(Ss=!0,x("%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)",E))};A.isReactWarning=!0,Object.defineProperty(y,"key",{get:A,configurable:!0})}}function ld(y,E){{var A=function(){ws||(ws=!0,x("%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)",E))};A.isReactWarning=!0,Object.defineProperty(y,"ref",{get:A,configurable:!0})}}var ad=function(y,E,A,$,te,se,Z){var G={$$typeof:e,type:y,key:E,ref:A,props:Z,_owner:se};return G._store={},Object.defineProperty(G._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(G,"_self",{configurable:!1,enumerable:!1,writable:!1,value:$}),Object.defineProperty(G,"_source",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.freeze&&(Object.freeze(G.props),Object.freeze(G)),G};function cd(y,E,A,$,te){{var se,Z={},G=null,Ve=null;A!==void 0&&(xs(A),G=""+A),id(E)&&(xs(E.key),G=""+E.key),rd(E)&&(Ve=E.ref,od(E,te));for(se in E)Rn.call(E,se)&&!nd.hasOwnProperty(se)&&(Z[se]=E[se]);if(y&&y.defaultProps){var me=y.defaultProps;for(se in me)Z[se]===void 0&&(Z[se]=me[se])}if(G||Ve){var be=typeof y=="function"?y.displayName||y.name||"Unknown":y;G&&sd(Z,be),Ve&&ld(Z,be)}return ad(y,G,Ve,te,$,Pn.current,Z)}}var gi=b.ReactCurrentOwner,ks=b.ReactDebugCurrentFrame;function hn(y){if(y){var E=y._owner,A=qt(y.type,y._source,E?E.type:null);ks.setExtraStackFrame(A)}else ks.setExtraStackFrame(null)}var yi;yi=!1;function bi(y){return typeof y=="object"&&y!==null&&y.$$typeof===e}function Cs(){{if(gi.current){var y=ye(gi.current.type);if(y)return`
22
22
 
23
- Check the render method of \``+i+"`."}return""}}function Yr(i){{if(i!==void 0){var f=i.fileName.replace(/^.*[\\\/]/,""),h=i.lineNumber;return`
23
+ Check the render method of \``+y+"`."}return""}}function ud(y){{if(y!==void 0){var E=y.fileName.replace(/^.*[\\\/]/,""),A=y.lineNumber;return`
24
24
 
25
- Check your code at `+f+":"+h+"."}return""}}var qt={};function Fr(i){{var f=It();if(!f){var h=typeof i=="string"?i:i.displayName||i.name;h&&(f=`
25
+ Check your code at `+E+":"+A+"."}return""}}var Es={};function dd(y){{var E=Cs();if(!E){var A=typeof y=="string"?y:y.displayName||y.name;A&&(E=`
26
26
 
27
- Check the top-level render call using <`+h+">.")}return f}}function Ht(i,f){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var h=Fr(f);if(qt[h])return;qt[h]=!0;var w="";i&&i._owner&&i._owner!==nt.current&&(w=" It was passed a child from "+te(i._owner.type)+"."),Pe(i),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',h,w),Pe(null)}}function Lt(i,f){{if(typeof i!="object")return;if(tt(i))for(var h=0;h<i.length;h++){var w=i[h];ot(w)&&Ht(w,f)}else if(ot(i))i._store&&(i._store.validated=!0);else if(i){var W=B(i);if(typeof W=="function"&&W!==i.entries)for(var K=W.call(i),I;!(I=K.next()).done;)ot(I.value)&&Ht(I.value,f)}}}function Ur(i){{var f=i.type;if(f==null||typeof f=="string")return;var h;if(typeof f=="function")h=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===d||f.$$typeof===v))h=f.propTypes;else return;if(h){var w=te(f);Pr(h,i.props,"prop",w,i)}else if(f.PropTypes!==void 0&&!it){it=!0;var W=te(f);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",W||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Br(i){{for(var f=Object.keys(i.props),h=0;h<f.length;h++){var w=f[h];if(w!=="children"&&w!=="key"){Pe(i),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",w),Pe(null);break}}i.ref!==null&&(Pe(i),g("Invalid attribute `ref` supplied to `React.Fragment`."),Pe(null))}}var Wt={};function Xr(i,f,h,w,W,K){{var I=me(i);if(!I){var V="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).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 ie=Yr(W);ie?V+=ie:V+=It();var J;i===null?J="null":tt(i)?J="array":i!==void 0&&i.$$typeof===t?(J="<"+(te(i.type)||"Unknown")+" />",V=" Did you accidentally export a JSX literal instead of a component?"):J=typeof i,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",J,V)}var Z=Wr(i,f,h,W,K);if(Z==null)return Z;if(I){var he=f.children;if(he!==void 0)if(w)if(tt(he)){for(var je=0;je<he.length;je++)Lt(he[je],i);Object.freeze&&Object.freeze(he)}else g("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 Lt(he,i)}if(Ve.call(f,"key")){var _e=te(i),se=Object.keys(f).filter(function(Jr){return Jr!=="key"}),at=se.length>0?"{key: someKey, "+se.join(": ..., ")+": ...}":"{key: someKey}";if(!Wt[_e+at]){var Gr=se.length>0?"{"+se.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
27
+ Check the top-level render call using <`+A+">.")}return E}}function Ns(y,E){{if(!y._store||y._store.validated||y.key!=null)return;y._store.validated=!0;var A=dd(E);if(Es[A])return;Es[A]=!0;var $="";y&&y._owner&&y._owner!==gi.current&&($=" It was passed a child from "+ye(y._owner.type)+"."),hn(y),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',A,$),hn(null)}}function Ms(y,E){{if(typeof y!="object")return;if(pi(y))for(var A=0;A<y.length;A++){var $=y[A];bi($)&&Ns($,E)}else if(bi(y))y._store&&(y._store.validated=!0);else if(y){var te=g(y);if(typeof te=="function"&&te!==y.entries)for(var se=te.call(y),Z;!(Z=se.next()).done;)bi(Z.value)&&Ns(Z.value,E)}}}function fd(y){{var E=y.type;if(E==null||typeof E=="string")return;var A;if(typeof E=="function")A=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===a||E.$$typeof===d))A=E.propTypes;else return;if(A){var $=ye(E);Zu(A,y.props,"prop",$,y)}else if(E.PropTypes!==void 0&&!yi){yi=!0;var te=ye(E);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",te||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function hd(y){{for(var E=Object.keys(y.props),A=0;A<E.length;A++){var $=E[A];if($!=="children"&&$!=="key"){hn(y),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",$),hn(null);break}}y.ref!==null&&(hn(y),x("Invalid attribute `ref` supplied to `React.Fragment`."),hn(null))}}var Ts={};function pd(y,E,A,$,te,se){{var Z=oe(y);if(!Z){var G="";(y===void 0||typeof y=="object"&&y!==null&&Object.keys(y).length===0)&&(G+=" 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 Ve=ud(te);Ve?G+=Ve:G+=Cs();var me;y===null?me="null":pi(y)?me="array":y!==void 0&&y.$$typeof===e?(me="<"+(ye(y.type)||"Unknown")+" />",G=" Did you accidentally export a JSX literal instead of a component?"):me=typeof y,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",me,G)}var be=cd(y,E,A,te,se);if(be==null)return be;if(Z){var nt=E.children;if(nt!==void 0)if($)if(pi(nt)){for(var pn=0;pn<nt.length;pn++)Ms(nt[pn],y);Object.freeze&&Object.freeze(nt)}else x("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 Ms(nt,y)}if(Rn.call(E,"key")){var Ut=ye(y),qe=Object.keys(E).filter(function(yd){return yd!=="key"}),vi=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!Ts[Ut+vi]){var gd=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
28
28
  let props = %s;
29
29
  <%s {...props} />
30
30
  React keys must be passed directly to JSX without using spread:
31
31
  let props = %s;
32
- <%s key={someKey} {...props} />`,at,_e,Gr,_e),Wt[_e+at]=!0}}return i===n?Br(Z):Ur(Z),Z}}var Kr=Xr;We.Fragment=n,We.jsxDEV=Kr}()),We}process.env.NODE_ENV==="production"?gt.exports=bn():gt.exports=hn();var s=gt.exports;/**
32
+ <%s key={someKey} {...props} />`,vi,Ut,gd,Ut),Ts[Ut+vi]=!0}}return y===r?hd(be):fd(be),be}}var md=pd;or.Fragment=r,or.jsxDEV=md}()),or}process.env.NODE_ENV==="production"?ro.exports=vd():ro.exports=xd();var w=ro.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),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Me(o)},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(),o=r.find(n);return i.splice(o==-1?i.length:o,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 Oa(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),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=Oa(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function Da(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){t-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:t,b:r};if(s.isText&&s.text!=l.text){let c=0,u=Math.min(s.text.length,l.text.length);for(;c<u&&s.text[s.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(s.content.size||l.content.size){let c=Da(s.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class C{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,o){for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!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 o="",s=!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&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new C(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 o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),r.push(l),i+=l.nodeSize),s=a}return new C(r,i)}cutByIndex(e,t){return e==t?C.empty:e==0&&t==this.content.length?this:new C(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new C(i,o)}addToStart(e){return new C([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new C(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 Oa(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Da(this,e,t,r)}findIndex(e,t=-1){if(e==0)return sr(0,e);if(e==this.size)return sr(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 o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?sr(r+1,s):sr(r,i);i=s}}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 C.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new C(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return C.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new C(t||e,r)}static from(e){if(!e)return C.empty;if(e instanceof C)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new C([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}C.empty=new C([],0);const xi={index:0,offset:0};function sr(n,e){return xi.index=n,xi.offset=e,xi}function Nr(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(!Nr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Nr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let le=class io{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}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&&Nr(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`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 io.none;if(e instanceof io)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};le.none=[];class Mr extends Error{}class T{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=Ra(this.content,e+this.openStart,t);return r&&new T(r,this.openStart,this.openEnd)}removeBetween(e,t){return new T(Aa(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 T.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 T(C.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new T(e,r,i)}}T.empty=new T(C.empty,0,0);function Aa(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:l}=n.findIndex(t);if(i==e||o.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Aa(o.content,e-i-1,t-i-1)))}function Ra(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return n.cut(0,e).append(t).append(n.cut(e));let l=Ra(s.content,e-o-1,t);return l&&n.replaceChild(i,s.copy(l))}function Sd(n,e,t){if(t.openStart>n.depth)throw new Mr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Mr("Inconsistent open depths");return Pa(n,e,t,0)}function Pa(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=Pa(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,l=s.content;return Qt(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=wd(t,n);return Qt(o,_a(n,s,l,e,r))}else return Qt(o,Tr(n,e,r))}function Ia(n,e){if(!e.type.compatibleContent(n.type))throw new Mr("Cannot join "+e.type.name+" onto "+n.type.name)}function oo(n,e,t){let r=n.node(t);return Ia(r,e.node(t)),r}function Zt(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 $n(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Zt(n.nodeAfter,r),o++));for(let l=o;l<s;l++)Zt(i.child(l),r);e&&e.depth==t&&e.textOffset&&Zt(e.nodeBefore,r)}function Qt(n,e){return n.type.checkContent(e),n.copy(e)}function _a(n,e,t,r,i){let o=n.depth>i&&oo(n,e,i+1),s=r.depth>i&&oo(t,r,i+1),l=[];return $n(null,n,i,l),o&&s&&e.index(i)==t.index(i)?(Ia(o,s),Zt(Qt(o,_a(n,e,t,r,i+1)),l)):(o&&Zt(Qt(o,Tr(n,e,i+1)),l),$n(e,t,i,l),s&&Zt(Qt(s,Tr(t,r,i+1)),l)),$n(r,null,i,l),new C(l)}function Tr(n,e,t){let r=[];if($n(null,n,t,r),n.depth>t){let i=oo(n,e,t+1);Zt(Qt(i,Tr(n,e,t+1)),r)}return $n(e,null,t,r),new C(r)}function wd(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(C.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Wn{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 o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return le.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 o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}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 o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].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 Or(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,o=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new Wn(t,r,o)}static resolveCached(e,t){let r=As.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==t)return s}else As.set(e,r=new kd);let i=r.elts[r.i]=Wn.resolve(e,t);return r.i=(r.i+1)%Cd,i}}class kd{constructor(){this.elts=[],this.i=0}}const Cd=12,As=new WeakMap;class Or{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 Ed=Object.create(null);let zt=class so{constructor(e,t,r,i=le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||C.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&&Nr(this.attrs,t||e.defaultAttrs||Ed)&&le.sameSet(this.marks,r||le.none)}copy(e=null){return e==this.content?this:new so(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new so(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 T.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new T(c,i.depth-s,o.depth-s)}replace(e,t,r){return Sd(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 Wn.resolveCached(this,e)}resolveNoCache(e){return Wn.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.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()+")"),za(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=C.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<o;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 o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.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),this.type.checkAttrs(this.attrs);let e=le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!le.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;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=C.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};zt.prototype.text=void 0;class Dr extends zt{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):za(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Dr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Dr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function za(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class rn{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Nd(e,t);if(r.next==null)return rn.empty;let i=La(r);r.next&&r.err("Unexpected trailing text");let o=Pd(Rd(i));return Id(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!t||a.validEnd))return C.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=o(d,l.concat(u));if(f)return f}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
33
+ `)}}rn.empty=new rn(!0);class Nd{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function La(n){let e=[];do e.push(Md(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Md(n){let e=[];do e.push(Td(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Td(n){let e=Ad(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Od(n,e);else break;return e}function Rs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Od(n,e){let t=Rs(n),r=t;return n.eat(",")&&(n.next!="}"?r=Rs(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Dd(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Ad(n){if(n.eat("(")){let e=La(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Dd(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Rd(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=t())}else if(s.type=="star"){let a=t();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=t();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=t();i(o(s.expr,a),u),a=u}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=t();r(a,u),i(o(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Va(n,e){return e-n}function Ps(n,e){let t=[];return r(e),t.sort(Va);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&t.indexOf(a)==-1&&r(a)}}}function Pd(n){let e=Object.create(null);return t(Ps(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);Ps(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new rn(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Va);o.next.push({type:i[s][0],next:e[l.join(",")]||t(l)})}return o}}function Id(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ba(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function $a(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function ja(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(e[i])}}function Fa(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new zd(n,r,e[r]);return t}let Is=class Ha{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Fa(e,r.attrs),this.defaultAttrs=Ba(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==rn.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$a(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new zt(this,this.computeAttrs(e),C.from(t),le.setFrom(r))}createChecked(e=null,t,r){return t=C.from(t),this.checkContent(t),new zt(this,this.computeAttrs(e),t,le.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=C.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(C.empty,!0);return o?new zt(this,e,t.append(o),le.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ja(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:le.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new Ha(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function _d(n,e,t){let r=t.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${o}`)}}class zd{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?_d(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ur{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Fa(e,i.attrs),this.excluded=null;let o=Ba(this.attrs);this.instance=o?new le(this,o):null}create(e=null){return!e&&this.instance?this.instance:new le(this,$a(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Ur(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ja(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Wa{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Me.from(e.nodes),t.marks=Me.from(e.marks||{}),this.nodes=Is.compile(this.spec.nodes,this),this.marks=Ur.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=rn.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?_s(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:_s(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Is){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Dr(r,r.defaultAttrs,e,le.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return zt.fromJSON(this,e)}markFromJSON(e){return le.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function _s(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Ld(n){return n.tag!=null}function Vd(n){return n.style!=null}class Lt{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Ld(i))this.tags.push(i);else if(Vd(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new Ls(this,t,!1);return r.addAll(e,le.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Ls(this,t,!0);return r.addAll(e,le.none,t.from,t.to),T.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(jd(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Vs(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Vs(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Lt(e,Lt.schemaRules(e)))}}const qa={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},Bd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ua={ol:!0,ul:!0},Ar=1,Rr=2,jn=4;function zs(n,e,t){return e!=null?(e?Ar:0)|(e==="full"?Rr:0):n&&n.whitespace=="pre"?Ar|Rr:t&~jn}class lr{constructor(e,t,r,i,o,s){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=le.none,this.match=o||(s&jn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(C.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&Ar)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=C.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(C.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!qa.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ls{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=zs(null,t.preserveWhitespace,0)|(r?jn:0);i?o=new lr(i.type,i.attrs,le.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new lr(null,null,le.none,!0,null,s):o=new lr(e.schema.topNodeType,null,le.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top;if(i.options&Rr||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&Ar)i.options&Rr?r=r.replace(/\r\n?/g,`
34
+ `):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=e.nodeName.toLowerCase(),o;Ua.hasOwnProperty(i)&&this.parser.normalizeLists&&$d(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,r));if(s?s.ignore:Bd.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);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 l,a=this.top,c=this.needsBlock;if(qa.hasOwnProperty(i))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),l=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);return}let u=s&&s.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),l&&this.sync(a),this.needsBlock=c}else{let l=this.readStyles(e,t);l&&this.addElementByRule(e,s,l,s.consuming===!1?o:void 0)}}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
35
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let o,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(s,t.attrs||null,r,t.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));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,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,t,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,t);this.findAtPoint(e,o)}findPlace(e,t){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],l=s.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=s,!l.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)t=this.enterInner(r[o],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=le.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):Bs(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let o=this.findPlace(e.create(t),r);return o&&(o=this.enterInner(e,t,r,!0,i)),o}enterInner(e,t,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=zs(e,o,s.options);s.options&jn&&s.content.length==0&&(l|=jn);let a=le.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Bs(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new lr(e,t,a,i,null,l)),this.open++,r}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),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(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}}}function $d(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ua.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function jd(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Vs(n){let e={};for(let t in n)e[t]=n[t];return e}function Bs(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}class un{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Si(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,t);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=xr(Si(t),this.nodes[e.type.name](e),null,e.attrs);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 o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&xr(Si(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return xr(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new un(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=$s(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return $s(e.marks)}}function $s(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Si(n){return n.document||window.document}const js=new WeakMap;function Fd(n){let e=js.get(n);return e===void 0&&js.set(n,e=Hd(n)),e}function Hd(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function xr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Fd(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(t=i.slice(0,s),i=i.slice(s+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=xr(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const Ka=65535,Ja=Math.pow(2,16);function Wd(n,e){return n+e*Ja}function Fs(n){return n&Ka}function qd(n){return(n-(n&Ka))/Ja}const Ya=1,Ga=2,Sr=4,Xa=8;class lo{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Xa)>0}get deletedBefore(){return(this.delInfo&(Ya|Sr))>0}get deletedAfter(){return(this.delInfo&(Ga|Sr))>0}get deletedAcross(){return(this.delInfo&Sr)>0}}class Ye{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ye.empty)return Ye.empty}recover(e){let t=0,r=Fs(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+qd(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+i+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:Wd(l/3,e-a),m=e==a?Ga:e==d?Ya:Sr;return(t<0?e!=a:e!=d)&&(m|=Xa),new lo(h,m,p)}i+=u-c}return r?e+i:new lo(e+i,0,null)}touches(e,t){let r=0,i=Fs(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+t],u=this.ranges[i+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new Ye(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ye.empty:new Ye(e<0?[0,-e,0]:[0,0,e])}}Ye.empty=new Ye([]);class wn{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new wn(this.maps,this.mirror,e,t)}copy(){return new wn(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new wn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this.maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new lo(e,i,null)}}const wi=Object.create(null);class ze{getMap(){return Ye.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=wi[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in wi)throw new RangeError("Duplicate use of step JSON ID "+e);return wi[e]=t,t.prototype.jsonID=e,t}}class ve{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ve(e,null)}static fail(e){return new ve(null,e)}static fromReplace(e,t,r,i){try{return ve.ok(e.replace(t,r,i))}catch(o){if(o instanceof Mr)return ve.fail(o.message);throw o}}}function Lo(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Lo(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return C.fromArray(r)}class Pt extends ze{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new T(Lo(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,o)}invert(){return new ht(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Pt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Pt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Pt(t.from,t.to,e.markFromJSON(t.mark))}}ze.jsonID("addMark",Pt);class ht extends ze{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new T(Lo(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return ve.fromReplace(e,this.from,this.to,r)}invert(){return new Pt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ht(t.pos,r.pos,this.mark)}merge(e){return e instanceof ht&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ht(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ht(t.from,t.to,e.markFromJSON(t.mark))}}ze.jsonID("removeMark",ht);class It extends ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new T(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new It(this.pos,t.marks[i]);return new It(this.pos,this.mark)}}return new En(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new It(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new It(t.pos,e.markFromJSON(t.mark))}}ze.jsonID("addNodeMark",It);class En extends ze{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ve.fromReplace(e,this.pos,this.pos+1,new T(C.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new It(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new En(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new En(t.pos,e.markFromJSON(t.mark))}}ze.jsonID("removeNodeMark",En);class Se extends ze{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ao(e,this.from,this.to)?ve.fail("Structure replace would overwrite content"):ve.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ye([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Se(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Se)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?T.empty:new T(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?T.empty:new T(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Se(t.from,t.to,T.fromJSON(e,t.slice),!!t.structure)}}ze.jsonID("replace",Se);class we extends ze{constructor(e,t,r,i,o,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(ao(e,this.from,this.gapFrom)||ao(e,this.gapTo,this.to)))return ve.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ve.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ve.fromReplace(e,this.from,this.to,r):ve.fail("Content does not fit in gap")}getMap(){return new Ye([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new we(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new we(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new we(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}ze.jsonID("replaceAround",we);function ao(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Ud(n,e,t,r){let i=[],o=[],s,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=h:i.push(s=new ht(f,h,d[m])));l&&l.to==f?l.to=h:o.push(l=new Pt(f,h,r))}}),i.forEach(a=>n.step(a)),o.forEach(a=>n.step(a))}function Kd(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Ur){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==o-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=c,f.step=o):i.push({style:d,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>n.step(new ht(s.from,s.to,s.style)))}function Vo(n,e,t,r=t.contentMatch,i=!0){let o=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new Se(l,u,T.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ht(l,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new T(C.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),s.push(new Se(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(C.empty,!0);n.replace(l,l,new T(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function Jd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Dn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!Jd(i,o,s))break}return null}function Yd(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,u=C.empty,d=0;for(let p=o,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=C.from(r.node(p).copy(u)),d++):a--;let f=C.empty,h=0;for(let p=o,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=C.from(i.node(p).copy(f)),h++):c++;n.step(new we(a,c,s,l,new T(u.append(f),d,h),u.size-d,!0))}function Bo(n,e,t=null,r=n){let i=Gd(n,e),o=i&&Xd(r,e);return o?i.map(Hs).concat({type:e,attrs:t}).concat(o.map(Hs)):null}function Hs(n){return{type:n,attrs:null}}function Gd(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function Xd(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:s}function Zd(n,e,t){let r=C.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let l=t[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=C.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new we(i,o,i,o,new T(r,0,0),t.length,!0))}function Qd(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&ef(n.doc,n.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Qa(n,s,l,o),Vo(n,n.mapping.slice(o).map(l,1),r,void 0,c===null);let u=n.mapping.slice(o),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return n.step(new we(d,f,d+1,f-1,new T(C.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Za(n,s,l,o),!1}})}function Za(n,e,t,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+o+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Qa(n,e,t,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(t+1+o);n.replaceWith(s,s+1,e.type.schema.text(`
36
+ `))}})}function ef(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function tf(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new we(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new T(C.from(s),0,0),1,!0))}function Ct(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>o;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function nf(n,e,t=1,r){let i=n.doc.resolve(e),o=C.empty,s=C.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){o=C.from(i.node(l).copy(o));let u=r&&r[c];s=C.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}n.step(new Se(e,e,new T(o.append(s),t,t),!0))}function Ft(n,e){let t=n.resolve(e),r=t.index();return ec(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function rf(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(o.marks))return!1}return t.validEnd}function ec(n,e){return!!(n&&e&&!n.isLeaf&&rf(n,e))}function Kr(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&ec(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function of(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(e-t),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(i);u&&!d?r=!1:!u&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Qa(n,u.node(),u.before(),l)}s.inlineContent&&Vo(n,e+t-1,s,o.node().contentMatchAt(o.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new Se(c,a.map(e+t,-1),T.empty,!0)),r===!0){let u=n.doc.resolve(c);Za(n,u.node(),u.before(),n.steps.length)}return n}function sf(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function tc(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Jr(n,e,t=e,r=T.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return nc(i,o,r)?new Se(e,t,r):new lf(i,o,r).fit()}function nc(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class lf{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=C.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=C.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new T(o,s,l);return e>-1?new we(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=ki(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(t==1&&(s?c.matchType(s.type)||(d=c.fillBefore(C.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:d};if(t==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ki(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new T(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=ki(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new T(Ln(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new T(Ln(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let m=0;m<o.length;m++)this.openFrontierNode(o[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));d=d.matchFragment(i)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),g=d.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(d=g,u.push(rc(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=Vn(this.placed,t,C.from(u)),this.frontier[t].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<h;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?T.empty:new T(Ln(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new T(Ln(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ci(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Ci(e,t,i,r,o);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Ci(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Vn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Vn(this.placed,this.depth,C.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(C.empty,!0);t.childCount&&(this.placed=Vn(this.placed,this.frontier.length,t))}}function Ln(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ln(n.firstChild.content,e-1,t)))}function Vn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Vn(n.lastChild.content,e-1,t)))}function ki(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function rc(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,rc(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(C.empty,!0)))),n.copy(r)}function Ci(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!af(t,o.content,s)?l:null}function af(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function cf(n){return n.spec.defining||n.spec.definingForContent}function uf(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(nc(i,o,r))return n.step(new Se(e,t,r));let s=oc(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:i.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=cf(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<s.length;m++){let g=s[(m+a)%s.length],b=!0;g<0&&(b=!1,g=-g);let x=i.node(g-1),S=i.index(g-1);if(x.canReplaceWith(S,S,p.type,p.marks))return n.replace(i.before(g),b?o.after(g):t,new T(ic(r.content,0,r.openStart,h),h,r.openEnd))}}let d=n.steps.length;for(let f=s.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=s[f];h<0||(e=i.before(h),t=o.after(h))}}function ic(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(ic(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(C.empty,!0))}return n}function df(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=sf(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new T(C.from(r),0,0))}function ff(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=oc(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),t);n.delete(e,t)}function oc(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class kn extends ze{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ve.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return ve.fromReplace(e,this.pos,this.pos+1,new T(C.from(i),0,t.isLeaf?0:1))}getMap(){return Ye.empty}invert(e){return new kn(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kn(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new kn(t.pos,t.attr,t.value)}}ze.jsonID("attr",kn);class qn extends ze{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ve.ok(r)}getMap(){return Ye.empty}invert(e){return new qn(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new qn(t.attr,t.value)}}ze.jsonID("docAttr",qn);let Nn=class extends Error{};Nn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Nn.prototype=Object.create(Error.prototype);Nn.prototype.constructor=Nn;Nn.prototype.name="TransformError";class sc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Nn(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=T.empty){let i=Jr(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new T(C.from(r),0,0))}delete(e,t){return this.replace(e,t,T.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return uf(this,e,t,r),this}replaceRangeWith(e,t,r){return df(this,e,t,r),this}deleteRange(e,t){return ff(this,e,t),this}lift(e,t){return Yd(this,e,t),this}join(e,t=1){return of(this,e,t),this}wrap(e,t){return Zd(this,e,t),this}setBlockType(e,t=e,r,i=null){return Qd(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return tf(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new kn(e,t,r)),this}setDocAttribute(e,t){return this.step(new qn(e,t)),this}addNodeMark(e,t){return this.step(new It(e,t)),this}removeNodeMark(e,t){if(!(t instanceof le)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new En(e,t)),this}split(e,t=1,r){return nf(this,e,t,r),this}addMark(e,t,r){return Ud(this,e,t,r),this}removeMark(e,t,r){return Kd(this,e,t,r),this}clearIncompatible(e,t,r){return Vo(this,e,t,r),this}}const Ei=Object.create(null);class V{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new lc(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=T.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(o);e.replaceRange(u.map(a.pos),u.map(c.pos),l?T.empty:t),l==0&&Us(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Us(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new L(e):yn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?yn(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):yn(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Xe(e.node(0))}static atStart(e){return yn(e,e,0,0,1)||new Xe(e)}static atEnd(e){return yn(e,e,e.content.size,e.childCount,-1)||new Xe(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ei[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ei)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ei[e]=t,t.prototype.jsonID=e,t}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}}V.prototype.visible=!0;class lc{constructor(e,t){this.$from=e,this.$to=t}}let Ws=!1;function qs(n){!Ws&&!n.parent.inlineContent&&(Ws=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class L extends V{constructor(e,t=e){qs(e),qs(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return V.near(r);let i=e.resolve(t.map(this.anchor));return new L(i.parent.inlineContent?i:r,r)}replace(e,t=T.empty){if(super.replace(e,t),t==T.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof L&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yr(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new L(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=V.findFrom(t,r,!0)||V.findFrom(t,-r,!0);if(o)t=o.$head;else return V.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(V.findFrom(e,-r,!0)||V.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new L(e,t)}}V.jsonID("text",L);class Yr{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Yr(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}}class z extends V{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?V.near(o):new z(o)}content(){return new T(C.from(this.node),0,0)}eq(e){return e instanceof z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new $o(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new z(e.resolve(t.anchor))}static create(e,t){return new z(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}z.prototype.visible=!1;V.jsonID("node",z);class $o{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Yr(r,r):new $o(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&z.isSelectable(r)?new z(t):V.near(t)}}class Xe extends V{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=T.empty){if(t==T.empty){e.delete(0,e.doc.content.size);let r=V.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Xe(e)}map(e){return new Xe(e)}eq(e){return e instanceof Xe}getBookmark(){return hf}}V.jsonID("all",Xe);const hf={map(){return this},resolve(n){return new Xe(n)}};function yn(n,e,t,r,i,o=!1){if(e.inlineContent)return L.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&z.isSelectable(l))return z.create(n,t-(i<0?l.nodeSize:0))}else{let a=yn(n,l,t+i,i<0?l.childCount:0,i,o);if(a)return a}t+=l.nodeSize*i}return null}function Us(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;let o=n.mapping.maps[r],s;o.forEach((l,a,c,u)=>{s==null&&(s=u)}),n.setSelection(V.near(n.doc.resolve(s),t))}const Ks=1,ar=2,Js=4;class pf extends sc{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Ks)&~ar,this.storedMarks=null,this}get selectionSet(){return(this.updated&Ks)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ar,this}ensureMarks(e){return le.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ar)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ar,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||le.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(V.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Js,this}get scrolledIntoView(){return(this.updated&Js)>0}}function Ys(n,e){return!e||!n?n:n.bind(e)}class Bn{constructor(e,t,r){this.name=e,this.init=Ys(t.init,r),this.apply=Ys(t.apply,r)}}const mf=[new Bn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Bn("selection",{init(n,e){return n.selection||V.atStart(e.doc)},apply(n){return n.selection}}),new Bn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Bn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ni{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=mf.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Bn(r.key,r.spec.state,r))})}}class vn{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<s?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new vn(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new pf(this)}static create(e){let t=new Ni(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new vn(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new Ni(this.schema,e.plugins),r=t.fields,i=new vn(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Ni(e.schema,e.plugins),o=new vn(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=zt.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=V.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){o[s.name]=c.fromJSON.call(a,e,t[l],o);return}}o[s.name]=s.init(e,o)}}),o}}function ac(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ac(i,e,{})),t[r]=i}return t}class Le{constructor(e){this.spec=e,this.props={},e.props&&ac(e.props,this,this.props),this.key=e.key?e.key.key:cc("plugin")}getState(e){return e[this.key]}}const Mi=Object.create(null);function cc(n){return n in Mi?n+"$"+ ++Mi[n]:(Mi[n]=0,n+"$")}class et{constructor(e="key"){this.key=cc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Te=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Un=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let co=null;const wt=function(n,e,t){let r=co||(co=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},gf=function(){co=null},on=function(n,e,t,r){return t&&(Gs(n,e,t,r,-1)||Gs(n,e,t,r,1))},yf=/^(img|br|input|textarea|hr)$/i;function Gs(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:it(n))){let o=n.parentNode;if(!o||o.nodeType!=1||Zn(n)||yf.test(n.nodeName)||n.contentEditable=="false")return!1;e=Te(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?it(n):0}else return!1}}function it(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function bf(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=it(n)}else if(n.parentNode&&!Zn(n))e=Te(n),n=n.parentNode;else return null}}function vf(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Zn(n))e=Te(n)+1,n=n.parentNode;else return null}}function xf(n,e,t){for(let r=e==0,i=e==it(n);r||i;){if(n==t)return!0;let o=Te(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==it(n)}}function Zn(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Gr=function(n){return n.focusNode&&on(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Kt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Sf(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function wf(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(it(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(it(r.startContainer),r.startOffset)}}}const pt=typeof navigator<"u"?navigator:null,Xs=typeof document<"u"?document:null,Ht=pt&&pt.userAgent||"",uo=/Edge\/(\d+)/.exec(Ht),uc=/MSIE \d/.exec(Ht),fo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ht),Ke=!!(uc||fo||uo),Vt=uc?document.documentMode:fo?+fo[1]:uo?+uo[1]:0,at=!Ke&&/gecko\/(\d+)/i.test(Ht);at&&+(/Firefox\/(\d+)/.exec(Ht)||[0,0])[1];const ho=!Ke&&/Chrome\/(\d+)/.exec(Ht),Ie=!!ho,dc=ho?+ho[1]:0,je=!Ke&&!!pt&&/Apple Computer/.test(pt.vendor),Mn=je&&(/Mobile\/\w+/.test(Ht)||!!pt&&pt.maxTouchPoints>2),rt=Mn||(pt?/Mac/.test(pt.platform):!1),kf=pt?/Win/.test(pt.platform):!1,kt=/Android \d/.test(Ht),Qn=!!Xs&&"webkitFontSmoothing"in Xs.documentElement.style,Cf=Qn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ef(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function xt(n,e){return typeof n=="number"?n:n[e]}function Nf(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Zs(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;s=Un(s)){if(s.nodeType!=1)continue;let l=s,a=l==o.body,c=a?Ef(o):Nf(l),u=0,d=0;if(e.top<c.top+xt(r,"top")?d=-(c.top-e.top+xt(i,"top")):e.bottom>c.bottom-xt(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+xt(i,"top")-c.top:e.bottom-c.bottom+xt(i,"bottom")),e.left<c.left+xt(r,"left")?u=-(c.left-e.left+xt(i,"left")):e.right>c.right-xt(r,"right")&&(u=e.right-c.right+xt(i,"right")),u||d)if(a)o.defaultView.scrollBy(u,d);else{let f=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),u&&(l.scrollLeft+=u);let p=l.scrollLeft-f,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function Mf(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(o,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:fc(n.dom)}}function fc(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Un(r));return e}function Tf({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;hc(t,r==0?0:r-e)}function hc(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let mn=null;function Of(n){if(n.setActive)return n.setActive();if(mn)return n.focus(mn);let e=fc(n);n.focus(mn==null?{get preventScroll(){return mn={preventScroll:!0},!0}}:void 0),mn||(mn=!1,hc(e,0))}function pc(n,e){let t,r=2e8,i,o=0,s=e.top,l=e.top,a,c;for(let u=n.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=wt(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=u,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(o=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(o=d+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?Df(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:pc(t,i)}function Df(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=Tt(r,1);if(o.top!=o.bottom&&jo(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function jo(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Af(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Rf(n,e,t){let{node:r,offset:i}=pc(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function Pf(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let l=n.docView.nearestDesc(o,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;o=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function mc(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(jo(e,c))return mc(s,e,c)}}if((o=(o+1)%r)==i)break}return n}function If(n,e){let t=n.dom.ownerDocument,r,i=0,o=wf(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=n.dom.getBoundingClientRect();if(!jo(e,c)||(s=mc(n.dom,e,c),!s))return null}if(je)for(let c=s;r&&c;c=Un(c))c.draggable&&(r=void 0);if(s=Af(s,e),r){if(at&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let c;Qn&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=Pf(n,r,i,e))}l==null&&(l=Rf(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Qs(n){return n.top<n.bottom||n.left<n.right}function Tt(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Qs(r))return r}return Array.prototype.find.call(t,Qs)||n.getBoundingClientRect()}const _f=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gc(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=Qn||at;if(r.nodeType==3)if(s&&(_f.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=Tt(wt(r,i,i),t);if(at&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=Tt(wt(r,i-1,i-1),-1);if(c.top==a.top){let u=Tt(wt(r,i,i+1),-1);if(u.top!=a.top)return In(u,u.left<c.left)}}return a}else{let a=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,In(Tt(wt(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==it(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Ti(a.getBoundingClientRect(),!1)}if(o==null&&i<it(r)){let a=r.childNodes[i];if(a.nodeType==1)return Ti(a.getBoundingClientRect(),!0)}return Ti(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==it(r))){let a=r.childNodes[i-1],c=a.nodeType==3?wt(a,it(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return In(Tt(c,1),!1)}if(o==null&&i<it(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?wt(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return In(Tt(c,-1),!0)}return In(Tt(r.nodeType==3?wt(r):r,-t),t>=0)}function In(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ti(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function yc(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function zf(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return yc(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=gc(n,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=wt(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Lf=/[\u0590-\u08ac]/;function Vf(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=n.domSelection();return l?!Lf.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?o:s:yc(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let el=null,tl=null,nl=!1;function Bf(n,e,t){return el==e&&tl==t?nl:(el=e,tl=t,nl=t=="up"||t=="down"?zf(n,e,t):Vf(n,e,t))}const ot=0,rl=1,Yt=2,mt=3;class er{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ot,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>Te(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof vc){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof bc&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?Te(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?Te(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let u=s+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Te(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){o=Te(d.dom);break}t+=d.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(o>p&&s<g)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((at||je)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
37
+ `),d&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:Te(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(at&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&je)&&on(l.node,l.offset,u.anchorNode,u.anchorOffset)&&on(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!d){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&t>=r:e<s&&t>r){let l=r+o.border,a=s-o.border;if(e>=l&&t<=a){this.dirty=e==r||t==s?Yt:rl,e==l&&t==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=mt:o.markDirty(e-l,t-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Yt:mt}r=s}this.dirty=Yt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Yt:rl;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class bc extends er{constructor(e,t,r,i){let o,s=t.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return this.dirty==ot&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class $f extends er{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class sn extends er{constructor(e,t,r,i,o){super(e,[],r,i),this.mark=t,this.spec=o}static create(e,t,r,i){let o=i.nodeViews[t.type.name],s=o&&o(t,i,r);return(!s||!s.dom)&&(s=un.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new sn(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ot){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ot}}slice(e,t,r){let i=sn.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;t<s&&(o=mo(o,t,s,r)),e>0&&(o=mo(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Bt extends er{constructor(e,t,r,i,o,s,l,a,c){super(e,[],o,s),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,o,s){let l=o.nodeViews[t.type.name],a,c=l&&l(t,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=un.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=wc(u,r,t),c?a=new jf(e,t,r,i,u,d||null,f,c,o,s+1):t.isText?new Xr(e,t,r,i,u,f,o):new Bt(e,t,r,i,u,d||null,f,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>C.empty)}return e}matchesNode(e,t,r){return this.dirty==ot&&e.eq(this.node)&&Pr(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new Hf(this,s&&s.node,e);Uf(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(u==this.node.childCount?le.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,d,f)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,u,d,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(h=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,u,d,h,e)||a.updateNextNode(c,u,d,e,f,i)||a.addNode(c,u,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Yt)&&(s&&this.protectLocalComposition(e,s),xc(this.contentDOM,this.children,e),Mn&&Kf(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof L)||r<t||i>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=Jf(this.node.content,s,r-t,i-t);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new $f(this,o,t,i);e.input.compositionNodes.push(s),this.children=mo(this.children,r,r+i.length,e,s)}update(e,t,r,i){return this.dirty==mt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ot}updateOuterDeco(e){if(Pr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Sc(this.dom,this.nodeDOM,po(this.outerDeco,this.node,t),po(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function il(n,e,t,r,i){wc(r,e,n);let o=new Bt(void 0,n,e,t,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Xr extends Bt{constructor(e,t,r,i,o,s,l){super(e,t,r,i,o,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==mt||this.dirty!=ot&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ot||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ot,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),o=document.createTextNode(i.text);return new Xr(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=mt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class vc extends er{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ot&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class jf extends Bt{constructor(e,t,r,i,o,s,l,a,c,u){super(e,t,r,i,o,s,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==mt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,r);return o&&this.updateInner(e,t,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function xc(n,e,t){let r=n.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==n){for(;l!=r;)r=ol(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(s instanceof sn){let a=r?r.previousSibling:n.lastChild;xc(s.contentDOM,s.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=ol(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Fn=function(n){n&&(this.nodeName=n)};Fn.prototype=Object.create(null);const Gt=[new Fn];function po(n,e,t){if(n.length==0)return Gt;let r=t?Gt[0]:new Fn,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new Fn(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&i.length==1&&i.push(r=new Fn(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function Sc(n,e,t,r){if(t==Gt&&r==Gt)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=t[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Gt[0]),i=a}Ff(i,l||Gt[0],s)}return i}function Ff(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function wc(n,e,t){return Sc(n,n,Gt,po(e,t,n.nodeType!=1))}function Pr(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function ol(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Hf{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Wf(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=ot,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[o])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=sn.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,t,r,i,o){let s=this.top.children[i];return s.dirty==mt&&s.dom==s.contentDOM&&(s.dirty=Yt),s.update(e,t,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Bt){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=mt&&Pr(t,a.outerDeco));if(!f&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,t,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Yt,d.updateChildren(i,s+1),d.dirty=ot),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,o,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Pr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=Bt.create(this.top,t,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,o){let s=Bt.create(this.top,e,t,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new bc(this.top,e,t,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof sn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((je||Ie)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new vc(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Wf(n,e){let t=e,r=t.children.length,i=n.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof sn)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function qf(n,e){return n.type.side-e.type.side}function Uf(n,e,t,r){let i=e.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<i.length&&i[s].to==o;){let g=i[s++];g.widget&&(u?(d||(d=[u])).push(g):u=g)}if(u)if(d){d.sort(qf);for(let g=0;g<d.length;g++)t(d[g],c,!!a)}else t(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<n.childCount)h=c,f=n.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=o&&l.splice(g--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let p=o+f.nodeSize;if(f.isText){let g=p;s<i.length&&i[s].from<g&&(g=i[s].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<p&&(a=f.cut(g-o),f=f.cut(0,g-o),p=g,h=-1)}else for(;s<i.length&&i[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(g=>!g.inline):l.slice();r(f,m,e.forChild(o,f),h),o=p}}function Kf(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Jf(n,e,t,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=t){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function mo(n,e,t,r,i){let o=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],c=l,u=l+=a.size;c>=t||u<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>t&&o.push(a.slice(t-c,a.size,r)))}return o}function Fo(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Gr(t)){for(a=s;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&z.isSelectable(d)&&i.parent&&!(d.isInline&&xf(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new z(s==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=s,f=s;for(let h=0;h<t.rangeCount;h++){let p=t.getRangeAt(h);d=Math.min(d,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,s]=f==n.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||n.state.selection.head<l.pos&&!o?1:-1;c=Ho(n,u,l,d)}return c}function kc(n){return n.editable?n.hasFocus():Ec(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Et(n,e=!1){let t=n.state.selection;if(Cc(n,t),!!kc(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ie){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&on(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Gf(n);else{let{anchor:r,head:i}=t,o,s;sl&&!(t instanceof L)&&(t.$from.parent.inlineContent||(o=ll(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=ll(n,t.to))),n.docView.setSelection(r,i,n,e),sl&&(o&&al(o),s&&al(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Yf(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const sl=je||Ie&&dc<63;function ll(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(je&&i&&i.contentEditable=="false")return Oi(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Oi(i);if(o)return Oi(o)}}function Oi(n){return n.contentEditable="true",je&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function al(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Yf(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!kc(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Gf(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Te(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Ke&&Vt<=11&&(r.disabled=!0,r.disabled=!1)}function Cc(n,e){if(e instanceof z){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(cl(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else cl(n)}function cl(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ho(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||L.between(e,t,r)}function ul(n){return n.editable&&!n.hasFocus()?!1:Ec(n)}function Ec(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Xf(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return on(e.node,e.offset,t.anchorNode,t.anchorOffset)}function go(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&V.findFrom(o,e)}function Ot(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function dl(n,e,t){let r=n.state.selection;if(r instanceof L)if(t.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=n.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Ot(n,new L(r.$anchor,s))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=go(n.state,e);return i&&i instanceof z?Ot(n,i):!1}else if(!(rt&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?z.isSelectable(o)?Ot(n,new z(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Qn?Ot(n,new L(n.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof z&&r.node.isInline)return Ot(n,new L(e>0?r.$to:r.$from));{let i=go(n.state,e);return i?Ot(n,i):!1}}}function Ir(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Hn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function gn(n,e){return e<0?Zf(n):Qf(n)}function Zf(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,s=!1;for(at&&t.nodeType==1&&r<Ir(t)&&Hn(t.childNodes[r],-1)&&(s=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(Hn(l,-1))i=t,o=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Nc(t))break;{let l=t.previousSibling;for(;l&&Hn(l,-1);)i=t.parentNode,o=Te(l),l=l.previousSibling;if(l)t=l,r=Ir(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}s?yo(n,t,r):i&&yo(n,i,o)}function Qf(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Ir(t),o,s;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(Hn(l,1))o=t,s=++r;else break}else{if(Nc(t))break;{let l=t.nextSibling;for(;l&&Hn(l,1);)o=l.parentNode,s=Te(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Ir(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&yo(n,o,s)}function Nc(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function eh(n,e){for(;n&&e==n.childNodes.length&&!Zn(n);)e=Te(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function th(n,e){for(;n&&!e&&!Zn(n);)e=Te(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function yo(n,e,t){if(e.nodeType!=3){let o,s;(s=eh(e,t))?(e=s,t=0):(o=th(e,t))&&(e=o,t=o.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Gr(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Et(n)},50)}function fl(n,e){let t=n.state.doc.resolve(e);if(!(Ie||kf)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let o=n.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<t.end()){let o=n.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function hl(n,e,t){let r=n.state.selection;if(r instanceof L&&!r.empty||t.indexOf("s")>-1||rt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=go(n.state,e);if(s&&s instanceof z)return Ot(n,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof Xe?V.near(s,e):V.findFrom(s,e);return l?Ot(n,l):!1}return!1}function pl(n,e){if(!(n.state.selection instanceof L))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return e<0?s.delete(t.pos-o.nodeSize,t.pos):s.delete(t.pos,t.pos+o.nodeSize),n.dispatch(s),!0}return!1}function ml(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function nh(n){if(!je||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ml(n,r,"true"),setTimeout(()=>ml(n,r,"false"),20)}return!1}function rh(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function ih(n,e){let t=e.keyCode,r=rh(e);if(t==8||rt&&t==72&&r=="c")return pl(n,-1)||gn(n,-1);if(t==46&&!e.shiftKey||rt&&t==68&&r=="c")return pl(n,1)||gn(n,1);if(t==13||t==27)return!0;if(t==37||rt&&t==66&&r=="c"){let i=t==37?fl(n,n.state.selection.from)=="ltr"?-1:1:-1;return dl(n,i,r)||gn(n,i)}else if(t==39||rt&&t==70&&r=="c"){let i=t==39?fl(n,n.state.selection.from)=="ltr"?1:-1:1;return dl(n,i,r)||gn(n,i)}else{if(t==38||rt&&t==80&&r=="c")return hl(n,-1,r)||gn(n,-1);if(t==40||rt&&t==78&&r=="c")return nh(n)||hl(n,1,r)||gn(n,1);if(r==(rt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Mc(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=n.someProp("clipboardSerializer")||un.fromSchema(n.state.schema),l=Pc(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Rc[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
38
+
39
+ `);return{dom:a,text:f,slice:e}}function Tc(n,e,t,r,i){let o=i.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=e&&(r||o||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,o||r,n)}),o)return e?new T(C.from(n.state.schema.text(e.replace(/\r\n?/g,`
40
+ `))),0,0):T.empty;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)l=d;else{let f=i.marks(),{schema:h}=n.state,p=un.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=s.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),s=ah(t),Qn&&ch(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Lt.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!oh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=uh(gl(l,+u[1],+u[2]),u[4]);else if(l=T.maxOpen(sh(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=gl(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n)}),l}const oh=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function sh(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,s=[];if(n.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&Dc(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Ac(s[s.length-1],o.length));let u=Oc(l,a);s.push(u),i=i.matchType(u.type),o=a}}),s)return C.from(s)}return n}function Oc(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,C.from(n));return n}function Dc(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Dc(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(C.from(Oc(t,n,i+1))))}}function Ac(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Ac(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(C.empty,!0);return n.copy(t.append(r))}function bo(n,e,t,r,i,o){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(o=0),i<r-1&&(l=bo(l,e,t,r,i+1,o)),i>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(C.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function gl(n,e,t){return e<n.openStart&&(n=new T(bo(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new T(bo(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Rc={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let yl=null;function Pc(){return yl||(yl=document.implementation.createHTMLDocument("title"))}let Di=null;function lh(n){let e=window.trustedTypes;return e?(Di||(Di=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Di.createHTML(n)):n}function ah(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Pc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Rc[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=lh(n),i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function ch(n){let e=n.querySelectorAll(Ie?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function uh(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=C.from(a.create(r[l+1],i)),o++,s++}return new T(i,o,s)}const Fe={},He={},dh={touchstart:!0,touchmove:!0};class fh{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function hh(n){for(let e in Fe){let t=Fe[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{mh(n,r)&&!Wo(n,r)&&(n.editable||!(r.type in He))&&t(n,r)},dh[e]?{passive:!0}:void 0)}je&&n.dom.addEventListener("input",()=>null),vo(n)}function _t(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ph(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function vo(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Wo(n,r))})}function Wo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function mh(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function gh(n,e){!Wo(n,e)&&Fe[e.type]&&(n.editable||!(e.type in He))&&Fe[e.type](n,e)}He.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!_c(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(kt&&Ie&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Mn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Kt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ih(n,t)?t.preventDefault():_t(n,"key")};He.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};He.keypress=(n,e)=>{let t=e;if(_c(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||rt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Zr(n){return{left:n.clientX,top:n.clientY}}function yh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function qo(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(e,l=>s>o.depth?l(n,t,o.nodeAfter,o.before(s),i,!0):l(n,t,o.node(s),o.before(s),i,!1)))return!0;return!1}function Cn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function bh(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(Cn(n,new z(t)),!0):!1}function vh(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof z&&(r=t.node);let o=n.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(z.isSelectable(l)){r&&t.$from.depth>0&&s>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(s);break}}return i!=null?(Cn(n,z.create(n.state.doc,i)),!0):!1}function xh(n,e,t,r,i){return qo(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?vh(n,t):bh(n,t))}function Sh(n,e,t,r){return qo(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function wh(n,e,t,r){return qo(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||kh(n,t,r)}function kh(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Cn(n,L.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)Cn(n,L.create(r,l+1,l+1+s.content.size));else if(z.isSelectable(s))Cn(n,z.create(r,l));else continue;return!0}}function Uo(n){return _r(n)}const Ic=rt?"metaKey":"ctrlKey";Fe.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Uo(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&yh(t,n.input.lastClick)&&!t[Ic]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let s=n.posAtCoords(Zr(t));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Ch(n,s,t,!!r)):(o=="doubleClick"?Sh:wh)(n,s.pos,s.inside,t)?t.preventDefault():_t(n,"pointer"))};class Ch{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ic],this.allowDefault=r.shiftKey;let o,s;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);o=u.parent,s=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof z&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&at&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),_t(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Et(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Zr(e))),this.updateAllowDefault(e),this.allowDefault||!t?_t(this.view,"pointer"):xh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||je&&this.mightDrag&&!this.mightDrag.node.isAtom||Ie&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Cn(this.view,V.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):_t(this.view,"pointer")}move(e){this.updateAllowDefault(e),_t(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Fe.touchstart=n=>{n.input.lastTouch=Date.now(),Uo(n),_t(n,"pointer")};Fe.touchmove=n=>{n.input.lastTouch=Date.now(),_t(n,"pointer")};Fe.contextmenu=n=>Uo(n);function _c(n,e){return n.composing?!0:je&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Eh=kt?5e3:-1;He.compositionstart=He.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof L&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),_r(n,!0),n.markCursor=null;else if(_r(n,!e.selection.empty),at&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}zc(n,Eh)};He.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,zc(n,20))};function zc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>_r(n),e))}function Lc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Mh());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Nh(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=bf(e.focusNode,e.focusOffset),r=vf(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,o=n.domObserver.lastChangedTextNode;if(t==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return r}}return t||r}function Mh(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function _r(n,e=!1){if(!(kt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Lc(n),e||n.docView&&n.docView.dirty){let t=Fo(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Th(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Kn=Ke&&Vt<15||Mn&&Cf<604;Fe.copy=He.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Kn?null:t.clipboardData,s=r.content(),{dom:l,text:a}=Mc(n,s);o?(t.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):Th(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Oh(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Dh(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Jn(n,r.value,null,i,e):Jn(n,r.textContent,r.innerHTML,i,e)},50)}function Jn(n,e,t,r,i){let o=Tc(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,o||T.empty)))return!0;if(!o)return!1;let s=Oh(o),l=s?n.state.tr.replaceSelectionWith(s,r):n.state.tr.replaceSelection(o);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Vc(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}He.paste=(n,e)=>{let t=e;if(n.composing&&!kt)return;let r=Kn?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Jn(n,Vc(r),r.getData("text/html"),i,t)?t.preventDefault():Dh(n,t)};class Bc{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const $c=rt?"altKey":"ctrlKey";Fe.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Zr(t)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)s=z.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(s=z.create(n.state.doc,d.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:c,slice:u}=Mc(n,l);(!t.dataTransfer.files.length||!Ie||dc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Kn?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Kn||t.dataTransfer.setData("text/plain",c),n.dragging=new Bc(u,!t[$c],s)};Fe.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};He.dragover=He.dragenter=(n,e)=>e.preventDefault();He.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Zr(t));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s,n)}):s=Tc(n,Vc(t.dataTransfer),Kn?null:t.dataTransfer.getData("text/html"),!1,o);let l=!!(r&&!t[$c]);if(n.someProp("handleDrop",p=>p(n,t,s||T.empty,l))){t.preventDefault();return}if(!s)return;t.preventDefault();let a=s?tc(n.state.doc,o.pos,s):o.pos;a==null&&(a=o.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&z.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new z(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,x)=>p=x),c.setSelection(Ho(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};Fe.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Et(n)},20))};Fe.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};Fe.beforeinput=(n,e)=>{if(Ie&&kt&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Kt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in He)Fe[n]=He[n];function Yn(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class zr{constructor(e,t){this.toDOM=e,this.spec=t||en,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:s}=e.mapResult(t.from+i,this.side<0?-1:1);return s?null:new $e(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof zr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Yn(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $t{constructor(e,t){this.attrs=e,this.spec=t||en}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new $e(o,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof $t&&Yn(this.attrs,e.attrs)&&Yn(this.spec,e.spec)}static is(e){return e.type instanceof $t}destroy(){}}class Ko{constructor(e,t){this.attrs=e,this.spec=t||en}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let s=e.mapResult(t.to+i,-1);return s.deleted||s.pos<=o.pos?null:new $e(o.pos-r,s.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof Ko&&Yn(this.attrs,e.attrs)&&Yn(this.spec,e.spec)}destroy(){}}class $e{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new $e(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new $e(e,e,new zr(t,r))}static inline(e,t,r,i){return new $e(e,t,new $t(r,i))}static node(e,t,r,i){return new $e(e,t,new Ko(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof $t}get widget(){return this.type instanceof zr}}const bn=[],en={};class ue{constructor(e,t){this.local=e.length?e:bn,this.children=t.length?t:bn}static create(e,t){return t.length?Lr(t,e,0,en):Pe}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,r,i+l,o)}}map(e,t,r){return this==Pe||e.maps.length==0?this:this.mapInner(e,t,0,0,r||en)}mapInner(e,t,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?Ah(this.children,s||[],e,t,r,i,o):s?new ue(s.sort(tn),bn):Pe}add(e,t){return t.length?this==Pe?ue.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Fc(t,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,u,c+1):i.splice(o,0,a,a+l.nodeSize,Lr(u,l,c+1,en)),o+=3}});let s=jc(o?Hc(t):t,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ue(s.length?this.local.concat(s).sort(tn):this.local,i||this.children)}remove(e){return e.length==0||this==Pe?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+t,a=r[o+1]+t;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,l+1);c!=Pe?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ue(i,r):Pe}forChild(e,t){if(this==Pe)return this;if(t.isLeaf)return ue.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof $t){let c=Math.max(o,a.from)-o,u=Math.min(s,a.to)-o;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new ue(i.sort(tn),bn);return r?new At([l,r]):l}return r||Pe}eq(e){if(this==e)return!0;if(!(e instanceof ue)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Jo(this.localsInner(e))}localsInner(e){if(this==Pe)return bn;if(e.inlineContent||!this.local.some($t.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof $t||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ue.empty=new ue([],[]);ue.removeOverlap=Jo;const Pe=ue.empty;class At{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,en));return At.from(r)}forChild(e,t){if(t.isLeaf)return ue.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=Pe&&(o instanceof At?r=r.concat(o.members):r.push(o))}return At.from(r)}eq(e){if(!(e instanceof At)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let s=0;s<o.length;s++)t.push(o[s])}}return t?Jo(r?t:t.sort(tn)):bn}static from(e){switch(e.length){case 0:return Pe;case 1:return e[0];default:return new At(e.every(t=>t instanceof ue)?e:e.reduce((t,r)=>t.concat(r instanceof ue?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Ah(n,e,t,r,i,o,s){let l=n.slice();for(let c=0,u=o;c<t.maps.length;c++){let d=0;t.maps[c].forEach((f,h,p,m)=>{let g=m-p-(h-f);for(let b=0;b<l.length;b+=3){let x=l[b+1];if(x<0||f>x+u-d)continue;let S=l[b]+u-d;h>=S?l[b+1]=f<=S?-2:-1:f>=u&&g&&(l[b]+=g,l[b+1]+=g)}d+=g}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+o),d=u-i;if(d<0||d>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+o,-1),h=f-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let b=l[c+2].mapInner(t,g,u+1,n[c]+o+1,s);b!=Pe?(l[c]=d,l[c+1]=h,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Rh(l,n,e,t,i,o,s),u=Lr(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ue(e.sort(tn),l)}function jc(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new $e(i.from+e,i.to+e,i.type))}return t}function Rh(n,e,t,r,i,o,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,i,c);d?t.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+o+1);return t}function Fc(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>t&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function Hc(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Lr(n,e,t,r){let i=[],o=!1;e.forEach((l,a)=>{let c=Fc(n,l,a+t);if(c){o=!0;let u=Lr(c,l,t+a+1,r);u!=Pe&&i.push(a,a+l.nodeSize,u)}});let s=jc(o?Hc(n):n,-t).sort(tn);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new ue(s,i):Pe}function tn(n,e){return n.from-e.from||n.to-e.to}function Jo(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),bl(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),bl(e,i,r.copy(o.from,r.to)));break}}}return e}function bl(n,e,t){for(;e<n.length&&tn(t,n[e])>0;)e++;n.splice(e,0,t)}function Ai(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Pe&&e.push(r)}),n.cursorWrapper&&e.push(ue.create(n.state.doc,[n.cursorWrapper.deco])),At.from(e)}const Ph={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ih=Ke&&Vt<=11;class _h{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class zh{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _h,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Ke&&Vt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Ih&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Ph)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ul(this.view)){if(this.suppressingSelectionUpdates)return Et(this.view);if(Ke&&Vt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&on(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let o=e.focusNode;o;o=Un(o))t.add(o);for(let o=e.anchorNode;o;o=Un(o))if(t.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&ul(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let d=this.registerMutation(t[u],a);d&&(o=o<0?d.from:Math.min(d.from,o),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(at&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||Bh(e,d)!=h)&&f.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Gr(r)&&(c=Fo(e))&&c.eq(V.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Et(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),Lh(e)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Et(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];t.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Ke&&Vt<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f)}let s=i&&i.parentNode==e.target?Te(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?Te(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let vl=new WeakMap,xl=!1;function Lh(n){if(!vl.has(n)&&(vl.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=at,xl)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),xl=!0}}function Sl(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return on(s.node,s.offset,i,o)&&([t,r,i,o]=[i,o,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:o}}function Vh(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Sl(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Sl(n,t):null}function Bh(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function $h(n,e,t){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],Gr(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Ie&&n.input.lastKeyCode===8)for(let g=o;g>i;g--){let b=r.childNodes[g-1],x=b.pmViewDesc;if(b.nodeName=="BR"&&!x){o=g;break}if(!x||x.size)break}let d=n.state.doc,f=n.someProp("domParser")||Lt.fromSchema(n.state.schema),h=d.resolve(s),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:o,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:jh,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),p={anchor:g+s,head:b+s}}return{doc:m,sel:p,from:s,to:l}}function jh(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(je&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||je&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Fh=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Hh(n,e,t,r,i){let o=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let _=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,oe=Fo(n,_);if(oe&&!n.state.selection.eq(oe)){if(Ie&&kt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Ee=>Ee(n,Kt(13,"Enter"))))return;let ge=n.state.tr.setSelection(oe);_=="pointer"?ge.setMeta("pointer",!0):_=="key"&&ge.scrollIntoView(),o&&ge.setMeta("composition",o),n.dispatch(ge)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=$h(n,e,t),u=n.state.doc,d=u.slice(c.from,c.to),f,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,h="end"):(f=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let p=Uh(d.content,c.doc.content,c.from,f,h);if(p&&n.input.domChangeCount++,(Mn&&n.input.lastIOSEnter>Date.now()-225||kt)&&i.some(_=>_.nodeType==1&&!Fh.test(_.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",_=>_(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof L&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let _=wl(n,n.state.doc,c.sel);if(_&&!_.eq(n.state.selection)){let oe=n.state.tr.setSelection(_);o&&oe.setMeta("composition",o),n.dispatch(oe)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof L&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Ke&&Vt<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),x=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA,S;if((Mn&&n.input.lastIOSEnter>Date.now()-225&&(!x||i.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&!m.sameParent(g)&&(S=V.findFrom(c.doc.resolve(m.pos+1),1,!0))&&S.head==g.pos)&&n.someProp("handleKeyDown",_=>_(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&qh(u,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",_=>_(n,Kt(8,"Backspace")))){kt&&Ie&&n.domObserver.suppressSelectionUpdates();return}Ie&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),kt&&!x&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(_){return _(n,Kt(13,"Enter"))})},20));let k=p.start,v=p.endA,N,O,B;if(x){if(m.pos==g.pos)Ke&&Vt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Et(n),20)),N=n.state.tr.delete(k,v),O=u.resolve(p.start).marksAcross(u.resolve(p.endA));else if(p.endA==p.endB&&(B=Wh(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start()))))N=n.state.tr,B.type=="add"?N.addMark(k,v,B.mark):N.removeMark(k,v,B.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let _=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",oe=>oe(n,k,v,_)))return;N=n.state.tr.insertText(_,k,v)}}if(N||(N=n.state.tr.replace(k,v,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let _=wl(n,N.doc,c.sel);_&&!(Ie&&n.composing&&_.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(_.head==k||_.head==N.mapping.map(v)-1)||Ke&&_.empty&&_.head==k)&&N.setSelection(_)}O&&N.ensureMarks(O),o&&N.setMeta("composition",o),n.dispatch(N.scrollIntoView())}function wl(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ho(n,e.resolve(t.anchor),e.resolve(t.head))}function Wh(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,o=r,s,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)o=t[u].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(C.from(c).eq(n))return{mark:l,type:s}}function qh(n,e,t,r,i){if(t-e<=i.pos-r.pos||Ri(r,!0,!1)<i.pos)return!1;let o=n.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&t==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(Ri(o,!0,!0));return!s.parent.isTextblock||s.pos>t||Ri(s,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Ri(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function Uh(n,e,t,r,i){let o=n.findDiffStart(e,t);if(o==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,o-Math.min(s,l));r-=s+a-o}if(s<o&&n.size<e.size){let a=r<=o&&r>=s?o-r:0;o-=a,o&&o<e.size&&kl(e.textBetween(o-1,o+1))&&(o+=a?1:-1),l=o+(l-s),s=o}else if(l<o){let a=r<=o&&r>=l?o-r:0;o-=a,o&&o<n.size&&kl(n.textBetween(o-1,o+1))&&(o+=a?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}function kl(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Kh{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new fh,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Tl),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Nl(this),El(this),this.nodeViews=Ml(this),this.docView=il(this.state.doc,Cl(this),Ai(this),this.dom,this),this.domObserver=new zh(this,(r,i,o,s)=>Hh(this,r,i,o,s)),this.domObserver.start(),hh(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&vo(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Tl),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(Lc(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ml(this);Yh(h,this.nodeViews)&&(this.nodeViews=h,o=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&vo(this),this.editable=Nl(this),El(this);let a=Ai(this),c=Cl(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=o||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Mf(this);if(s){this.domObserver.stop();let h=d&&(Ke||Ie)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Jh(i.selection,e.selection);if(d){let p=Ie?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Nh(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=il(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Xf(this))?Et(this,h):(Cc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Tf(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof z){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Zs(this,t.getBoundingClientRect(),e)}else Zs(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Bc(e.slice,e.move,i<0?void 0:z.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=t?t(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(Ke){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Of(this.dom),Et(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return If(this,e)}coordsAtPos(e,t=1){return gc(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return Bf(this,t||this.state,e)}pasteHTML(e,t){return Jn(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Jn(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(ph(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ai(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,gf())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return gh(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?je&&this.root.nodeType===11&&Sf(this.dom.ownerDocument)==this.dom&&Vh(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Cl(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[$e.node(0,n.state.doc.content.size,e)]}function El(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:$e.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Nl(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Jh(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ml(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Yh(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Tl(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var jt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Vr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Gh=typeof navigator<"u"&&/Mac/.test(navigator.platform),Xh=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Oe=0;Oe<10;Oe++)jt[48+Oe]=jt[96+Oe]=String(Oe);for(var Oe=1;Oe<=24;Oe++)jt[Oe+111]="F"+Oe;for(var Oe=65;Oe<=90;Oe++)jt[Oe]=String.fromCharCode(Oe+32),Vr[Oe]=String.fromCharCode(Oe);for(var Pi in jt)Vr.hasOwnProperty(Pi)||(Vr[Pi]=jt[Pi]);function Zh(n){var e=Gh&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Xh&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Vr:jt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Qh=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function ep(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))Qh?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),s&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function tp(n){let e=Object.create(null);for(let t in n)e[ep(t)]=n[t];return e}function Ii(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function np(n){return new Le({props:{handleKeyDown:Yo(n)}})}function Yo(n){let e=tp(n);return function(t,r){let i=Zh(r),o,s=e[Ii(i,r)];if(s&&s(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Ii(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=jt[r.keyCode])&&o!=i){let l=e[Ii(o,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Go=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Wc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const qc=(n,e,t)=>{let r=Wc(n,t);if(!r)return!1;let i=Xo(r);if(!i){let s=r.blockRange(),l=s&&Dn(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(eu(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Tn(o,"end")||z.isSelectable(o)))for(let s=r.depth;;s--){let l=Jr(n.doc,r.before(s),r.after(s),T.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Tn(o,"end")?V.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):z.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},rp=(n,e,t)=>{let r=Wc(n,t);if(!r)return!1;let i=Xo(r);return i?Uc(n,i,e):!1},ip=(n,e,t)=>{let r=Jc(n,t);if(!r)return!1;let i=Zo(r);return i?Uc(n,i,e):!1};function Uc(n,e,t){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Jr(n.doc,o,a,T.empty);if(!c||c.from!=o||c instanceof Se&&c.slice.size>=a-o)return!1;if(t){let u=n.tr.step(c);u.setSelection(L.create(u.doc,o)),t(u.scrollIntoView())}return!0}function Tn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Kc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=Xo(r)}let s=o&&o.nodeBefore;return!s||!z.isSelectable(s)?!1:(e&&e(n.tr.setSelection(z.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Xo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Jc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Yc=(n,e,t)=>{let r=Jc(n,t);if(!r)return!1;let i=Zo(r);if(!i)return!1;let o=i.nodeAfter;if(eu(n,i,e,1))return!0;if(r.parent.content.size==0&&(Tn(o,"start")||z.isSelectable(o))){let s=Jr(n.doc,r.before(),r.after(),T.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Tn(o,"start")?V.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):z.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Gc=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=Zo(r)}let s=o&&o.nodeAfter;return!s||!z.isSelectable(s)?!1:(e&&e(n.tr.setSelection(z.create(n.doc,o.pos)).scrollIntoView()),!0)};function Zo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const op=(n,e)=>{let t=n.selection,r=t instanceof z,i;if(r){if(t.node.isTextblock||!Ft(n.doc,t.from))return!1;i=t.from}else if(i=Kr(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(z.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},sp=(n,e)=>{let t=n.selection,r;if(t instanceof z){if(t.node.isTextblock||!Ft(n.doc,t.to))return!1;r=t.to}else if(r=Kr(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},lp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Dn(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Xc=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
41
+ `).scrollIntoView()),!0)};function Qo(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const ap=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),s=Qo(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(V.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Zc=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Xe||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Qo(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(s,o.createAndFill());l.setSelection(L.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Qc=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Ct(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Dn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function cp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof z&&e.selection.node.isBlock)return!r.parentOffset||!Ct(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Qo(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),o.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof L||e.selection instanceof Xe)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ct(u.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Ct(u.doc,d,o.length,o)),u.split(d,o.length,o),!a&&c&&r.node(s).type!=l){let h=u.mapping.map(r.before(s)),p=u.doc.resolve(h);l&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return t&&t(u.scrollIntoView()),!0}}const up=cp(),dp=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(z.create(n.doc,i))),!0)};function fp(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Ft(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function eu(n,e,t,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&fp(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(t){let h=e.pos+o.nodeSize,p=C.empty;for(let b=s.length-1;b>=0;b--)p=C.from(s[b].create(null,p));p=C.from(i.copy(p));let m=n.tr.step(new we(e.pos-1,h,e.pos,h,new T(p,1,0),s.length,!0)),g=m.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Ft(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:V.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Dn(d);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(d,f).scrollIntoView()),!0;if(c&&Tn(o,"start",!0)&&Tn(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=o,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let b=C.empty;for(let S=p.length-1;S>=0;S--)b=C.from(p[S].copy(b));let x=n.tr.step(new we(e.pos-p.length,e.pos+o.nodeSize,e.pos+g,e.pos+o.nodeSize-g,new T(b,p.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function tu(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(L.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const hp=tu(-1),pp=tu(1);function mp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=s&&Bo(s,n,e);return l?(r&&r(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Ol(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[o];t.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];o.setBlockType(l,a,n,e)}r(o.scrollIntoView())}return!0}}function es(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}es(Go,qc,Kc);es(Go,Yc,Gc);es(Xc,Zc,Qc,up);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function gp(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let u=t.doc.resolve(s.start-2);a=new Or(u,u,s.depth),s.endIndex<s.parent.childCount&&(s=new Or(i,t.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=Bo(a,n,e,s);return c?(r&&r(yp(t.tr,s,c,l,n).scrollIntoView()),!0):!1}}function yp(n,e,t,r,i){let o=C.empty;for(let u=t.length-1;u>=0;u--)o=C.from(t[u].type.create(t[u].attrs,o));n.step(new we(e.start-(r?2:0),e.end,e.start,e.end,new T(o,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==i&&(s=u+1);let l=t.length-s,a=e.start+t.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Ct(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return n}function bp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?vp(e,t,n,o):xp(e,t,o):!0:!1}}function vp(n,e,t,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new we(o-1,s,o,s,new T(C.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Or(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=Dn(r);if(l==null)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;return Ft(i.doc,a)&&i.join(a),e(i.scrollIntoView()),!0}function xp(n,e,t){let r=n.tr,i=t.parent;for(let h=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let o=r.doc.resolve(t.start),s=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?C.empty:C.from(i))))return!1;let d=o.pos,f=d+s.nodeSize;return r.step(new we(d-(l?1:0),f+(a?1:0),d+1,f-1,new T((l?C.empty:C.from(i.copy(C.empty))).append(a?C.empty:C.from(i.copy(C.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Sp(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=C.from(c?n.create():null),d=new T(C.from(n.create(null,C.from(l.type.create(null,u)))),c?3:1,0),f=o.start,h=o.end;t(e.tr.step(new we(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Qr(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class ei{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(){const{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l=[],a=!!e,c=e||o.tr,u=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{const g=this.buildProps(c,t),b=h(...m)(g);return l.push(b),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>c(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:s}=i,l={tr:e,editor:i,view:s,state:Qr({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}class wp{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){const r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){const r=(...i)=>{this.off(e,r),t.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function P(n,e,t){return n.config[e]===void 0&&n.parent?P(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?P(n.parent,e,t):null}):n.config[e]}function ti(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function nu(n){const e=[],{nodeExtensions:t,markExtensions:r}=ti(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:i},a=P(s,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...o,...h}})})})})}),i.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=P(s,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,d])=>{const f={...o,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:s.name,name:u,attribute:f})})}),e}function Ce(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function ie(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const l=o?String(o).split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else if(i==="style"){const l=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),l.forEach(u=>{const[d,f]=u.split(":").map(h=>h.trim());c.set(d,f)}),r[i]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[i]=o}),r},{})}function Br(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ie(t,r),{})}function ru(n){return typeof n=="function"}function q(n,e=void 0,...t){return ru(n)?e?n.bind(e)(...t):n(...t):n}function kp(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cp(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Dl(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):Cp(t.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function Al(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&kp(t)?!1:t!=null))}function Ep(n,e){var t;const r=nu(n),{nodeExtensions:i,markExtensions:o}=ti(n),s=(t=i.find(c=>P(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((b,x)=>{const S=P(x,"extendNodeSchema",d);return{...b,...S?S(c):{}}},{}),h=Al({...f,content:q(P(c,"content",d)),marks:q(P(c,"marks",d)),group:q(P(c,"group",d)),inline:q(P(c,"inline",d)),atom:q(P(c,"atom",d)),selectable:q(P(c,"selectable",d)),draggable:q(P(c,"draggable",d)),code:q(P(c,"code",d)),whitespace:q(P(c,"whitespace",d)),linebreakReplacement:q(P(c,"linebreakReplacement",d)),defining:q(P(c,"defining",d)),isolating:q(P(c,"isolating",d)),attrs:Object.fromEntries(u.map(b=>{var x;return[b.name,{default:(x=b==null?void 0:b.attribute)===null||x===void 0?void 0:x.default}]}))}),p=q(P(c,"parseHTML",d));p&&(h.parseDOM=p.map(b=>Dl(b,u)));const m=P(c,"renderHTML",d);m&&(h.toDOM=b=>m({node:b,HTMLAttributes:Br(b,u)}));const g=P(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(o.map(c=>{const u=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,b)=>{const x=P(b,"extendMarkSchema",d);return{...g,...x?x(c):{}}},{}),h=Al({...f,inclusive:q(P(c,"inclusive",d)),excludes:q(P(c,"excludes",d)),group:q(P(c,"group",d)),spanning:q(P(c,"spanning",d)),code:q(P(c,"code",d)),attrs:Object.fromEntries(u.map(g=>{var b;return[g.name,{default:(b=g==null?void 0:g.attribute)===null||b===void 0?void 0:b.default}]}))}),p=q(P(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>Dl(g,u)));const m=P(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Br(g,u)})),[c.name,h]}));return new Wa({topNode:s,nodes:l,marks:a})}function _i(n,e){return e.nodes[n]||e.marks[n]||null}function Rl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function ts(n,e){const t=un.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const Np=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var a,c;const u=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),t};function ns(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class ni{constructor(e){this.find=e.find,this.handler=e.handler}}const Mp=(n,e)=>{if(ns(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function cr(n){var e;const{editor:t,from:r,to:i,text:o,rules:s,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=Np(c)+o;return s.forEach(f=>{if(u)return;const h=Mp(d,f.find);if(!h)return;const p=a.state.tr,m=Qr({state:a.state,transaction:p}),g={from:r-(h[0].length-o.length),to:i},{commands:b,chain:x,can:S}=new ei({editor:t,state:m});f.handler({state:m,range:g,match:h,commands:b,chain:x,can:S})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:o}),a.dispatch(p),u=!0)}),u}function Tp(n){const{editor:e,rules:t}=n,r=new Le({state:{init(){return null},apply(i,o,s){const l=i.getMeta(r);if(l)return l;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=ts(C.from(u),s.schema);const{from:d}=a,f=d+u.length;cr({editor:e,from:d,to:f,text:u,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return cr({editor:e,from:o,to:s,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&cr({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:s}=i.state.selection;return s?cr({editor:e,from:s.pos,to:s.pos,text:`
42
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Op(n){return Object.prototype.toString.call(n).slice(8,-1)}function ur(n){return Op(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function ri(n,e){const t={...n};return ur(n)&&ur(e)&&Object.keys(e).forEach(r=>{ur(e[r])&&ur(n[r])?t[r]=ri(n[r],e[r]):t[r]=e[r]}),t}class Qe{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Qe(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Qe(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!!!s.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const a=s.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function Dp(n){return typeof n=="number"}class Ap{constructor(e){this.find=e.find,this.handler=e.handler}}const Rp=(n,e,t)=>{if(ns(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Pp(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:c,can:u}=new ei({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),b=h.textBetween(m-p,g-p,void 0,"");Rp(b,o.find,s).forEach(S=>{if(S.index===void 0)return;const k=m+S.index+1,v=k+S[0].length,N={from:t.tr.mapping.map(k),to:t.tr.mapping.map(v)},O=o.handler({state:t,range:N,match:S,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(O)})}),d.every(h=>h!==null)}let dr=null;const Ip=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function _p(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=Qr({state:u,transaction:m});if(!(!Pp({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(u=>new Le({view(d){const f=p=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,r&&(dr=e)},h=()=>{dr&&(dr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(o=r===d.dom.parentElement,l=f,!o){const h=dr;h&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return s=f,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!o,b=p.getMeta("applyPasteRules"),x=!!b;if(!m&&!g&&!x)return;if(x){let{text:v}=b;typeof v=="string"?v=v:v=ts(C.from(v),h.schema);const{from:N}=b,O=N+v.length,B=Ip(v);return a({rule:u,state:h,from:N,to:{b:O},pasteEvt:B})}const S=f.doc.content.findDiffStart(h.doc.content),k=f.doc.content.findDiffEnd(h.doc.content);if(!(!Dp(S)||!k||S===k.b))return a({rule:u,state:h,from:S,to:k,pasteEvt:s})}}))}function zp(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class xn{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=xn.resolve(e),this.schema=Ep(this.extensions,t),this.setupExtensions()}static resolve(e){const t=xn.sort(xn.flatten(e)),r=zp(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=P(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=P(r,"priority")||100,s=P(i,"priority")||100;return o>s?-1:o<s?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:_i(t.name,this.schema)},i=P(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=xn.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(s=>{const l={name:s.name,options:s.options,storage:s.storage,editor:e,type:_i(s.name,this.schema)},a=[],c=P(s,"addKeyboardShortcuts",l);let u={};if(s.type==="mark"&&P(s,"exitable",l)&&(u.ArrowRight=()=>Qe.handleExit({editor:e,mark:s})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,b])=>[g,()=>b({editor:e})]));u={...u,...m}}const d=np(u);a.push(d);const f=P(s,"addInputRules",l);Rl(s,e.options.enableInputRules)&&f&&r.push(...f());const h=P(s,"addPasteRules",l);Rl(s,e.options.enablePasteRules)&&h&&i.push(...h());const p=P(s,"addProseMirrorPlugins",l);if(p){const m=p();a.push(...m)}return a}).flat();return[Tp({editor:e,rules:r}),..._p({editor:e,rules:i}),...o]}get attributes(){return nu(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=ti(this.extensions);return Object.fromEntries(t.filter(r=>!!P(r,"addNodeView")).map(r=>{const i=this.attributes.filter(a=>a.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ce(r.name,this.schema)},s=P(r,"addNodeView",o);if(!s)return[];const l=(a,c,u,d,f)=>{const h=Br(a,i);return s()({node:a,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:_i(e.name,this.schema)};e.type==="mark"&&(!((t=q(P(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=P(e,"onBeforeCreate",r),o=P(e,"onCreate",r),s=P(e,"onUpdate",r),l=P(e,"onSelectionUpdate",r),a=P(e,"onTransaction",r),c=P(e,"onFocus",r),u=P(e,"onBlur",r),d=P(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class De{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new De(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new De({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}}function iu(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
43
+
44
+ `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(r,i,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=o);const h=s==null?void 0:s[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,i-c))}),l}function ou(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const Lp=De.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Le({key:new et("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,s=Math.min(...o.map(u=>u.$from.pos)),l=Math.max(...o.map(u=>u.$to.pos)),a=ou(t);return iu(r,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Vp=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),Bp=(n=!1)=>({commands:e})=>e.setContent("",n),$p=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Dn(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},jp=n=>e=>n(e),Fp=()=>({state:n,dispatch:e})=>Zc(n,e),Hp=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new L(r.doc.resolve(s-1))),!0},Wp=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const l=i.before(o),a=i.after(o);n.delete(l,a).scrollIntoView()}return!0}return!1},qp=n=>({tr:e,state:t,dispatch:r})=>{const i=Ce(n,t.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){const a=o.before(s),c=o.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},Up=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},Kp=()=>({state:n,dispatch:e})=>Go(n,e),Jp=()=>({commands:n})=>n.keyboardShortcut("Enter"),Yp=()=>({state:n,dispatch:e})=>ap(n,e);function $r(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ns(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function su(n,e,t={}){return n.find(r=>r.type===e&&$r(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Pl(n,e,t={}){return!!su(n,e,t)}function rs(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(u=>u.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(u=>u.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!su([...i.node.marks],e,t)))return;let s=i.index,l=n.start()+i.offset,a=s+1,c=l+i.node.nodeSize;for(;s>0&&Pl([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&Pl([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Wt(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const Gp=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=Wt(n,r.schema),{doc:s,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){const d=rs(a,o,e);if(d&&d.from<=c&&d.to>=u){const f=L.create(s,d.from,d.to);t.setSelection(f)}}return!0},Xp=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function lu(n){return n instanceof L}function Xt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function au(n,e=null){if(!e)return null;const t=V.atStart(n),r=V.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?L.create(n,Xt(0,i,o),Xt(n.content.size,i,o)):L.create(n,Xt(e,i,o),Xt(e,i,o))}function cu(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ii(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const Zp=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const s=()=>{(ii()||cu())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!lu(t.state.selection))return s(),!0;const l=au(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},Qp=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),em=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),uu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&uu(r)}return n};function fr(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return uu(t)}function jr(n,e,t){if(n instanceof zt||n instanceof C)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return C.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(o){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),jr("",e,t)}if(i){if(t.errorOnInvalidContent){let s=!1,l="";const a=new Wa({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Lt.fromSchema(a).parseSlice(fr(n),t.parseOptions):Lt.fromSchema(a).parse(fr(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=Lt.fromSchema(e);return t.slice?o.parseSlice(fr(n),t.parseOptions).content:o.parse(fr(n),t.parseOptions)}return jr("",e,t)}function tm(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof Se||i instanceof we))return;const o=n.mapping.maps[r];let s=0;o.forEach((l,a,c,u)=>{s===0&&(s=u)}),n.setSelection(V.near(n.doc.resolve(s),t))}const nm=n=>!("type"in n),rm=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){t={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;try{l=jr(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(s=t.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(p){return o.emit("contentError",{editor:o,error:p,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},u=!0,d=!0;if((nm(l)?l:[l]).forEach(p=>{p.check(),u=u?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),a===c&&d){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;if(u){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof C){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,a,c)}else h=l,r.replaceWith(a,c,h);t.updateSelection&&tm(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},im=()=>({state:n,dispatch:e})=>op(n,e),om=()=>({state:n,dispatch:e})=>sp(n,e),sm=()=>({state:n,dispatch:e})=>qc(n,e),lm=()=>({state:n,dispatch:e})=>Yc(n,e),am=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Kr(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},cm=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Kr(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},um=()=>({state:n,dispatch:e})=>rp(n,e),dm=()=>({state:n,dispatch:e})=>ip(n,e);function du(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function fm(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))ii()||du()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const hm=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=fm(n).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function Gn(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,s=e?Ce(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=i-r,c=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>$r(d.node.attrs,t,{strict:!1}));return o?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=a}const pm=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return Gn(t,i,e)?lp(t,r):!1},mm=()=>({state:n,dispatch:e})=>Qc(n,e),gm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return bp(r)(e,t)},ym=()=>({state:n,dispatch:e})=>Xc(n,e);function oi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Il(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const bm=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=oi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Ce(n,r.schema)),l==="mark"&&(s=Wt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{o&&o===c.type&&t.setNodeMarkup(u,void 0,Il(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&t.addMark(u,u+c.nodeSize,s.create(Il(d.attrs,e)))})})}),!0):!1},vm=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),xm=()=>({tr:n,dispatch:e})=>{if(e){const t=new Xe(n.doc);n.setSelection(t)}return!0},Sm=()=>({state:n,dispatch:e})=>Kc(n,e),wm=()=>({state:n,dispatch:e})=>Gc(n,e),km=()=>({state:n,dispatch:e})=>dp(n,e),Cm=()=>({state:n,dispatch:e})=>pp(n,e),Em=()=>({state:n,dispatch:e})=>hp(n,e);function xo(n,e,t={},r={}){return jr(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const Nm=(n,e=!1,t={},r={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{var a,c;const{doc:u}=o;if(t.preserveWhitespace!=="full"){const d=xo(n,i.schema,t,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return s&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!e),!0}return s&&o.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:u.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function fu(n,e){const t=Wt(e,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function Mm(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function hu(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function is(n){return e=>hu(e.$from,n)}function Tm(n,e){const t={from:0,to:n.content.size};return iu(n,t,e)}function Om(n,e){const t=Ce(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,l=>{o.push(l)});const s=o.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function Dm(n,e){const t=oi(typeof e=="string"?e:e.name,n.schema);return t==="node"?Om(n,e):t==="mark"?fu(n,e):{}}function pu(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n),s=rs(o,i.type);s&&r.push({mark:i,...s})}):t.nodesBetween(n,e,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function wr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function So(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?Wt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>$r(d.attrs,t,{strict:!1}));let s=0;const l=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(h,g),x=Math.min(p,g+m.nodeSize),S=x-b;s+=S,l.push(...m.marks.map(k=>({mark:k,from:b,to:x})))})}),s===0)return!1;const a=l.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>$r(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=l.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+c:a)>=s}function Am(n,e,t={}){if(!e)return Gn(n,null,t)||So(n,null,t);const r=oi(e,n.schema);return r==="node"?Gn(n,e,t):r==="mark"?So(n,e,t):!1}function _l(n,e){const{nodeExtensions:t}=ti(e),r=t.find(s=>s.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=q(P(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function ss(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(o=>{i!==!1&&(ss(o,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Rm(n){return n instanceof z}function Pm(n,e,t){var r;const{selection:i}=e;let o=null;if(lu(i)&&(o=i.$cursor),o){const l=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}const{ranges:s}=i;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const h=!f||f.type.allowsMarkType(t),p=!!t.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}const Im=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:s,ranges:l}=o,a=Wt(n,r.schema);if(i)if(s){const c=fu(r,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{const p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===a)?f.marks.forEach(b=>{a===b.type&&t.addMark(p,m,a.create({...b.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return Pm(r,t,a)},_m=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),zm=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Ce(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:l})=>Ol(o,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Ol(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Lm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Xt(n,0,r.content.size),o=z.create(r,i);e.setSelection(o)}return!0},Vm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=L.atStart(r).from,l=L.atEnd(r).to,a=Xt(i,s,l),c=Xt(o,s,l),u=L.create(r,a,c);e.setSelection(u)}return!0},Bm=n=>({state:e,dispatch:t})=>{const r=Ce(n,e.schema);return Sp(r)(e,t)};function zl(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}const $m=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:s}=e,{$from:l,$to:a}=o,c=i.extensionManager.attributes,u=wr(c,l.node().type.name,l.node().attrs);if(o instanceof z&&o.node.isBlock)return!l.parentOffset||!Ct(s,l.pos)?!1:(r&&(n&&zl(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:Mm(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Ct(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Ct(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(p&&(o instanceof L&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}n&&zl(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},jm=(n,e={})=>({tr:t,state:r,dispatch:i,editor:o})=>{var s;const l=Ce(n,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let b=C.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let B=a.depth-x;B>=a.depth-3;B-=1)b=C.from(a.node(B).copy(b));const S=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...wr(f,a.node().type.name,a.node().attrs),...e},v=((s=l.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(k))||void 0;b=b.append(C.from(l.createAndFill(null,v)||void 0));const N=a.before(a.depth-(x-1));t.replace(N,a.after(-S),new T(b,4-x,0));let O=-1;t.doc.nodesBetween(N,t.doc.content.size,(B,_)=>{if(O>-1)return!1;B.isTextblock&&B.content.size===0&&(O=_+1)}),O>-1&&t.setSelection(L.near(t.doc.resolve(O))),t.scrollIntoView()}return!0}const h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...wr(f,d.type.name,d.attrs),...e},m={...wr(f,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Ct(t.doc,a.pos,2))return!1;if(i){const{selection:b,storedMarks:x}=r,{splittableMarks:S}=o.extensionManager,k=x||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!k||!i)return!0;const v=k.filter(N=>S.includes(N.type.name));t.ensureMarks(v)}return!0},zi=(n,e)=>{const t=is(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ft(n.doc,t.pos)&&n.join(t.pos),!0},Li=(n,e)=>{const t=is(s=>s.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&Ft(n.doc,r)&&n.join(r),!0},Fm=(n,e,t,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=Ce(n,s.schema),p=Ce(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:x}=m,S=b.blockRange(x),k=g||m.$to.parentOffset&&m.$from.marks();if(!S)return!1;const v=is(N=>_l(N.type.name,d))(m);if(S.depth>=1&&v&&S.depth-v.depth<=1){if(v.node.type===h)return c.liftListItem(p);if(_l(v.node.type.name,d)&&h.validContent(v.node.content)&&l)return a().command(()=>(o.setNodeMarkup(v.pos,h),!0)).command(()=>zi(o,h)).command(()=>Li(o,h)).run()}return!t||!k||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>zi(o,h)).command(()=>Li(o,h)).run():a().command(()=>{const N=u().wrapInList(h,r),O=k.filter(B=>f.includes(B.type.name));return o.ensureMarks(O),N?!0:c.clearNodes()}).wrapInList(h,r).command(()=>zi(o,h)).command(()=>Li(o,h)).run()},Hm=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,s=Wt(n,r.schema);return So(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},Wm=(n,e,t={})=>({state:r,commands:i})=>{const o=Ce(n,r.schema),s=Ce(e,r.schema),l=Gn(r,o,t);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(s,a):i.setNode(o,{...a,...t})},qm=(n,e={})=>({state:t,commands:r})=>{const i=Ce(n,t.schema);return Gn(t,i,e)?r.lift(i):r.wrapIn(i,e)},Um=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const s=n.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(o.text){const a=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,a))}else s.delete(o.from,o.to)}return!0}}return!1},Km=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},Jm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Wt(n,r.schema),{$from:c,empty:u,ranges:d}=l;if(!i)return!0;if(u&&s){let{from:f,to:h}=l;const p=(o=c.marks().find(g=>g.type===a))===null||o===void 0?void 0:o.attrs,m=rs(c,a,p);m&&(f=m.from,h=m.to),t.removeMark(f,h,a)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},Ym=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,s=null;const l=oi(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(o=Ce(n,r.schema)),l==="mark"&&(s=Wt(n,r.schema)),i&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let d,f,h,p;t.selection.empty?r.doc.nodesBetween(c,u,(m,g)=>{o&&o===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m)}):r.doc.nodesBetween(c,u,(m,g)=>{g<c&&o&&o===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,u),d=g,f=m),g>=c&&g<=u&&(o&&o===m.type&&t.setNodeMarkup(g,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(b=>{if(s===b.type){const x=Math.max(g,c),S=Math.min(g+m.nodeSize,u);t.addMark(x,S,s.create({...b.attrs,...e}))}}))}),f&&(d!==void 0&&t.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(m=>{s===m.type&&t.addMark(h,p,s.create({...m.attrs,...e}))}))}),!0):!1},Gm=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return mp(i,e)(t,r)},Xm=(n,e={})=>({state:t,dispatch:r})=>{const i=Ce(n,t.schema);return gp(i,e)(t,r)};var Zm=Object.freeze({__proto__:null,blur:Vp,clearContent:Bp,clearNodes:$p,command:jp,createParagraphNear:Fp,cut:Hp,deleteCurrentNode:Wp,deleteNode:qp,deleteRange:Up,deleteSelection:Kp,enter:Jp,exitCode:Yp,extendMarkRange:Gp,first:Xp,focus:Zp,forEach:Qp,insertContent:em,insertContentAt:rm,joinBackward:sm,joinDown:om,joinForward:lm,joinItemBackward:am,joinItemForward:cm,joinTextblockBackward:um,joinTextblockForward:dm,joinUp:im,keyboardShortcut:hm,lift:pm,liftEmptyBlock:mm,liftListItem:gm,newlineInCode:ym,resetAttributes:bm,scrollIntoView:vm,selectAll:xm,selectNodeBackward:Sm,selectNodeForward:wm,selectParentNode:km,selectTextblockEnd:Cm,selectTextblockStart:Em,setContent:Nm,setMark:Im,setMeta:_m,setNode:zm,setNodeSelection:Lm,setTextSelection:Vm,sinkListItem:Bm,splitBlock:$m,splitListItem:jm,toggleList:Fm,toggleMark:Hm,toggleNode:Wm,toggleWrap:qm,undoInputRule:Um,unsetAllMarks:Km,unsetMark:Jm,updateAttributes:Ym,wrapIn:Gm,wrapInList:Xm});const Qm=De.create({name:"commands",addCommands(){return{...Zm}}}),eg=De.create({name:"drop",addProseMirrorPlugins(){return[new Le({key:new et("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),tg=De.create({name:"editable",addProseMirrorPlugins(){return[new Le({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ng=De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Le({key:new et("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),rg=De.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?g===d.pos:V.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ii()||du()?o:i},addProseMirrorPlugins(){return[new Le({key:new et("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:s,to:l}=e.selection,a=V.atStart(e.doc).from,c=V.atEnd(e.doc).to;if(o||!(s===a&&l===c)||!ss(t.doc))return;const f=t.tr,h=Qr({state:t,transaction:f}),{commands:p}=new ei({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),ig=De.create({name:"paste",addProseMirrorPlugins(){return[new Le({key:new et("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),og=De.create({name:"tabindex",addProseMirrorPlugins(){return[new Le({key:new et("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Jt{get name(){return this.node.type.name}constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Jt(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Jt(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Jt(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=this.pos+r+(o?0:1),l=this.resolvedPos.doc.resolve(s);if(!i&&l.depth<=this.depth)return;const a=new Jt(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new Jt(l,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const o=i.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const a=s[l];if(o[a]!==t[a])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(t);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>t[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}const sg=`.ProseMirror {
45
+ position: relative;
46
+ }
47
+
48
+ .ProseMirror {
49
+ word-wrap: break-word;
50
+ white-space: pre-wrap;
51
+ white-space: break-spaces;
52
+ -webkit-font-variant-ligatures: none;
53
+ font-variant-ligatures: none;
54
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
55
+ }
56
+
57
+ .ProseMirror [contenteditable="false"] {
58
+ white-space: normal;
59
+ }
60
+
61
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
62
+ white-space: pre-wrap;
63
+ }
64
+
65
+ .ProseMirror pre {
66
+ white-space: pre-wrap;
67
+ }
68
+
69
+ img.ProseMirror-separator {
70
+ display: inline !important;
71
+ border: none !important;
72
+ margin: 0 !important;
73
+ width: 0 !important;
74
+ height: 0 !important;
75
+ }
76
+
77
+ .ProseMirror-gapcursor {
78
+ display: none;
79
+ pointer-events: none;
80
+ position: absolute;
81
+ margin: 0;
82
+ }
83
+
84
+ .ProseMirror-gapcursor:after {
85
+ content: "";
86
+ display: block;
87
+ position: absolute;
88
+ top: -2px;
89
+ width: 20px;
90
+ border-top: 1px solid black;
91
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
92
+ }
93
+
94
+ @keyframes ProseMirror-cursor-blink {
95
+ to {
96
+ visibility: hidden;
97
+ }
98
+ }
99
+
100
+ .ProseMirror-hideselection *::selection {
101
+ background: transparent;
102
+ }
103
+
104
+ .ProseMirror-hideselection *::-moz-selection {
105
+ background: transparent;
106
+ }
107
+
108
+ .ProseMirror-hideselection * {
109
+ caret-color: transparent;
110
+ }
111
+
112
+ .ProseMirror-focused .ProseMirror-gapcursor {
113
+ display: block;
114
+ }
115
+
116
+ .tippy-box[data-animation=fade][data-state=hidden] {
117
+ opacity: 0
118
+ }`;function lg(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}class ag extends wp{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:t,slice:r,moved:i})=>this.options.onDrop(t,r,i)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=lg(sg,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const r=ru(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(o=>{const s=typeof o=="string"?`${o}$`:o.key;r=t.filter(l=>!l.key.startsWith(s))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[tg,Lp.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),Qm,ng,rg,og,eg,ig].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new xn(i,this)}createCommandManager(){this.commandManager=new ei({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=xo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=xo(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=au(t,this.options.autofocus);this.view=new Kh(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:vn.create({doc:t,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(s)});return}const t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),o=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Dm(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Am(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ts(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
119
+
120
+ `,textSerializers:r={}}=e||{};return Tm(this.state.doc,{blockSeparator:t,textSerializers:{...ou(this.schema),...r}})}get isEmpty(){return ss(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Jt(t,this)}get $doc(){return this.$pos(0)}}function ln(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=q(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,s=r[r.length-1],l=r[0];if(s){const a=l.search(/\S/),c=t.from+l.indexOf(s),u=c+s.length;if(pu(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<t.to&&o.delete(u,t.to),c>t.from&&o.delete(t.from+a,c);const f=t.from+a+s.length;o.addMark(t.from+a,f,n.type.create(i||{})),o.removeStoredMark(n.type)}}})}function mu(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=q(n.getAttributes,void 0,r)||{},{tr:o}=e,s=t.from;let l=t.to;const a=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=s+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,s+r[0].length-1),o.replaceWith(u,l,a)}else if(r[0]){const c=n.type.isInline?s:s-1;o.insert(c,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()}})}function wo(n){return new ni({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=q(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function On(n){return new ni({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=q(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),c=a&&Bo(a,n.type,o);if(!c)return null;if(s.wrap(a,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,o).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Ft(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&s.join(t.from-1)}})}class ce{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=q(P(this,"addOptions",{name:this.name}))),this.storage=q(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ce(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ri(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new ce(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=q(P(t,"addOptions",{name:t.name})),t.storage=q(P(t,"addStorage",{name:t.name,options:t.options})),t}}class cg{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,i,o,s,l,a;const{view:c}=this.editor,u=e.target,d=u.nodeType===3?(t=u.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(u)||!d)return;let f=0,h=0;if(this.dom!==d){const b=this.dom.getBoundingClientRect(),x=d.getBoundingClientRect(),S=(i=e.offsetX)!==null&&i!==void 0?i:(o=e.nativeEvent)===null||o===void 0?void 0:o.offsetX,k=(s=e.offsetY)!==null&&s!==void 0?s:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;f=x.x-b.x+S,h=x.y-b.y+k}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,f,h);const p=this.getPos();if(typeof p!="number")return;const m=z.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;const o=e.type.startsWith("drag"),s=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!s&&!o)return!0;const{isEditable:a}=this.editor,{isDragging:c}=this,u=!!this.node.type.spec.draggable,d=z.isSelectable(this.node),f=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!u&&d&&o&&e.target===this.dom&&e.preventDefault(),u&&o&&!c&&e.target===this.dom)return e.preventDefault(),!1;if(u&&a&&!c&&m){const g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(c||s||f||h||p||m&&d)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(ii()||cu())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}}function an(n){return new Ap({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=q(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];let c=t.to;if(l){const u=a.search(/\S/),d=t.from+a.indexOf(l),f=d+l.length;if(pu(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;f<t.to&&s.delete(f,t.to),d>t.from&&s.delete(t.from+u,d),c=t.from+u+l.length,s.addMark(t.from+u,c,n.type.create(o||{})),s.removeStoredMark(n.type)}}})}function ug(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ko={exports:{}},Vi={};/**
121
+ * @license React
122
+ * use-sync-external-store-shim.production.min.js
123
+ *
124
+ * Copyright (c) Facebook, Inc. and its affiliates.
125
+ *
126
+ * This source code is licensed under the MIT license found in the
127
+ * LICENSE file in the root directory of this source tree.
128
+ */var Ll;function dg(){if(Ll)return Vi;Ll=1;var n=I;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,i=n.useEffect,o=n.useLayoutEffect,s=n.useDebugValue;function l(d,f){var h=f(),p=r({inst:{value:h,getSnapshot:f}}),m=p[0].inst,g=p[1];return o(function(){m.value=h,m.getSnapshot=f,a(m)&&g({inst:m})},[d,h,f]),i(function(){return a(m)&&g({inst:m}),d(function(){a(m)&&g({inst:m})})},[d]),s(h),h}function a(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!t(d,h)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Vi.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:u,Vi}var Bi={};/**
129
+ * @license React
130
+ * use-sync-external-store-shim.development.js
131
+ *
132
+ * Copyright (c) Facebook, Inc. and its affiliates.
133
+ *
134
+ * This source code is licensed under the MIT license found in the
135
+ * LICENSE file in the root directory of this source tree.
136
+ */var Vl;function fg(){return Vl||(Vl=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=I,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(S){{for(var k=arguments.length,v=new Array(k>1?k-1:0),N=1;N<k;N++)v[N-1]=arguments[N];r("error",S,v)}}function r(S,k,v){{var N=e.ReactDebugCurrentFrame,O=N.getStackAddendum();O!==""&&(k+="%s",v=v.concat([O]));var B=v.map(function(_){return String(_)});B.unshift("Warning: "+k),Function.prototype.apply.call(console[S],console,B)}}function i(S,k){return S===k&&(S!==0||1/S===1/k)||S!==S&&k!==k}var o=typeof Object.is=="function"?Object.is:i,s=n.useState,l=n.useEffect,a=n.useLayoutEffect,c=n.useDebugValue,u=!1,d=!1;function f(S,k,v){u||n.startTransition!==void 0&&(u=!0,t("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var N=k();if(!d){var O=k();o(N,O)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var B=s({inst:{value:N,getSnapshot:k}}),_=B[0].inst,oe=B[1];return a(function(){_.value=N,_.getSnapshot=k,h(_)&&oe({inst:_})},[S,N,k]),l(function(){h(_)&&oe({inst:_});var ge=function(){h(_)&&oe({inst:_})};return S(ge)},[S]),c(N),N}function h(S){var k=S.getSnapshot,v=S.value;try{var N=k();return!o(v,N)}catch{return!0}}function p(S,k,v){return k()}var m=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g=!m,b=g?p:f,x=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;Bi.useSyncExternalStore=x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Bi}process.env.NODE_ENV==="production"?ko.exports=dg():ko.exports=fg();var si=ko.exports;const hg=(...n)=>e=>{n.forEach(t=>{typeof t=="function"?t(e):t&&(t.current=e)})},pg=({contentComponent:n})=>{const e=si.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getServerSnapshot);return I.createElement(I.Fragment,null,Object.values(e))};function mg(){const n=new Set;let e={};return{subscribe(t){return n.add(t),()=>{n.delete(t)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(t,r){e={...e,[t]:qr.createPortal(r.reactElement,r.element,t)},n.forEach(i=>i())},removeRenderer(t){const r={...e};delete r[t],e=r,n.forEach(i=>i())}}}class gg extends I.Component{constructor(e){var t;super(e),this.editorContentRef=I.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((t=e.editor)===null||t===void 0)&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=mg(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){const{editor:e,innerRef:t,...r}=this.props;return I.createElement(I.Fragment,null,I.createElement("div",{ref:hg(t,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&I.createElement(pg,{contentComponent:e.contentComponent}))}}const yg=I.forwardRef((n,e)=>{const t=I.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[n.editor]);return I.createElement(gg,{key:t,innerRef:e,...n})}),bg=I.memo(yg);var vg=function n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,i,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(!n(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;for(i of e.entries())if(!n(i[1],t.get(i[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i of e.entries())if(!t.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(i=r;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!(s==="_owner"&&e.$$typeof)&&!n(e[s],t[s]))return!1}return!0}return e!==e&&t!==t},xg=ug(vg),Co={exports:{}},$i={};/**
137
+ * @license React
138
+ * use-sync-external-store-shim/with-selector.production.min.js
139
+ *
140
+ * Copyright (c) Facebook, Inc. and its affiliates.
141
+ *
142
+ * This source code is licensed under the MIT license found in the
143
+ * LICENSE file in the root directory of this source tree.
144
+ */var Bl;function Sg(){if(Bl)return $i;Bl=1;var n=I,e=si;function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;return $i.useSyncExternalStoreWithSelector=function(c,u,d,f,h){var p=o(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=l(function(){function b(N){if(!x){if(x=!0,S=N,N=f(N),h!==void 0&&m.hasValue){var O=m.value;if(h(O,N))return k=O}return k=N}if(O=k,r(S,N))return O;var B=f(N);return h!==void 0&&h(O,B)?O:(S=N,k=B)}var x=!1,S,k,v=d===void 0?null:d;return[function(){return b(u())},v===null?void 0:function(){return b(v())}]},[u,d,f,h]);var g=i(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=g},[g]),a(g),g},$i}var ji={};/**
145
+ * @license React
146
+ * use-sync-external-store-shim/with-selector.development.js
147
+ *
148
+ * Copyright (c) Facebook, Inc. and its affiliates.
149
+ *
150
+ * This source code is licensed under the MIT license found in the
151
+ * LICENSE file in the root directory of this source tree.
152
+ */var $l;function wg(){return $l||($l=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=I,e=si;function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;function c(u,d,f,h,p){var m=o(null),g;m.current===null?(g={hasValue:!1,value:null},m.current=g):g=m.current;var b=l(function(){var v=!1,N,O,B=function(Ee){if(!v){v=!0,N=Ee;var ye=h(Ee);if(p!==void 0&&g.hasValue){var pe=g.value;if(p(pe,ye))return O=pe,pe}return O=ye,ye}var We=N,xe=O;if(r(We,Ee))return xe;var Ne=h(Ee);return p!==void 0&&p(xe,Ne)?xe:(N=Ee,O=Ne,Ne)},_=f===void 0?null:f,oe=function(){return B(d())},ge=_===null?void 0:function(){return B(_())};return[oe,ge]},[d,f,h,p]),x=b[0],S=b[1],k=i(u,x,S);return s(function(){g.hasValue=!0,g.value=k},[k]),a(k),k}ji.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ji}process.env.NODE_ENV==="production"?Co.exports=Sg():Co.exports=wg();var kg=Co.exports;const Cg=typeof window<"u"?I.useLayoutEffect:I.useEffect;class Eg{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}}function Ng(n){var e;const[t]=I.useState(()=>new Eg(n.editor)),r=kg.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:xg);return Cg(()=>t.watch(n.editor),[n.editor,t]),I.useDebugValue(r),r}const jl=process.env.NODE_ENV!=="production",Eo=typeof window>"u",Mg=Eo||!!(typeof window<"u"&&window.next);class ls{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Eo||Mg?(jl&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Eo&&jl)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...r)}};return new ag(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((i,o)=>{var s;return i===((s=t.extensions)===null||s===void 0?void 0:s[o])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?ls.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function Tg(n={},e=[]){const t=I.useRef(n);t.current=n;const[r]=I.useState(()=>new ls(t)),i=si.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return I.useDebugValue(i),I.useEffect(r.onRender(e)),Ng({editor:i,selector:({transactionNumber:o})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&o===0?0:o+1}),i}const Og=I.createContext({editor:null});Og.Consumer;const gu=I.createContext({onDragStart:void 0}),yu=()=>I.useContext(gu),Dg=n=>{const e=n.as||"div",{nodeViewContentRef:t}=yu();return I.createElement(e,{...n,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...n.style}})},bu=I.forwardRef((n,e)=>{const{onDragStart:t}=yu(),r=n.as||"div";return I.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function Ag(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function Rg(n){var e;return typeof n=="object"&&((e=n.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class Pg{constructor(e,{editor:t,props:r={},as:i="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?qr.flushSync(()=>{this.render()}):this.render()}render(){var e;const t=this.component,r=this.props,i=this.editor;(Ag(t)||Rg(t))&&(r.ref=o=>{this.ref=o}),this.reactElement=I.createElement(t,{...r}),(e=i==null?void 0:i.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t==null?void 0:t.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class Ig extends cg{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const c=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=c(this.extension.name)}const i={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)}},o=this.component,s=I.memo(c=>I.createElement(gu.Provider,{value:i},I.createElement(o,c)));s.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let l=this.node.isInline?"span":"div";this.options.as&&(l=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Pg(s,{editor:this.editor,props:e,as:l,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const i=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,s=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>i({node:e,decorations:t,innerDecorations:r})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,i({node:e,decorations:t,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=Br(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function vu(n,e){return t=>t.editor.contentComponent?new Ig(n,t,e):{}}/**
33
153
  * @license lucide-react v0.474.0 - ISC
34
154
  *
35
155
  * This source code is licensed under the ISC license.
36
156
  * See the LICENSE file in the root directory of this source tree.
37
- */const yn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pr=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
157
+ */const _g=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xu=(...n)=>n.filter((e,t,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===t).join(" ").trim();/**
38
158
  * @license lucide-react v0.474.0 - ISC
39
159
  *
40
160
  * This source code is licensed under the ISC license.
41
161
  * See the LICENSE file in the root directory of this source tree.
42
- */var vn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
162
+ */var zg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
43
163
  * @license lucide-react v0.474.0 - ISC
44
164
  *
45
165
  * This source code is licensed under the ISC license.
46
166
  * See the LICENSE file in the root directory of this source tree.
47
- */const gn=X.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:a,iconNode:l,...u},d)=>X.createElement("svg",{ref:d,...vn,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:pr("lucide",o),...u},[...l.map(([p,y])=>X.createElement(p,y)),...Array.isArray(a)?a:[a]]));/**
167
+ */const Lg=I.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...l},a)=>I.createElement("svg",{ref:a,...zg,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:xu("lucide",i),...l},[...s.map(([c,u])=>I.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
48
168
  * @license lucide-react v0.474.0 - ISC
49
169
  *
50
170
  * This source code is licensed under the ISC license.
51
171
  * See the LICENSE file in the root directory of this source tree.
52
- */const H=(e,t)=>{const r=X.forwardRef(({className:n,...o},a)=>X.createElement(gn,{ref:a,iconNode:t,className:pr(`lucide-${yn(e)}`,n),...o}));return r.displayName=`${e}`,r};/**
172
+ */const ee=(n,e)=>{const t=I.forwardRef(({className:r,...i},o)=>I.createElement(Lg,{ref:o,iconNode:e,className:xu(`lucide-${_g(n)}`,r),...i}));return t.displayName=`${n}`,t};/**
53
173
  * @license lucide-react v0.474.0 - ISC
54
174
  *
55
175
  * This source code is licensed under the ISC license.
56
176
  * See the LICENSE file in the root directory of this source tree.
57
- */const xn=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Nn=H("AlignCenter",xn);/**
177
+ */const Vg=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Bg=ee("AlignCenter",Vg);/**
58
178
  * @license lucide-react v0.474.0 - ISC
59
179
  *
60
180
  * This source code is licensed under the ISC license.
61
181
  * See the LICENSE file in the root directory of this source tree.
62
- */const En=[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]],Sn=H("AlignJustify",En);/**
182
+ */const $g=[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]],jg=ee("AlignJustify",$g);/**
63
183
  * @license lucide-react v0.474.0 - ISC
64
184
  *
65
185
  * This source code is licensed under the ISC license.
66
186
  * See the LICENSE file in the root directory of this source tree.
67
- */const wn=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Cn=H("AlignLeft",wn);/**
187
+ */const Fg=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Hg=ee("AlignLeft",Fg);/**
68
188
  * @license lucide-react v0.474.0 - ISC
69
189
  *
70
190
  * This source code is licensed under the ISC license.
71
191
  * See the LICENSE file in the root directory of this source tree.
72
- */const kn=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],Dn=H("AlignRight",kn);/**
192
+ */const Wg=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],qg=ee("AlignRight",Wg);/**
73
193
  * @license lucide-react v0.474.0 - ISC
74
194
  *
75
195
  * This source code is licensed under the ISC license.
76
196
  * See the LICENSE file in the root directory of this source tree.
77
- */const _n=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],On=H("Bold",_n);/**
197
+ */const Ug=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Kg=ee("Bold",Ug);/**
78
198
  * @license lucide-react v0.474.0 - ISC
79
199
  *
80
200
  * This source code is licensed under the ISC license.
81
201
  * See the LICENSE file in the root directory of this source tree.
82
- */const Rn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tn=H("ChevronDown",Rn);/**
202
+ */const Jg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Yg=ee("ChevronDown",Jg);/**
83
203
  * @license lucide-react v0.474.0 - ISC
84
204
  *
85
205
  * This source code is licensed under the ISC license.
86
206
  * See the LICENSE file in the root directory of this source tree.
87
- */const Pn=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],jn=H("Code",Pn);/**
207
+ */const Gg=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],Xg=ee("Code",Gg);/**
88
208
  * @license lucide-react v0.474.0 - ISC
89
209
  *
90
210
  * This source code is licensed under the ISC license.
91
211
  * See the LICENSE file in the root directory of this source tree.
92
- */const Mn=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Vn=H("CornerDownRight",Mn);/**
212
+ */const Zg=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Qg=ee("CornerDownRight",Zg);/**
93
213
  * @license lucide-react v0.474.0 - ISC
94
214
  *
95
215
  * This source code is licensed under the ISC license.
96
216
  * See the LICENSE file in the root directory of this source tree.
97
- */const An=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],st=H("Heading1",An);/**
217
+ */const ey=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],Fi=ee("Heading1",ey);/**
98
218
  * @license lucide-react v0.474.0 - ISC
99
219
  *
100
220
  * This source code is licensed under the ISC license.
101
221
  * See the LICENSE file in the root directory of this source tree.
102
- */const $n=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Bt=H("Heading2",$n);/**
222
+ */const ty=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Fl=ee("Heading2",ty);/**
103
223
  * @license lucide-react v0.474.0 - ISC
104
224
  *
105
225
  * This source code is licensed under the ISC license.
106
226
  * See the LICENSE file in the root directory of this source tree.
107
- */const zn=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Xt=H("Heading3",zn);/**
227
+ */const ny=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Hl=ee("Heading3",ny);/**
108
228
  * @license lucide-react v0.474.0 - ISC
109
229
  *
110
230
  * This source code is licensed under the ISC license.
111
231
  * See the LICENSE file in the root directory of this source tree.
112
- */const In=[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]],Kt=H("Heading4",In);/**
232
+ */const ry=[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]],Wl=ee("Heading4",ry);/**
113
233
  * @license lucide-react v0.474.0 - ISC
114
234
  *
115
235
  * This source code is licensed under the ISC license.
116
236
  * See the LICENSE file in the root directory of this source tree.
117
- */const qn=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]],Gt=H("Heading5",qn);/**
237
+ */const iy=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]],ql=ee("Heading5",iy);/**
118
238
  * @license lucide-react v0.474.0 - ISC
119
239
  *
120
240
  * This source code is licensed under the ISC license.
121
241
  * See the LICENSE file in the root directory of this source tree.
122
- */const Hn=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]],Jt=H("Heading6",Hn);/**
242
+ */const oy=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]],Ul=ee("Heading6",oy);/**
123
243
  * @license lucide-react v0.474.0 - ISC
124
244
  *
125
245
  * This source code is licensed under the ISC license.
126
246
  * See the LICENSE file in the root directory of this source tree.
127
- */const Ln=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Wn=H("Image",Ln);/**
247
+ */const sy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ly=ee("Image",sy);/**
128
248
  * @license lucide-react v0.474.0 - ISC
129
249
  *
130
250
  * This source code is licensed under the ISC license.
131
251
  * See the LICENSE file in the root directory of this source tree.
132
- */const Yn=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Fn=H("Italic",Yn);/**
252
+ */const ay=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],cy=ee("Italic",ay);/**
133
253
  * @license lucide-react v0.474.0 - ISC
134
254
  *
135
255
  * This source code is licensed under the ISC license.
136
256
  * See the LICENSE file in the root directory of this source tree.
137
- */const Un=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Bn=H("Layers",Un);/**
257
+ */const uy=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],dy=ee("Layers",uy);/**
138
258
  * @license lucide-react v0.474.0 - ISC
139
259
  *
140
260
  * This source code is licensed under the ISC license.
141
261
  * See the LICENSE file in the root directory of this source tree.
142
- */const Xn=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],Kn=H("ListOrdered",Xn);/**
262
+ */const fy=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],hy=ee("ListOrdered",fy);/**
143
263
  * @license lucide-react v0.474.0 - ISC
144
264
  *
145
265
  * This source code is licensed under the ISC license.
146
266
  * See the LICENSE file in the root directory of this source tree.
147
- */const Gn=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],Jn=H("List",Gn);/**
267
+ */const py=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],my=ee("List",py);/**
148
268
  * @license lucide-react v0.474.0 - ISC
149
269
  *
150
270
  * This source code is licensed under the ISC license.
151
271
  * See the LICENSE file in the root directory of this source tree.
152
- */const Zn=[["path",{d:"M5 12h14",key:"1ays0h"}]],Qn=H("Minus",Zn);/**
272
+ */const gy=[["path",{d:"M5 12h14",key:"1ays0h"}]],yy=ee("Minus",gy);/**
153
273
  * @license lucide-react v0.474.0 - ISC
154
274
  *
155
275
  * This source code is licensed under the ISC license.
156
276
  * See the LICENSE file in the root directory of this source tree.
157
- */const ei=[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]],ti=H("PaintBucket",ei);/**
277
+ */const by=[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]],vy=ee("PaintBucket",by);/**
158
278
  * @license lucide-react v0.474.0 - ISC
159
279
  *
160
280
  * This source code is licensed under the ISC license.
161
281
  * See the LICENSE file in the root directory of this source tree.
162
- */const ri=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ni=H("Plus",ri);/**
282
+ */const xy=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sy=ee("Plus",xy);/**
163
283
  * @license lucide-react v0.474.0 - ISC
164
284
  *
165
285
  * This source code is licensed under the ISC license.
166
286
  * See the LICENSE file in the root directory of this source tree.
167
- */const ii=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],oi=H("Quote",ii);/**
287
+ */const wy=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],ky=ee("Quote",wy);/**
168
288
  * @license lucide-react v0.474.0 - ISC
169
289
  *
170
290
  * This source code is licensed under the ISC license.
171
291
  * See the LICENSE file in the root directory of this source tree.
172
- */const ai=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],si=H("Redo",ai);/**
292
+ */const Cy=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],Ey=ee("Redo",Cy);/**
173
293
  * @license lucide-react v0.474.0 - ISC
174
294
  *
175
295
  * This source code is licensed under the ISC license.
176
296
  * See the LICENSE file in the root directory of this source tree.
177
- */const li=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ci=H("SquareCheckBig",li);/**
297
+ */const Ny=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],My=ee("SquareCheckBig",Ny);/**
178
298
  * @license lucide-react v0.474.0 - ISC
179
299
  *
180
300
  * This source code is licensed under the ISC license.
181
301
  * See the LICENSE file in the root directory of this source tree.
182
- */const ui=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],di=H("Strikethrough",ui);/**
302
+ */const Ty=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Oy=ee("Strikethrough",Ty);/**
183
303
  * @license lucide-react v0.474.0 - ISC
184
304
  *
185
305
  * This source code is licensed under the ISC license.
186
306
  * See the LICENSE file in the root directory of this source tree.
187
- */const fi=[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]],mi=H("Subscript",fi);/**
307
+ */const Dy=[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]],Ay=ee("Subscript",Dy);/**
188
308
  * @license lucide-react v0.474.0 - ISC
189
309
  *
190
310
  * This source code is licensed under the ISC license.
191
311
  * See the LICENSE file in the root directory of this source tree.
192
- */const pi=[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]],bi=H("Superscript",pi);/**
312
+ */const Ry=[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]],Py=ee("Superscript",Ry);/**
193
313
  * @license lucide-react v0.474.0 - ISC
194
314
  *
195
315
  * This source code is licensed under the ISC license.
196
316
  * See the LICENSE file in the root directory of this source tree.
197
- */const hi=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],yi=H("Table",hi);/**
317
+ */const Iy=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],_y=ee("Table",Iy);/**
198
318
  * @license lucide-react v0.474.0 - ISC
199
319
  *
200
320
  * This source code is licensed under the ISC license.
201
321
  * See the LICENSE file in the root directory of this source tree.
202
- */const vi=[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]],gi=H("TextCursor",vi);/**
322
+ */const zy=[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]],Ly=ee("TextCursor",zy);/**
203
323
  * @license lucide-react v0.474.0 - ISC
204
324
  *
205
325
  * This source code is licensed under the ISC license.
206
326
  * See the LICENSE file in the root directory of this source tree.
207
- */const xi=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Ni=H("Underline",xi);/**
327
+ */const Vy=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],By=ee("Underline",Vy);/**
208
328
  * @license lucide-react v0.474.0 - ISC
209
329
  *
210
330
  * This source code is licensed under the ISC license.
211
331
  * See the LICENSE file in the root directory of this source tree.
212
- */const Ei=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],Si=H("Undo",Ei);/**
332
+ */const $y=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],jy=ee("Undo",$y);/**
213
333
  * @license lucide-react v0.474.0 - ISC
214
334
  *
215
335
  * This source code is licensed under the ISC license.
216
336
  * See the LICENSE file in the root directory of this source tree.
217
- */const wi=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ci=H("X",wi);function ki({editor:e}){const[t,r]=X.useState(!1);return s.jsxDEV("div",{className:"relative",children:[s.jsxDEV("button",{type:"button",className:`p-1 text-black transition-all duration-300 rounded-md shadow-lg hover:bg-blue-100 hover:text-blue-600 ${t?"bg-blue-100 text-blue-600":""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),r(!t)},children:t?s.jsxDEV(Ci,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:20,columnNumber:25},this):s.jsxDEV(Bn,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:20,columnNumber:43},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:9,columnNumber:13},this),t&&s.jsxDEV("div",{className:"fixed z-40 w-64 p-4 bg-white border border-gray-200 rounded-lg shadow-xl bottom-20 right-4 animate-slide-up",children:s.jsxDEV("div",{className:"space-y-2",children:[s.jsxDEV("h3",{className:"mb-3 font-bold text-center text-gray-700",children:"Cyber Extensions"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:26,columnNumber:25},this),s.jsxDEV("button",{type:"button",onClick:()=>{e.chain().focus().insertContent({type:"accordion",content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()},className:"flex items-center justify-center w-full gap-2 px-3 py-1 text-blue-600 duration-300 rounded-md bg-blue-50 hover:bg-blue-100 hover:text-blue-700",children:[s.jsxDEV(ni,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:54,columnNumber:29},this)," Accordion"]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:30,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:25,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:24,columnNumber:17},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:8,columnNumber:9},this)}const Be=({value:e,onChange:t})=>s.jsxDEV(xe.ColorPicker,{value:e,onChange:t,presets:[{label:"Recommended",colors:["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2","#ffffff","#000000"]}]},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/color-picker.tsx",lineNumber:12,columnNumber:9},void 0),Di=({editor:e})=>{const[t,r]=X.useState("#1677ff"),[n,o]=X.useState("#ffffff"),a=d=>{const p=d.toHexString();r(p),e.chain().focus().setColor(p).run()},l=d=>{const p=d.toHexString();o(p),e.chain().focus().setHighlight({color:p}).run()},u=d=>{d.preventDefault()};return s.jsxDEV("div",{className:"flex items-center gap-4",children:[s.jsxDEV(xe.Tooltip,{title:"Text Color",children:s.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:u,children:[s.jsxDEV(gi,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:33,columnNumber:21},void 0),s.jsxDEV(Be,{value:t,onChange:a},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:34,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:32,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:31,columnNumber:13},void 0),s.jsxDEV(xe.Tooltip,{title:"Highlight Color",children:s.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:u,children:[s.jsxDEV(ti,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:41,columnNumber:21},void 0),s.jsxDEV(Be,{value:n,onChange:l},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:42,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:40,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:39,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:29,columnNumber:9},void 0)},_i=({editor:e})=>{if(!e)return null;const t=()=>{for(let n=1;n<=6;n++)if(e.isActive("heading",{level:n}))switch(n){case 1:return s.jsxDEV(st,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:15,columnNumber:36},void 0);case 2:return s.jsxDEV(Bt,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:16,columnNumber:36},void 0);case 3:return s.jsxDEV(Xt,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:17,columnNumber:36},void 0);case 4:return s.jsxDEV(Kt,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:18,columnNumber:36},void 0);case 5:return s.jsxDEV(Gt,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:19,columnNumber:36},void 0);case 6:return s.jsxDEV(Jt,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:20,columnNumber:36},void 0)}return s.jsxDEV(st,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:24,columnNumber:16},void 0)},r=[...Array.from({length:6},(n,o)=>({key:`${o+1}`,label:s.jsxDEV("div",{className:"flex items-center gap-2",onClick:()=>e.chain().focus().toggleHeading({level:o+1}).run(),children:[X.createElement([st,Bt,Xt,Kt,Gt,Jt][o],{size:16}),s.jsxDEV("span",{children:["Heading ",o+1]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:33,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:31,columnNumber:17},void 0),className:e.isActive("heading",{level:o+1})?"ant-dropdown-menu-item-active":""}))];return s.jsxDEV(xe.Dropdown,{menu:{items:r},trigger:["hover"],placement:"bottomLeft",children:s.jsxDEV("button",{className:"flex items-center gap-1 p-2 rounded-md hover:bg-blue-100 hover:text-blue-600",children:t()},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:42,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:41,columnNumber:9},void 0)},Oi=8,Ri=8,Ti=({editor:e,buttonClass:t,activeClass:r})=>{const[n,o]=X.useState({rows:0,cols:0}),[a,l]=X.useState(!1),u=(d,p)=>{e.chain().focus().insertTable({rows:d,cols:p,withHeaderRow:!0}).run(),l(!1)};return s.jsxDEV(xe.Dropdown,{open:a,onOpenChange:l,trigger:["hover"],overlay:s.jsxDEV("div",{className:"w-56 p-4 bg-white border border-gray-300 rounded-lg shadow-xl",children:[s.jsxDEV("div",{className:"grid grid-cols-8 gap-1",children:Array.from({length:Oi}).map((d,p)=>Array.from({length:Ri}).map((y,v)=>{const O=p<n.rows&&v<n.cols;return s.jsxDEV("div",{className:`w-5 h-5 border rounded-sm cursor-pointer transition-all duration-200 ${O?"bg-blue-400 border-white scale-110":"bg-gray-200 hover:bg-gray-300"}`,onMouseEnter:()=>o({rows:p+1,cols:v+1}),onClick:()=>u(p+1,v+1)},`${p}-${v}`,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:40,columnNumber:37},void 0)}))},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:35,columnNumber:21},void 0),s.jsxDEV("div",{className:"mt-3 text-sm font-medium text-center text-gray-700",children:n.rows>0&&n.cols>0?`${n.rows} × ${n.cols} Table`:"Insert Table"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:53,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:34,columnNumber:17},void 0),children:s.jsxDEV("button",{className:`${t} ${a?r:""} transition-all`,children:s.jsxDEV(yi,{className:"w-5 h-5"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:65,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:61,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:29,columnNumber:9},void 0)};function Pi({editor:e}){if(!e)return null;const t="p-2 rounded-md transition-all duration-200 hover:bg-blue-100 hover:text-blue-600",r="bg-blue-100 text-blue-600",n=(o,a,l,u,d)=>s.jsxDEV(xe.Tooltip,{title:d,children:s.jsxDEV("button",{type:"button",onClick:a,disabled:u,className:`
218
- ${t}
219
- ${l?r:""}
220
- ${u?"opacity-50 cursor-not-allowed":""}
221
- `,children:o},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:32,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:31,columnNumber:9},this);return s.jsxDEV("div",{className:"flex flex-wrap items-center gap-2 p-2 border-b border-gray-200 rounded-t-lg bg-gray-50",children:[s.jsxDEV("div",{className:"flex items-center gap-1",children:[n(s.jsxDEV(On,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:52,columnNumber:21},this),()=>e.chain().focus().toggleBold().run(),e.isActive("bold"),!1,"Bold"),n(s.jsxDEV(Fn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:59,columnNumber:21},this),()=>e.chain().focus().toggleItalic().run(),e.isActive("italic"),!1,"Italic"),n(s.jsxDEV(Ni,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:66,columnNumber:21},this),()=>e.chain().focus().toggleUnderline().run(),e.isActive("underline"),!1,"Underline"),n(s.jsxDEV(di,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:73,columnNumber:21},this),()=>e.chain().focus().toggleStrike().run(),e.isActive("strike"),!1,"Strikethrough"),n(s.jsxDEV(jn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:80,columnNumber:21},this),()=>e.chain().focus().toggleCode().run(),e.isActive("code"),!1,"Code"),n(s.jsxDEV(mi,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:87,columnNumber:21},this),()=>e.chain().focus().toggleSubscript().run(),e.isActive("subscript"),!1,"Subscript"),n(s.jsxDEV(bi,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:94,columnNumber:21},this),()=>e.chain().focus().toggleSuperscript().run(),e.isActive("superscript"),!1,"Superscript")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:50,columnNumber:13},this),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:102,columnNumber:13},this),s.jsxDEV(_i,{editor:e},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:105,columnNumber:13},this),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:107,columnNumber:13},this),s.jsxDEV("div",{className:"flex items-center gap-1",children:[n(s.jsxDEV(Cn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:112,columnNumber:21},this),()=>e.chain().focus().setTextAlign("left").run(),e.isActive({textAlign:"left"}),!1,"Align Left"),n(s.jsxDEV(Nn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:119,columnNumber:21},this),()=>e.chain().focus().setTextAlign("center").run(),e.isActive({textAlign:"center"}),!1,"Align Center"),n(s.jsxDEV(Dn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:124,columnNumber:21},this),()=>e.chain().focus().setTextAlign("right").run(),e.isActive({textAlign:"right"}),!1,"Align Right"),n(s.jsxDEV(Sn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:129,columnNumber:21},this),()=>e.chain().focus().setTextAlign("justify").run(),e.isActive({textAlign:"justify"}),!1,"Align Justify")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:110,columnNumber:13},this),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:135,columnNumber:13},this),s.jsxDEV("div",{className:"flex items-center gap-1",children:[n(s.jsxDEV(Jn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:140,columnNumber:21},this),()=>e.chain().focus().toggleBulletList().run(),e.isActive("bulletList"),!1,"Bullet List"),n(s.jsxDEV(Kn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:145,columnNumber:21},this),()=>e.chain().focus().toggleOrderedList().run(),e.isActive("orderedList"),!1,"Ordered List"),n(s.jsxDEV(ci,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:150,columnNumber:21},this),()=>e.chain().focus().toggleTaskList().run(),e.isActive("taskList"),!1,"Task List")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:138,columnNumber:13},this),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:156,columnNumber:13},this),s.jsxDEV("div",{className:"flex items-center gap-1",children:[n(s.jsxDEV(oi,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:161,columnNumber:21},this),()=>e.chain().focus().toggleBlockquote().run(),e.isActive("blockquote"),!1,"Blockquote"),s.jsxDEV(Ti,{editor:e,buttonClass:t,activeClass:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:165,columnNumber:17},this),n(s.jsxDEV(Qn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:167,columnNumber:21},this),()=>e.chain().focus().setHorizontalRule().run(),!1,!1,"Horizontal Rule"),n(s.jsxDEV(Vn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:171,columnNumber:21},this),()=>e.chain().focus().setHardBreak().run(),!1,!1,"Line Break")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:159,columnNumber:13},this),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:176,columnNumber:13},this),s.jsxDEV("div",{className:"flex items-center gap-1",children:[n(s.jsxDEV(Si,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:181,columnNumber:21},this),()=>e.chain().focus().undo().run(),!1,!e.can().chain().focus().undo().run()),n(s.jsxDEV(si,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:187,columnNumber:21},this),()=>e.chain().focus().redo().run(),!1,!e.can().chain().focus().redo().run())]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:179,columnNumber:13},this),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:194,columnNumber:13},this),n(s.jsxDEV(Wn,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:197,columnNumber:17},this),()=>{const o=prompt("Enter the image URL");o&&e.chain().focus().insertContent({type:"image",attrs:{src:o,width:300,height:300,marginLeft:0,marginRight:0}}).run()},!1,!1,"Insert Image"),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:218,columnNumber:13},this),s.jsxDEV(Di,{editor:e},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:221,columnNumber:13},this),s.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:223,columnNumber:13},this),s.jsxDEV(ki,{editor:e},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:224,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:48,columnNumber:9},this)}const br=({title:e,childrenContent:t,editable:r,childrenEdit:n})=>{const[o,a]=X.useState(!1),l=r?s.jsxDEV(xe.Menu,{children:s.jsxDEV(xe.Menu.Item,{onClick:()=>a(!0),children:"Edit"},"edit",!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:19,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:18,columnNumber:9},void 0):null;return s.jsxDEV("div",{children:[r&&l?s.jsxDEV(xe.Dropdown,{overlay:l,trigger:["contextMenu"],children:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:28,columnNumber:17},void 0):t,s.jsxDEV(xe.Modal,{title:`Edit ${e}`,open:o,onOk:()=>a(!1),onCancel:()=>a(!1),children:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:35,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:26,columnNumber:9},void 0)},ji=({node:e,editor:t})=>{const[r,n]=X.useState(!1),[o,a]=X.useState(e.attrs.bgColor||"#f3f4f6"),[l,u]=X.useState(e.attrs.titleColor||"#000000"),d=v=>{v.preventDefault()},p=v=>{a(v.toHexString())},y=v=>{u(v.toHexString())};return s.jsxDEV(Oe.NodeViewWrapper,{className:"accordion-wrapper",children:s.jsxDEV(br,{title:"Accordion",childrenContent:s.jsxDEV("div",{className:"my-4 transition-all duration-300 border rounded-lg shadow-sm",onContextMenu:d,children:[s.jsxDEV("div",{className:"flex items-center justify-between p-4 transition-colors accordion-header",style:{backgroundColor:o},onClick:()=>n(!r),children:[s.jsxDEV("input",{className:"w-full text-lg font-medium bg-transparent border-none outline-none",style:{color:l},defaultValue:e.attrs.title||"Accordion Title",disabled:!t.isEditable,suppressContentEditableWarning:!0,contentEditable:!0,placeholder:"Accordion title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:38,columnNumber:29},void 0),s.jsxDEV(Tn,{className:`transition-transform duration-300 ${r?"rotate-180":""}`,size:20},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:47,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:33,columnNumber:25},void 0),s.jsxDEV("div",{className:`overflow-hidden duration-300 ease-in-out ${r?"max-h-96 opacity-100":"max-h-0 opacity-0"} `,children:s.jsxDEV("div",{className:"p-4 border-t",children:s.jsxDEV(Oe.NodeViewContent,{contentEditable:t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:57,columnNumber:33},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:56,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:53,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:29,columnNumber:21},void 0),editable:t.isEditable,childrenEdit:s.jsxDEV("div",{className:"px-6 py-4 space-y-6 rounded-lg bg-gray-50",children:[s.jsxDEV("div",{className:"grid grid-cols-1 gap-6",children:[s.jsxDEV("div",{className:"flex flex-col space-y-2",children:[s.jsxDEV("label",{className:"font-medium text-gray-700",children:"Background Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:69,columnNumber:33},void 0),s.jsxDEV("div",{className:"flex items-center space-x-3",children:[s.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:o}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:71,columnNumber:37},void 0),s.jsxDEV(Be,{value:o,onChange:p},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:75,columnNumber:37},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:70,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:68,columnNumber:29},void 0),s.jsxDEV("div",{className:"flex flex-col space-y-2",children:[s.jsxDEV("label",{className:"font-medium text-gray-700",children:"Title Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:80,columnNumber:33},void 0),s.jsxDEV("div",{className:"flex items-center space-x-3",children:[s.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:l}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:82,columnNumber:37},void 0),s.jsxDEV(Be,{value:l,onChange:y},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:86,columnNumber:37},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:81,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:79,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:67,columnNumber:25},void 0),s.jsxDEV("div",{className:"pt-4 border-t border-gray-200",children:s.jsxDEV("div",{className:"p-3 bg-white border rounded-md",children:[s.jsxDEV("div",{className:"text-sm text-gray-600",children:"Preview"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:93,columnNumber:33},void 0),s.jsxDEV("div",{className:"p-2 mt-2 rounded",style:{backgroundColor:o},children:s.jsxDEV("span",{style:{color:l,fontWeight:500},children:"Accordion Title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:95,columnNumber:37},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:94,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:92,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:91,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:66,columnNumber:21},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:26,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:25,columnNumber:9},void 0)},Mi=Ue.Node.create({name:"accordion",group:"block",content:"block+",atom:!1,draggable:!0,selectable:!0,inline:!1,defining:!0,addAttributes(){return{title:{default:"Accordion Title"},bgColor:{default:"#f3f4f6"},titleColor:{default:"#000000"}}},parseHTML(){return[{tag:"accordion"}]},renderHTML({HTMLAttributes:e}){return["accordion",Ue.mergeAttributes(e)]},addNodeView(){return Oe.ReactNodeViewRenderer(ji)},addCommands(){return{setAccordion:e=>({chain:t})=>t().insertContent({type:"accordion",attrs:e,content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()}}});var Ct={exports:{}},Ie={},Ke={exports:{}},hr={},xt={exports:{}},Ye={exports:{}},F={};/** @license React v16.13.1
337
+ */const Fy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Hy=ee("X",Fy);function Wy({editor:n}){const[e,t]=I.useState(!1);return w.jsxDEV("div",{className:"relative",children:[w.jsxDEV("button",{type:"button",className:`p-1 text-black transition-all duration-300 rounded-md shadow-lg hover:bg-blue-100 hover:text-blue-600 ${e?"bg-blue-100 text-blue-600":""}`,onClick:r=>{r.preventDefault(),r.stopPropagation(),t(!e)},children:e?w.jsxDEV(Hy,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:20,columnNumber:25},this):w.jsxDEV(dy,{size:24},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:20,columnNumber:43},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:9,columnNumber:13},this),e&&w.jsxDEV("div",{className:"fixed z-40 w-64 p-4 bg-white border border-gray-200 rounded-lg shadow-xl bottom-20 right-4 animate-slide-up",children:w.jsxDEV("div",{className:"space-y-2",children:[w.jsxDEV("h3",{className:"mb-3 font-bold text-center text-gray-700",children:"Cyber Extensions"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:26,columnNumber:25},this),w.jsxDEV("button",{type:"button",onClick:()=>{n.chain().focus().insertContent({type:"accordion",content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()},className:"flex items-center justify-center w-full gap-2 px-3 py-1 text-blue-600 duration-300 rounded-md bg-blue-50 hover:bg-blue-100 hover:text-blue-700",children:[w.jsxDEV(Sy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:54,columnNumber:29},this)," Accordion"]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:30,columnNumber:25},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:25,columnNumber:21},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:24,columnNumber:17},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/cyber-extensions.tsx",lineNumber:8,columnNumber:9},this)}const Fr=({value:n,onChange:e})=>w.jsxDEV(ft.ColorPicker,{value:n,onChange:e,presets:[{label:"Recommended",colors:["#1677ff","#52c41a","#faad14","#ff4d4f","#722ed1","#13c2c2","#ffffff","#000000"]}]},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/color-picker.tsx",lineNumber:12,columnNumber:9},void 0),qy=({editor:n})=>{const[e,t]=I.useState("#1677ff"),[r,i]=I.useState("#ffffff"),o=a=>{const c=a.toHexString();t(c),n.chain().focus().setColor(c).run()},s=a=>{const c=a.toHexString();i(c),n.chain().focus().setHighlight({color:c}).run()},l=a=>{a.preventDefault()};return w.jsxDEV("div",{className:"flex items-center gap-4",children:[w.jsxDEV(ft.Tooltip,{title:"Text Color",children:w.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsxDEV(Ly,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:33,columnNumber:21},void 0),w.jsxDEV(Fr,{value:e,onChange:o},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:34,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:32,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:31,columnNumber:13},void 0),w.jsxDEV(ft.Tooltip,{title:"Highlight Color",children:w.jsxDEV("div",{className:"flex items-center gap-2",onMouseDown:l,children:[w.jsxDEV(vy,{size:20,color:"black"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:41,columnNumber:21},void 0),w.jsxDEV(Fr,{value:r,onChange:s},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:42,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:40,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:39,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/color/color-picker.tsx",lineNumber:29,columnNumber:9},void 0)},Uy=({editor:n})=>{if(!n)return null;const e=()=>{for(let r=1;r<=6;r++)if(n.isActive("heading",{level:r}))switch(r){case 1:return w.jsxDEV(Fi,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:15,columnNumber:36},void 0);case 2:return w.jsxDEV(Fl,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:16,columnNumber:36},void 0);case 3:return w.jsxDEV(Hl,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:17,columnNumber:36},void 0);case 4:return w.jsxDEV(Wl,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:18,columnNumber:36},void 0);case 5:return w.jsxDEV(ql,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:19,columnNumber:36},void 0);case 6:return w.jsxDEV(Ul,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:20,columnNumber:36},void 0)}return w.jsxDEV(Fi,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:24,columnNumber:16},void 0)},t=[...Array.from({length:6},(r,i)=>({key:`${i+1}`,label:w.jsxDEV("div",{className:"flex items-center gap-2",onClick:()=>n.chain().focus().toggleHeading({level:i+1}).run(),children:[I.createElement([Fi,Fl,Hl,Wl,ql,Ul][i],{size:16}),w.jsxDEV("span",{children:["Heading ",i+1]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:33,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:31,columnNumber:17},void 0),className:n.isActive("heading",{level:i+1})?"ant-dropdown-menu-item-active":""}))];return w.jsxDEV(ft.Dropdown,{menu:{items:t},trigger:["hover"],placement:"bottomLeft",children:w.jsxDEV("button",{className:"flex items-center gap-1 p-2 rounded-md hover:bg-blue-100 hover:text-blue-600",children:e()},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:42,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/heading/heading-dropdown.tsx",lineNumber:41,columnNumber:9},void 0)},Ky=8,Jy=8,Yy=({editor:n,buttonClass:e,activeClass:t})=>{const[r,i]=I.useState({rows:0,cols:0}),[o,s]=I.useState(!1),l=(a,c)=>{n.chain().focus().insertTable({rows:a,cols:c,withHeaderRow:!0}).run(),s(!1)};return w.jsxDEV(ft.Dropdown,{open:o,onOpenChange:s,trigger:["hover"],overlay:w.jsxDEV("div",{className:"w-56 p-4 bg-white border border-gray-300 rounded-lg shadow-xl",children:[w.jsxDEV("div",{className:"grid grid-cols-8 gap-1",children:Array.from({length:Ky}).map((a,c)=>Array.from({length:Jy}).map((u,d)=>{const f=c<r.rows&&d<r.cols;return w.jsxDEV("div",{className:`w-5 h-5 border rounded-sm cursor-pointer transition-all duration-200 ${f?"bg-blue-400 border-white scale-110":"bg-gray-200 hover:bg-gray-300"}`,onMouseEnter:()=>i({rows:c+1,cols:d+1}),onClick:()=>l(c+1,d+1)},`${c}-${d}`,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:40,columnNumber:37},void 0)}))},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:35,columnNumber:21},void 0),w.jsxDEV("div",{className:"mt-3 text-sm font-medium text-center text-gray-700",children:r.rows>0&&r.cols>0?`${r.rows} × ${r.cols} Table`:"Insert Table"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:53,columnNumber:21},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:34,columnNumber:17},void 0),children:w.jsxDEV("button",{className:`${e} ${o?t:""} transition-all`,children:w.jsxDEV(_y,{className:"w-5 h-5"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:65,columnNumber:17},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:61,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/table/table-selector.tsx",lineNumber:29,columnNumber:9},void 0)};function Gy({editor:n}){if(!n)return null;const e="p-2 rounded-md transition-all duration-200 hover:bg-blue-100 hover:text-blue-600",t="bg-blue-100 text-blue-600",r=(i,o,s,l,a)=>w.jsxDEV(ft.Tooltip,{title:a,children:w.jsxDEV("button",{type:"button",onClick:o,disabled:l,className:`
338
+ ${e}
339
+ ${s?t:""}
340
+ ${l?"opacity-50 cursor-not-allowed":""}
341
+ `,children:i},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:32,columnNumber:13},this)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:31,columnNumber:9},this);return w.jsxDEV("div",{className:"flex flex-wrap items-center gap-2 p-2 border-b border-gray-200 rounded-t-lg bg-gray-50",children:[w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(Kg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:52,columnNumber:21},this),()=>n.chain().focus().toggleBold().run(),n.isActive("bold"),!1,"Bold"),r(w.jsxDEV(cy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:59,columnNumber:21},this),()=>n.chain().focus().toggleItalic().run(),n.isActive("italic"),!1,"Italic"),r(w.jsxDEV(By,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:66,columnNumber:21},this),()=>n.chain().focus().toggleUnderline().run(),n.isActive("underline"),!1,"Underline"),r(w.jsxDEV(Oy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:73,columnNumber:21},this),()=>n.chain().focus().toggleStrike().run(),n.isActive("strike"),!1,"Strikethrough"),r(w.jsxDEV(Xg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:80,columnNumber:21},this),()=>n.chain().focus().toggleCode().run(),n.isActive("code"),!1,"Code"),r(w.jsxDEV(Ay,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:87,columnNumber:21},this),()=>n.chain().focus().toggleSubscript().run(),n.isActive("subscript"),!1,"Subscript"),r(w.jsxDEV(Py,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:94,columnNumber:21},this),()=>n.chain().focus().toggleSuperscript().run(),n.isActive("superscript"),!1,"Superscript")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:50,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:102,columnNumber:13},this),w.jsxDEV(Uy,{editor:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:105,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:107,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(Hg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:112,columnNumber:21},this),()=>n.chain().focus().setTextAlign("left").run(),n.isActive({textAlign:"left"}),!1,"Align Left"),r(w.jsxDEV(Bg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:119,columnNumber:21},this),()=>n.chain().focus().setTextAlign("center").run(),n.isActive({textAlign:"center"}),!1,"Align Center"),r(w.jsxDEV(qg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:124,columnNumber:21},this),()=>n.chain().focus().setTextAlign("right").run(),n.isActive({textAlign:"right"}),!1,"Align Right"),r(w.jsxDEV(jg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:129,columnNumber:21},this),()=>n.chain().focus().setTextAlign("justify").run(),n.isActive({textAlign:"justify"}),!1,"Align Justify")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:110,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:135,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(my,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:140,columnNumber:21},this),()=>n.chain().focus().toggleBulletList().run(),n.isActive("bulletList"),!1,"Bullet List"),r(w.jsxDEV(hy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:145,columnNumber:21},this),()=>n.chain().focus().toggleOrderedList().run(),n.isActive("orderedList"),!1,"Ordered List"),r(w.jsxDEV(My,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:150,columnNumber:21},this),()=>n.chain().focus().toggleTaskList().run(),n.isActive("taskList"),!1,"Task List")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:138,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:156,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(ky,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:161,columnNumber:21},this),()=>n.chain().focus().toggleBlockquote().run(),n.isActive("blockquote"),!1,"Blockquote"),w.jsxDEV(Yy,{editor:n,buttonClass:e,activeClass:t},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:165,columnNumber:17},this),r(w.jsxDEV(yy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:167,columnNumber:21},this),()=>n.chain().focus().setHorizontalRule().run(),!1,!1,"Horizontal Rule"),r(w.jsxDEV(Qg,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:171,columnNumber:21},this),()=>n.chain().focus().setHardBreak().run(),!1,!1,"Line Break")]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:159,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:176,columnNumber:13},this),w.jsxDEV("div",{className:"flex items-center gap-1",children:[r(w.jsxDEV(jy,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:181,columnNumber:21},this),()=>n.chain().focus().undo().run(),!1,!n.can().chain().focus().undo().run()),r(w.jsxDEV(Ey,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:187,columnNumber:21},this),()=>n.chain().focus().redo().run(),!1,!n.can().chain().focus().redo().run())]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:179,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:194,columnNumber:13},this),r(w.jsxDEV(ly,{size:16},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:197,columnNumber:17},this),()=>{const i=prompt("Enter the image URL");i&&n.chain().focus().insertContent({type:"image",attrs:{src:i,width:300,height:300,marginLeft:0,marginRight:0}}).run()},!1,!1,"Insert Image"),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:218,columnNumber:13},this),w.jsxDEV(qy,{editor:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:221,columnNumber:13},this),w.jsxDEV("div",{className:"h-5 w-[1px] bg-gray-300 mx-2"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:223,columnNumber:13},this),w.jsxDEV(Wy,{editor:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:224,columnNumber:13},this)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/tool-bar/tool-bar-tiptap.tsx",lineNumber:48,columnNumber:9},this)}const Su=ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ie(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Xy=n=>{if(!n.children.length)return;const e=n.querySelectorAll("span");e&&e.forEach(t=>{var r,i;const o=t.getAttribute("style"),s=(i=(r=t.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");t.setAttribute("style",`${s};${o}`)})},Kl=Qe.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Xy(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),Zy=De.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Qy=/^\s*>\s$/,eb=ce.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[On({find:Qy,type:this.type})]}}),tb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,rb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ib=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ob=Qe.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ln({find:tb,type:this.type}),ln({find:rb,type:this.type})]},addPasteRules(){return[an({find:nb,type:this.type}),an({find:ib,type:this.type})]}}),sb="listItem",Jl="textStyle",Yl=/^\s*([-+*])\s$/,lb=ce.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sb,this.editor.getAttributes(Jl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=On({find:Yl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=On({find:Yl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jl),editor:this.editor})),[n]}}),ab=/(^|[^`])`([^`]+)`(?!`)/,cb=/(^|[^`])`([^`]+)`(?!`)/g,ub=Qe.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ln({find:ab,type:this.type})]},addPasteRules(){return[an({find:cb,type:this.type})]}}),db=/^```([a-z]+)?[\s\n]$/,fb=/^~~~([a-z]+)?[\s\n]$/,hb=ce.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,o=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",ie(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
342
+
343
+ `);return!o||!s?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:o}=t;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(V.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[wo({find:db,type:this.type,getAttributes:n=>({language:n[1]})}),wo({find:fb,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Le({key:new et("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i==null?void 0:i.mode;if(!t||!o)return!1;const{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
344
+ `));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(L.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),pb=ce.create({name:"doc",topNode:!0,content:"block+"});function mb(n={}){return new Le({view(e){return new gb(e,n)}})}class gb{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=l?u.bottom:u.top;l&&a&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let l=i.getBoundingClientRect();o=l.left-i.scrollLeft,s=l.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!o){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=tc(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const yb=De.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[mb(this.options)]}});class de extends V{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return de.valid(r)?new de(r):V.near(r)}content(){return T.empty}eq(e){return e instanceof de&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new de(e.resolve(t.pos))}getBookmark(){return new as(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!bb(e)||!vb(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&de.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=t;let a=e.doc.resolve(i);if(de.valid(a))return a}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!z.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),r=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(de.valid(l))return l}return null}}}de.prototype.visible=!1;de.findFrom=de.findGapCursorFrom;V.jsonID("gapcursor",de);class as{constructor(e){this.pos=e}map(e){return new as(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return de.valid(t)?new de(t):V.near(t)}}function bb(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function vb(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function xb(){return new Le({props:{decorations:Cb,createSelectionBetween(n,e,t){return e.pos==t.pos&&de.valid(t)?new de(t):null},handleClick:wb,handleKeyDown:Sb,handleDOMEvents:{beforeinput:kb}}})}const Sb=Yo({ArrowLeft:hr("horiz",-1),ArrowRight:hr("horiz",1),ArrowUp:hr("vert",-1),ArrowDown:hr("vert",1)});function hr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof L){if(!o.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=de.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new de(c))),!0):!1}}function wb(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!de.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&z.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new de(r))),!0)}function kb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof de))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=C.empty;for(let s=r.length-1;s>=0;s--)i=C.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(t.pos,t.pos,new T(i,0,0));return o.setSelection(L.near(o.doc.resolve(t.pos+1))),n.dispatch(o),!1}function Cb(n){if(!(n.selection instanceof de))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ue.create(n.doc,[$e.widget(n.selection.head,e,{key:"gapcursor"})])}const Eb=De.create({name:"gapCursor",addProseMirrorPlugins(){return[xb()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=q(P(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Nb=ce.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ie(this.options.HTMLAttributes,n)]},renderText(){return`
345
+ `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:o}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Mb=ce.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,ie(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>wo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Hr=200,ke=function(){};ke.prototype.append=function(e){return e.length?(e=ke.from(e),!this.length&&e||e.length<Hr&&this.leafAppend(e)||this.length<Hr&&e.leafPrepend(this)||this.appendInner(e)):this};ke.prototype.prepend=function(e){return e.length?ke.from(e).append(this):this};ke.prototype.appendInner=function(e){return new Tb(this,e)};ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ke.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ke.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},t,r),i};ke.from=function(e){return e instanceof ke?e:e&&e.length?new wu(e):ke.empty};var wu=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Hr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Hr)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(ke);ke.empty=new wu([]);var Tb=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(ke);const Ob=500;class lt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),o=i.maps.length),o--,u.push(d);return}if(i){u.push(new dt(d.map));let h=d.step.map(i.slice(o)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new dt(p,void 0,void 0,c.length+u.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(o)):d.selection,a=new lt(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new dt(e.mapping.maps[u],d,t),h;(h=a&&a.merge(f))&&(f=h,u?o.pop():l=l.slice(0,l.length-1)),o.push(f),t&&(s++,t=void 0),i||(a=f)}let c=s-r.depth;return c>Ab&&(l=Db(l,c),s-=c),new lt(l.append(o),s)}remapping(e,t){let r=new wn;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,t),r}addMaps(e){return this.eventCount==0?this:new lt(this.items.append(e.map(t=>new dt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=o.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=o.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),g=f.selection&&f.selection.map(o.slice(a+1,h));g&&l++,r.push(new dt(p,m,g))}else r.push(new dt(p))},i);let c=[];for(let f=t;f<s;f++)c.push(new dt(o.maps[f]));let u=this.items.slice(0,i).append(c).append(r),d=new lt(u,l);return d.emptyItemCount()>Ob&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=s.selection&&s.selection.map(t.slice(r));u&&o++;let d=new dt(c.invert(),a,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else s.map&&r--},this.items.length,0),new lt(ke.from(i.reverse()),o)}}lt.empty=new lt(ke.empty,0);function Db(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class dt{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new dt(t.getMap().invert(),t,this.selection)}}}class Dt{constructor(e,t,r,i,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const Ab=20;function Rb(n,e,t,r){let i=t.getMeta(nn),o;if(i)return i.historyState;t.getMeta(_b)&&(n=new Dt(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(nn))return s.getMeta(nn).redo?new Dt(n.done.addTransform(t,void 0,r,kr(e)),n.undone,Gl(t.mapping.maps),n.prevTime,n.prevComposition):new Dt(n.done,n.undone.addTransform(t,void 0,r,kr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Pb(t,n.prevRanges)),c=s?Hi(n.prevRanges,t.mapping):Gl(t.mapping.maps);return new Dt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,kr(e)),lt.empty,c,t.time,l??n.prevComposition)}else return(o=t.getMeta("rebased"))?new Dt(n.done.rebased(t,o),n.undone.rebased(t,o),Hi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Dt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Hi(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Pb(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function Gl(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,o,s)=>e.push(o,s));return e}function Hi(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function Ib(n,e,t){let r=kr(e),i=nn.get(e).spec.config,o=(t?n.undone:n.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(t?n.done:n.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new Dt(t?l:o.remaining,t?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(nn,{redo:t,historyState:a})}let Wi=!1,Xl=null;function kr(n){let e=n.plugins;if(Xl!=e){Wi=!1,Xl=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Wi=!0;break}}return Wi}const nn=new et("history"),_b=new et("closeHistory");function zb(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Le({key:nn,state:{init(){return new Dt(lt.empty,lt.empty,null,0,-1)},apply(e,t,r){return Rb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Cu:r=="historyRedo"?Eu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function ku(n,e){return(t,r)=>{let i=nn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Ib(i,t,n);o&&r(e?o.scrollIntoView():o)}return!0}}const Cu=ku(!1,!0),Eu=ku(!0,!0),Lb=De.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Cu(n,e),redo:()=>({state:n,dispatch:e})=>Eu(n,e)}},addProseMirrorPlugins(){return[zb(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Vb=ce.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ie(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{const{selection:t}=e,{$from:r,$to:i}=t,o=n();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):Rm(t)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var a;if(l){const{$to:c}=s.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(L.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(z.create(s.doc,c.pos)):s.setSelection(L.create(s.doc,c.pos));else{const d=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();d&&(s.insert(u,d),s.setSelection(L.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[mu({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Bb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,$b=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,jb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Fb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Hb=Qe.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ln({find:Bb,type:this.type}),ln({find:jb,type:this.type})]},addPasteRules(){return[an({find:$b,type:this.type}),an({find:Fb,type:this.type})]}}),Wb="listItem",Zl="textStyle",Ql=/^(\d+)\.\s$/,qb=ce.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ie(this.options.HTMLAttributes,t),0]:["ol",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Wb,this.editor.getAttributes(Zl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=On({find:Ql,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=On({find:Ql,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Zl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Ub=ce.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Kb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Jb=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Yb=Qe.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ln({find:Kb,type:this.type})]},addPasteRules(){return[an({find:Jb,type:this.type})]}}),Gb=ce.create({name:"text",group:"inline"}),Xb=De.create({name:"starterKit",addExtensions(){var n,e,t,r,i,o,s,l,a,c,u,d,f,h,p,m,g,b;const x=[];return this.options.bold!==!1&&x.push(ob.configure((n=this.options)===null||n===void 0?void 0:n.bold)),this.options.blockquote!==!1&&x.push(eb.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&x.push(lb.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&x.push(ub.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&x.push(hb.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&x.push(pb.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&x.push(yb.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&x.push(Eb.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&x.push(Nb.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&x.push(Mb.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&x.push(Lb.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&x.push(Vb.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&x.push(Hb.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&x.push(Su.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&x.push(qb.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&x.push(Ub.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&x.push(Yb.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&x.push(Gb.configure((b=this.options)===null||b===void 0?void 0:b.text)),x}}),Zb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Qb=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,e0=Qe.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ln({find:Zb,type:this.type})]},addPasteRules(){return[an({find:Qb,type:this.type})]}}),t0=Qe.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),n0=Qe.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),r0=Qe.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",ie(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),i0=De.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),o0=ce.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ie(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),s0=/^\s*(\[([( |x])?\])\s$/,l0=ce.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ie(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");return o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",c=>c.preventDefault()),l.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const f=t();if(typeof f!="number")return!1;const h=d.doc.nodeAt(f);return d.setNodeMarkup(f,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{i.setAttribute(c,u)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(e).forEach(([c,u])=>{i.setAttribute(c,u)}),{dom:i,contentDOM:a,update:c=>c.type!==this.type?!1:(i.dataset.checked=c.attrs.checked,l.checked=c.attrs.checked,!0)}}},addInputRules(){return[On({find:s0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}});var No,Mo;if(typeof WeakMap<"u"){let n=new WeakMap;No=e=>n.get(e),Mo=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;No=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Mo=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var fe=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==t;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:o,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[o*this.width+(t<0?r-1:i)]:(t<0?o==0:s==this.height)?null:this.map[r+this.width*(t<0?o-1:s)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:o}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const o=r*this.width+i,s=this.map[o];t[s]||(t[s]=!0,!(i==n.left&&i&&this.map[o-1]==s||r==n.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const o=i+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(n){return No(n)||Mo(n,a0(n))}};function a0(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=c0(n),t=n.childCount,r=[];let i=0,o=null;const s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){const d=n.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:b,colwidth:x}=m.attrs;for(let S=0;S<b;S++){if(S+c>=t){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:b-S});break}const k=i+S*e;for(let v=0;v<g;v++){r[k+v]==0?r[k+v]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:g-v});const N=x&&x[v];if(N){const O=(k+v)%e*2,B=s[O];B==null||B!=N&&s[O+1]==1?(s[O]=N,s[O+1]=1):B==N&&s[O+1]++}}}i+=g,u+=m.nodeSize}const f=(c+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(o||(o=[])).push({type:"missing",row:c,n:h}),u++}const l=new fe(e,t,r,o);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&u0(l,s,n),l}function c0(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let o=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){const l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function u0(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const o=n.map[i];if(r[o])continue;r[o]=!0;const s=t.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const u=(i+c)%n.width,d=e[u*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=d0(a)))[c]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function d0(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function _e(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var Rt=new et("selectingCells");function An(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function f0(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function ct(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function li(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=An(e.$head)||h0(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function h0(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function To(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function p0(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function cs(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Nu(n,e,t){const r=n.node(-1),i=fe.get(r),o=n.start(-1),s=i.nextCell(n.pos-o,e,t);return s==null?null:n.node(0).resolve(o+s)}function cn(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function Mu(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function m0(n,e,t){const r=_e(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var ae=class St extends V{constructor(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,t.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(u=>u!=t.pos-o);a.unshift(t.pos-o);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=o+u+1;return new lc(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(To(r)&&To(i)&&cs(r,i)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?St.rowSelection(r,i):o&&this.isColSelection()?St.colSelection(r,i):new St(r,i)}return L.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=fe.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*t.width+i.left,d=i.left;d<i.right;d++,u++){const f=t.map[u];if(o[f])continue;o[f]=!0;const h=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=i.left-h.left,g=h.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=cn(b,0,m)),g>0&&(b=cn(b,b.colspan-g,g)),h.left<i.left){if(p=p.type.createAndFill(b),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(h.top<i.top||h.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}s.push(e.child(a).copy(C.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new T(C.from(l),1,1)}replace(e,t=T.empty){const r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){const{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?T.empty:t)}const o=V.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new T(C.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=fe.get(t),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(t.nodeAt(o[s]),i+o[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(t=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new St(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=fe.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),o=t.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;const s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof St&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=fe.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(t.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(t=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new St(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new St(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new St(e.resolve(t),e.resolve(r))}getBookmark(){return new g0(this.$anchorCell.pos,this.$headCell.pos)}};ae.prototype.visible=!1;V.jsonID("cell",ae);var g0=class Tu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Tu(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&cs(t,r)?new ae(t,r):V.near(r,1)}};function y0(n){if(!(n.selection instanceof ae))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push($e.node(r,r+t.nodeSize,{class:"selectedCell"}))}),ue.create(n.doc,e)}function b0({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function v0({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const o=n.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){t=o;break}}for(let i=e.depth;i>0;i--){const o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return t!==r&&e.parentOffset===0}function x0(n,e,t){const r=(e||n).selection,i=(e||n).doc;let o,s;if(r instanceof z&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=ae.create(i,r.from);else if(s=="row"){const l=i.resolve(r.from+1);o=ae.rowSelection(l,l)}else if(!t){const l=fe.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=ae.create(i,a+1,c)}}else r instanceof L&&b0(r)?o=L.create(i,r.from):r instanceof L&&v0(r)&&(o=L.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=n.tr)).setSelection(o),e}var S0=new et("fix-tables");function Ou(n,e,t,r){const i=n.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){const a=e.child(s);for(let c=l,u=Math.min(i,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?Ou(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Du(n,e){let t;const r=(i,o)=>{i.type.spec.tableRole=="table"&&(t=w0(n,i,o,t))};return e?e.doc!=n.doc&&Ou(e.doc,n.doc,0,r):n.doc.descendants(r),t}function w0(n,e,t,r){const i=fe.get(e);if(!i.problems)return r;r||(r=n.tr);const o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)o[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,cn(d,d.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const u=e.child(a),d=c+u.nodeSize,f=o[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<f;g++){const b=_e(n.schema)[h].createAndFill();b&&p.push(b)}const m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(S0,{fixTables:!0})}function gt(n){const e=n.selection,t=li(n),r=t.node(-1),i=t.start(-1),o=fe.get(r);return{...e instanceof ae?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(t.pos-i),tableStart:i,map:o,table:r}}function Au(n,{map:e,tableStart:t,table:r},i){let o=i>0?-1:0;m0(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,Mu(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=o==null?_e(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function k0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Au(n.tr,t,t.left))}return!0}function C0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Au(n.tr,t,t.right))}return!0}function E0(n,{map:e,table:t,tableStart:r},i){const o=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+i,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(o).map(r+a),null,cn(u,i-e.colCount(a)));else{const d=n.mapping.slice(o).map(r+a);n.delete(d,d+c.nodeSize)}s+=u.rowspan}}function N0(n,e){if(!ct(n))return!1;if(e){const t=gt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;E0(r,t,i),i!=t.left;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=fe.get(o)}e(r)}return!0}function M0(n,e,t){var r;const i=_e(e.type.schema).header_cell;for(let o=0;o<n.width;o++)if(((r=e.nodeAt(n.map[o+t*n.width]))==null?void 0:r.type)!=i)return!1;return!0}function Ru(n,{map:e,tableStart:t,table:r},i){var o;let s=t;for(let c=0;c<i;c++)s+=r.child(c).nodeSize;const l=[];let a=i>0?-1:0;M0(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c<e.width;c++,u++)if(i>0&&i<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=a==null?_e(r.type.schema).cell:(o=r.nodeAt(e.map[u+a*e.width]))==null?void 0:o.type,f=d==null?void 0:d.createAndFill();f&&l.push(f)}return n.insert(s,_e(r.type.schema).row.create(null,l)),n}function T0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Ru(n.tr,t,t.top))}return!0}function O0(n,e){if(!ct(n))return!1;if(e){const t=gt(n);e(Ru(n.tr,t,t.bottom))}return!0}function D0(n,{map:e,table:t,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=t.child(c).nodeSize;const s=o+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(o+r,s+r);const a=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),i>0&&d==e.map[u-e.width]){const f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i<e.height&&d==e.map[u+e.width]){const f=t.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function A0(n,e){if(!ct(n))return!1;if(e){const t=gt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;D0(r,t,i),i!=t.top;i--){const o=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!o)throw RangeError("No table found");t.table=o,t.map=fe.get(t.table)}e(r)}return!0}function ea(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function R0({width:n,height:e,map:t},r){let i=r.top*n+r.left,o=i,s=(r.bottom-1)*n+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[o]==t[o-1]||r.right<n&&t[l]==t[l+1])return!0;o+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[i]==t[i-n]||r.bottom<e&&t[s]==t[s+n])return!0;i++,s++}return!1}function ta(n,e){const t=n.selection;if(!(t instanceof ae)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=gt(n),{map:i}=r;if(R0(i,r))return!1;if(e){const o=n.tr,s={};let l=C.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=i.map[u*i.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{ea(h)||(l=l.append(h.content));const p=o.mapping.map(f+r.tableStart);o.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...Mu(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const u=a+1+c.content.size,d=ea(c)?a+1:u;o.replaceWith(d+r.tableStart,u+r.tableStart,l)}o.setSelection(new ae(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function na(n,e){const t=_e(n.schema);return P0(({node:r})=>t[r.type.spec.tableRole])(n,e)}function P0(n){return(e,t)=>{var r;const i=e.selection;let o,s;if(i instanceof ae){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;o=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(o=f0(i.$from),!o)return!1;s=(r=An(i.$from))==null?void 0:r.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(t){let l=o.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=gt(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let m=u.left,g=0;m<u.right;m++,g++)m==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),n({node:o,row:h,col:m}).createAndFill(a[g]))}d.setNodeMarkup(s,n({node:o,row:u.top,col:u.left}),a[0]),i instanceof ae&&d.setSelection(new ae(d.doc.resolve(i.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function I0(n,e){return function(t,r){if(!ct(t))return!1;const i=li(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const o=t.tr;t.selection instanceof ae?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(o)}return!0}}function _0(n){return function(e,t){if(!ct(e))return!1;if(t){const r=_e(e.schema),i=gt(e),o=e.tr,s=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length==0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);t(o)}return!0}}function ra(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const o=e.table.nodeAt(r[i]);if(o&&o.type!==t.header_cell)return!1}return!0}function Xn(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?_0(n):function(t,r){if(!ct(t))return!1;if(r){const i=_e(t.schema),o=gt(t),s=t.tr,l=ra("row",o,i),a=ra("column",o,i),u=(n==="column"?l:n==="row"?a:!1)?1:0,d=n=="column"?{bottom:o.map.height}:n=="row"?{left:u,top:0,right:o.map.width,bottom:1}:o,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(d).forEach(h=>{const p=h+o.tableStart,m=s.doc.nodeAt(p);m&&s.setNodeMarkup(p,f,m.attrs)}),r(s)}return!0}}Xn("row",{useDeprecatedLogic:!0});Xn("column",{useDeprecatedLogic:!0});var z0=Xn("cell",{useDeprecatedLogic:!0});function L0(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const o=n.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const o=t.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function ia(n){return function(e,t){if(!ct(e))return!1;const r=L0(li(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(L.between(i,p0(i))).scrollIntoView())}return!0}}function V0(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function pr(n,e){const t=n.selection;if(!(t instanceof ae))return!1;if(e){const r=n.tr,i=_e(n.schema).cell.createAndFill().content;t.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new T(i,0,0))}),r.docChanged&&e(r)}return!0}function B0(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Oo(_e(s).row,new T(c,u,d)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(t||r?Oo(_e(s).row,new T(e,t,r)).content:e);else return null;return $0(s,l)}function $0(n,e){const t=[];for(let i=0;i<e.length;i++){const o=e[i];for(let s=o.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(C.empty),t[i]<r){const o=_e(n).cell.createAndFill(),s=[];for(let l=t[i];l<r;l++)s.push(o);e[i]=e[i].append(C.from(s))}return{height:e.length,width:r,rows:e}}function Oo(n,e){const t=n.createAndFill();return new sc(t).replace(0,t.content.size,e).doc}function j0({width:n,height:e,rows:t},r,i){if(n!=r){const o=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=o[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(cn(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)o[l+h]=(o[l+h]||0)+f.attrs.colspan}s.push(C.from(c))}t=s,n=r}if(e!=i){const o=[];for(let s=0,l=0;s<i;s++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),a.push(d)}o.push(C.from(a))}t=o,e=i}return{width:n,height:e,rows:t}}function F0(n,e,t,r,i,o,s){const l=n.doc.type.schema,a=_e(l);let c,u;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=t.child(d);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);n.insert(n.mapping.slice(s).map(f-1+r),p)}if(o>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;d.push(g?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,C.from(d)),h=[];for(let p=e.height;p<o;p++)h.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(c||u)}function oa(n,e,t,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=t.nodeAt(d),{top:h,left:p}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,p,t)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function sa(n,e,t,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=t.nodeAt(d),h=e.colCount(d),p=n.mapping.slice(l).map(d+r);n.setNodeMarkup(p,null,cn(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(p+f.nodeSize,f.type.createAndFill(cn(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function la(n,e,t,r,i){let o=t?n.doc.nodeAt(t-1):n.doc;if(!o)throw new Error("No table found");let s=fe.get(o);const{top:l,left:a}=r,c=a+i.width,u=l+i.height,d=n.tr;let f=0;function h(){if(o=t?d.doc.nodeAt(t-1):d.doc,!o)throw new Error("No table found");s=fe.get(o),f=d.mapping.maps.length}F0(d,s,o,t,c,u,f)&&h(),oa(d,s,o,t,a,c,l,f)&&h(),oa(d,s,o,t,a,c,u,f)&&h(),sa(d,s,o,t,l,u,a,f)&&h(),sa(d,s,o,t,l,u,c,f)&&h();for(let p=l;p<u;p++){const m=s.positionAt(p,a,o),g=s.positionAt(p,c,o);d.replace(d.mapping.slice(f).map(m+t),d.mapping.slice(f).map(g+t),new T(i.rows[p-l],0,0))}h(),d.setSelection(new ae(d.doc.resolve(t+s.positionAt(l,a,o)),d.doc.resolve(t+s.positionAt(u-1,c-1,o)))),e(d)}var H0=Yo({ArrowLeft:mr("horiz",-1),ArrowRight:mr("horiz",1),ArrowUp:mr("vert",-1),ArrowDown:mr("vert",1),"Shift-ArrowLeft":gr("horiz",-1),"Shift-ArrowRight":gr("horiz",1),"Shift-ArrowUp":gr("vert",-1),"Shift-ArrowDown":gr("vert",1),Backspace:pr,"Mod-Backspace":pr,Delete:pr,"Mod-Delete":pr});function Cr(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function mr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;if(o instanceof ae)return Cr(t,r,V.near(o.$headCell,e));if(n!="horiz"&&!o.empty)return!1;const s=Pu(i,n,e);if(s==null)return!1;if(n=="horiz")return Cr(t,r,V.near(t.doc.resolve(o.head+e),e));{const l=t.doc.resolve(s),a=Nu(l,n,e);let c;return a?c=V.near(a,1):e<0?c=V.near(t.doc.resolve(l.before(-1)),-1):c=V.near(t.doc.resolve(l.after(-1)),1),Cr(t,r,c)}}}function gr(n,e){return(t,r,i)=>{if(!i)return!1;const o=t.selection;let s;if(o instanceof ae)s=o;else{const a=Pu(i,n,e);if(a==null)return!1;s=new ae(t.doc.resolve(a))}const l=Nu(s.$headCell,n,e);return l?Cr(t,r,new ae(s.$anchorCell,l)):!1}}function W0(n,e){const t=n.state.doc,r=An(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ae(r))),!0):!1}function q0(n,e,t){if(!ct(n.state))return!1;let r=B0(t);const i=n.state.selection;if(i instanceof ae){r||(r={width:1,height:1,rows:[C.from(Oo(_e(n.state.schema).cell,t))]});const o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=fe.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=j0(r,l.right-l.left,l.bottom-l.top),la(n.state,n.dispatch,s,l,r),!0}else if(r){const o=li(n.state),s=o.start(-1);return la(n.state,n.dispatch,s,fe.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function U0(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=aa(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof ae)o(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=An(n.state.selection.$anchor))!=null&&((t=qi(n,e))==null?void 0:t.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let u=qi(n,c);const d=Rt.getState(n.state)==null;if(!u||!cs(a,u))if(d)u=a;else return;const f=new ae(a,u);if(d||!n.state.selection.eq(f)){const h=n.state.tr.setSelection(f);d&&h.setMeta(Rt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Rt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Rt,-1))}function l(a){const c=a,u=Rt.getState(n.state);let d;if(u!=null)d=n.state.doc.resolve(u);else if(aa(n,c.target)!=r&&(d=qi(n,e),!d))return s();d&&o(d,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Pu(n,e,t){if(!(n.state.selection instanceof L))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const o=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function aa(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function qi(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?An(n.state.doc.resolve(t.pos)):null}var K0=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Do(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Do(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Do(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let m=0;m<h;m++,f++){const g=i==f?o:p&&p[m],b=g?g+"px":"";if(l+=g||r,g||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=b,e.appendChild(x)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=d}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Ge=new et("tableColumnResizing");function J0({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=K0,lastColumnResizable:i=!0}={}){const o=new Le({key:Ge,state:{init(s,l){var a,c;const u=(c=(a=o.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=_e(l.schema).table.name;return r&&u&&(u[d]=(f,h)=>new r(f,t,h)),new Y0(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Ge.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{G0(s,l,n,i)},mouseleave:s=>{X0(s)},mousedown:(s,l)=>{Z0(s,l,e,t)}},decorations:s=>{const l=Ge.getState(s);if(l&&l.activeHandle>-1)return r1(s,l.activeHandle)},nodeViews:{}}});return o}var Y0=class Er{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ge);if(r&&r.setHandle!=null)return new Er(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Er(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return To(e.doc.resolve(i))||(i=-1),new Er(i,t.dragging)}return t}};function G0(n,e,t,r){const i=Ge.getState(n.state);if(i&&!i.dragging){const o=e1(e.target);let s=-1;if(o){const{left:l,right:a}=o.getBoundingClientRect();e.clientX-l<=t?s=ca(n,e,"left",t):a-e.clientX<=t&&(s=ca(n,e,"right",t))}if(s!=i.activeHandle){if(!r&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=fe.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Iu(n,s)}}}function X0(n){const e=Ge.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Iu(n,-1)}function Z0(n,e,t,r){var i;const o=(i=n.dom.ownerDocument.defaultView)!=null?i:window,s=Ge.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=Q0(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Ge,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const f=Ge.getState(n.state);f!=null&&f.dragging&&(t1(n,f.activeHandle,ua(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(Ge,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Ge.getState(n.state);if(f&&f.dragging){const h=ua(f.dragging,d,t);da(n,f.activeHandle,h,r)}}return da(n,s.activeHandle,a,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function Q0(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const o=n.domAtPos(e);let l=o.node.childNodes[o.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function e1(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function ca(n,e,t,r){const i=t=="right"?-r:r,o=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;const{pos:s}=o,l=An(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=fe.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function ua(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Iu(n,e){n.dispatch(n.state.tr.setMeta(Ge,{setHandle:e}))}function t1(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),o=fe.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<o.height;c++){const u=c*o.width+l;if(c&&o.map[u]==o.map[u-o.width])continue;const d=o.map[u],f=i.nodeAt(d).attrs,h=f.colspan==1?0:l-o.colCount(d);if(f.colwidth&&f.colwidth[h]==t)continue;const p=f.colwidth?f.colwidth.slice():n1(f.colspan);p[h]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function da(n,e,t,r){const i=n.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=fe.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Do(o,a.firstChild,a,r,l,t)}function n1(n){return Array(n).fill(0)}function r1(n,e){var t;const r=[],i=n.doc.resolve(e),o=i.node(-1);if(!o)return ue.empty;const s=fe.get(o),l=i.start(-1),a=s.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){const d=s.map[u],f=l+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=Ge.getState(n))!=null&&t.dragging&&r.push($e.node(l+d,l+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push($e.widget(f,h))}}return ue.create(n.doc,r)}function i1({allowTableNodeSelection:n=!1}={}){return new Le({key:Rt,state:{init(){return null},apply(e,t){const r=e.getMeta(Rt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:o}=e.mapping.mapResult(t);return i?null:o}},props:{decorations:y0,handleDOMEvents:{mousedown:U0},createSelectionBetween(e){return Rt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:W0,handleKeyDown:H0,handlePaste:q0},appendTransaction(e,t,r){return x0(r,Du(r,t),n)}})}function Ao(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function fa(n,e,t,r,i,o){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=i===f?o:p&&p[m],b=g?`${g}px`:"";if(l+=g||r,g||(a=!1),c){if(c.style.width!==b){const[x,S]=Ao(r,g);c.style.setProperty(x,S)}c=c.nextSibling}else{const x=document.createElement("col"),[S,k]=Ao(r,g);x.style.setProperty(S,k),e.appendChild(x)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)===null||s===void 0||s.removeChild(c),c=d}a?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}class o1{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),fa(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,fa(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function s1(n,e,t,r){let i=0,o=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:p}=l.child(d).attrs;for(let m=0;m<h;m+=1,f+=1){const g=t===f?r:p&&p[m];i+=g||e,g||(o=!1);const[b,x]=Ao(e,g);s.push(["col",{style:`${b}: ${x}`}])}}const a=o?`${i}px`:"",c=o?"":`${i}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function ha(n,e){return n.createAndFill()}function l1(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function a1(n,e,t,r,i){const o=l1(n),s=[],l=[];for(let c=0;c<t;c+=1){const u=ha(o.cell);if(u&&l.push(u),r){const d=ha(o.header_cell);d&&s.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(o.row.createChecked(null,r&&c===0?s:l));return o.table.createChecked(null,a)}function c1(n){return n instanceof ae}const yr=({editor:n})=>{const{selection:e}=n.state;if(!c1(e))return!1;let t=0;const r=hu(e.ranges[0].$from,o=>o.type.name==="table");return r==null||r.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},u1=ce.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:o1,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:i}=s1(n,this.options.cellMinWidth);return["table",ie(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:i,editor:o})=>{const s=a1(o.schema,n,e,t);if(i){const l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(L.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>k0(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>C0(n,e),deleteColumn:()=>({state:n,dispatch:e})=>N0(n,e),addRowBefore:()=>({state:n,dispatch:e})=>T0(n,e),addRowAfter:()=>({state:n,dispatch:e})=>O0(n,e),deleteRow:()=>({state:n,dispatch:e})=>A0(n,e),deleteTable:()=>({state:n,dispatch:e})=>V0(n,e),mergeCells:()=>({state:n,dispatch:e})=>ta(n,e),splitCell:()=>({state:n,dispatch:e})=>na(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Xn("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Xn("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>z0(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>ta(n,e)?!0:na(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>I0(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>ia(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>ia(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Du(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ae.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:yr,"Mod-Backspace":yr,Delete:yr,"Mod-Delete":yr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[J0({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],i1({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:q(P(n,"tableRole",e))}}}),d1=ce.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",ie(this.options.HTMLAttributes,n),0]}}),f1=ce.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",ie(this.options.HTMLAttributes,n),0]}}),h1=ce.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",ie(this.options.HTMLAttributes,n),0]}}),_u=({title:n,childrenContent:e,editable:t,childrenEdit:r})=>{const[i,o]=I.useState(!1),s=t?w.jsxDEV(ft.Menu,{children:w.jsxDEV(ft.Menu.Item,{onClick:()=>o(!0),children:"Edit"},"edit",!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:19,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:18,columnNumber:9},void 0):null;return w.jsxDEV("div",{children:[t&&s?w.jsxDEV(ft.Dropdown,{overlay:s,trigger:["contextMenu"],children:e},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:28,columnNumber:17},void 0):e,w.jsxDEV(ft.Modal,{title:`Edit ${n}`,open:i,onOk:()=>o(!1),onCancel:()=>o(!1),children:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:35,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/components/modal-edit.tsx",lineNumber:26,columnNumber:9},void 0)},p1=({node:n,editor:e})=>{const[t,r]=I.useState(!1),[i,o]=I.useState(n.attrs.bgColor||"#f3f4f6"),[s,l]=I.useState(n.attrs.titleColor||"#000000"),a=d=>{d.preventDefault()},c=d=>{o(d.toHexString())},u=d=>{l(d.toHexString())};return w.jsxDEV(bu,{className:"accordion-wrapper",children:w.jsxDEV(_u,{title:"Accordion",childrenContent:w.jsxDEV("div",{className:"my-4 transition-all duration-300 border rounded-lg shadow-sm",onContextMenu:a,children:[w.jsxDEV("div",{className:"flex items-center justify-between p-4 transition-colors accordion-header",style:{backgroundColor:i},onClick:()=>r(!t),children:[w.jsxDEV("input",{className:"w-full text-lg font-medium bg-transparent border-none outline-none",style:{color:s},defaultValue:n.attrs.title||"Accordion Title",disabled:!e.isEditable,suppressContentEditableWarning:!0,contentEditable:!0,placeholder:"Accordion title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:38,columnNumber:29},void 0),w.jsxDEV(Yg,{className:`transition-transform duration-300 ${t?"rotate-180":""}`,size:20},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:47,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:33,columnNumber:25},void 0),w.jsxDEV("div",{className:`overflow-hidden duration-300 ease-in-out ${t?"max-h-96 opacity-100":"max-h-0 opacity-0"} `,children:w.jsxDEV("div",{className:"p-4 border-t",children:w.jsxDEV(Dg,{contentEditable:e.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:57,columnNumber:33},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:56,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:53,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:29,columnNumber:21},void 0),editable:e.isEditable,childrenEdit:w.jsxDEV("div",{className:"px-6 py-4 space-y-6 rounded-lg bg-gray-50",children:[w.jsxDEV("div",{className:"grid grid-cols-1 gap-6",children:[w.jsxDEV("div",{className:"flex flex-col space-y-2",children:[w.jsxDEV("label",{className:"font-medium text-gray-700",children:"Background Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:69,columnNumber:33},void 0),w.jsxDEV("div",{className:"flex items-center space-x-3",children:[w.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:i}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:71,columnNumber:37},void 0),w.jsxDEV(Fr,{value:i,onChange:c},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:75,columnNumber:37},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:70,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:68,columnNumber:29},void 0),w.jsxDEV("div",{className:"flex flex-col space-y-2",children:[w.jsxDEV("label",{className:"font-medium text-gray-700",children:"Title Color"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:80,columnNumber:33},void 0),w.jsxDEV("div",{className:"flex items-center space-x-3",children:[w.jsxDEV("div",{className:"w-8 h-8 border rounded shadow",style:{backgroundColor:s}},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:82,columnNumber:37},void 0),w.jsxDEV(Fr,{value:s,onChange:u},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:86,columnNumber:37},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:81,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:79,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:67,columnNumber:25},void 0),w.jsxDEV("div",{className:"pt-4 border-t border-gray-200",children:w.jsxDEV("div",{className:"p-3 bg-white border rounded-md",children:[w.jsxDEV("div",{className:"text-sm text-gray-600",children:"Preview"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:93,columnNumber:33},void 0),w.jsxDEV("div",{className:"p-2 mt-2 rounded",style:{backgroundColor:i},children:w.jsxDEV("span",{style:{color:s,fontWeight:500},children:"Accordion Title"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:95,columnNumber:37},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:94,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:92,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:91,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:66,columnNumber:21},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:26,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/accordion/accordion-view.tsx",lineNumber:25,columnNumber:9},void 0)},m1=ce.create({name:"accordion",group:"block",content:"block+",atom:!1,draggable:!0,selectable:!0,inline:!1,defining:!0,addAttributes(){return{title:{default:"Accordion Title"},bgColor:{default:"#f3f4f6"},titleColor:{default:"#000000"}}},parseHTML(){return[{tag:"accordion"}]},renderHTML({HTMLAttributes:n}){return["accordion",ie(n)]},addNodeView(){return vu(p1)},addCommands(){return{setAccordion:n=>({chain:e})=>e().insertContent({type:"accordion",attrs:n,content:[{type:"paragraph",content:[{type:"text",text:"Accordion content"}]}]}).run()}}}),g1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,y1=ce.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",ie(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[mu({find:g1,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}});var us={exports:{}},tr={},ai={exports:{}},zu={},Ro={exports:{}},br={exports:{}},ne={};/** @license React v16.13.1
222
346
  * react-is.production.min.js
223
347
  *
224
348
  * Copyright (c) Facebook, Inc. and its affiliates.
225
349
  *
226
350
  * This source code is licensed under the MIT license found in the
227
351
  * LICENSE file in the root directory of this source tree.
228
- */var Zt;function Vi(){if(Zt)return F;Zt=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,d=e?Symbol.for("react.async_mode"):60111,p=e?Symbol.for("react.concurrent_mode"):60111,y=e?Symbol.for("react.forward_ref"):60112,v=e?Symbol.for("react.suspense"):60113,O=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,A=e?Symbol.for("react.lazy"):60116,$=e?Symbol.for("react.block"):60121,B=e?Symbol.for("react.fundamental"):60117,L=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function N(c){if(typeof c=="object"&&c!==null){var Y=c.$$typeof;switch(Y){case t:switch(c=c.type,c){case d:case p:case n:case a:case o:case v:return c;default:switch(c=c&&c.$$typeof,c){case u:case y:case A:case S:case l:return c;default:return Y}}case r:return Y}}}function E(c){return N(c)===p}return F.AsyncMode=d,F.ConcurrentMode=p,F.ContextConsumer=u,F.ContextProvider=l,F.Element=t,F.ForwardRef=y,F.Fragment=n,F.Lazy=A,F.Memo=S,F.Portal=r,F.Profiler=a,F.StrictMode=o,F.Suspense=v,F.isAsyncMode=function(c){return E(c)||N(c)===d},F.isConcurrentMode=E,F.isContextConsumer=function(c){return N(c)===u},F.isContextProvider=function(c){return N(c)===l},F.isElement=function(c){return typeof c=="object"&&c!==null&&c.$$typeof===t},F.isForwardRef=function(c){return N(c)===y},F.isFragment=function(c){return N(c)===n},F.isLazy=function(c){return N(c)===A},F.isMemo=function(c){return N(c)===S},F.isPortal=function(c){return N(c)===r},F.isProfiler=function(c){return N(c)===a},F.isStrictMode=function(c){return N(c)===o},F.isSuspense=function(c){return N(c)===v},F.isValidElementType=function(c){return typeof c=="string"||typeof c=="function"||c===n||c===p||c===a||c===o||c===v||c===O||typeof c=="object"&&c!==null&&(c.$$typeof===A||c.$$typeof===S||c.$$typeof===l||c.$$typeof===u||c.$$typeof===y||c.$$typeof===B||c.$$typeof===L||c.$$typeof===g||c.$$typeof===$)},F.typeOf=N,F}var U={};/** @license React v16.13.1
352
+ */var pa;function b1(){if(pa)return ne;pa=1;var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,o=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,a=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function S(v){if(typeof v=="object"&&v!==null){var N=v.$$typeof;switch(N){case e:switch(v=v.type,v){case a:case c:case r:case o:case i:case d:return v;default:switch(v=v&&v.$$typeof,v){case l:case u:case p:case h:case s:return v;default:return N}}case t:return N}}}function k(v){return S(v)===c}return ne.AsyncMode=a,ne.ConcurrentMode=c,ne.ContextConsumer=l,ne.ContextProvider=s,ne.Element=e,ne.ForwardRef=u,ne.Fragment=r,ne.Lazy=p,ne.Memo=h,ne.Portal=t,ne.Profiler=o,ne.StrictMode=i,ne.Suspense=d,ne.isAsyncMode=function(v){return k(v)||S(v)===a},ne.isConcurrentMode=k,ne.isContextConsumer=function(v){return S(v)===l},ne.isContextProvider=function(v){return S(v)===s},ne.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},ne.isForwardRef=function(v){return S(v)===u},ne.isFragment=function(v){return S(v)===r},ne.isLazy=function(v){return S(v)===p},ne.isMemo=function(v){return S(v)===h},ne.isPortal=function(v){return S(v)===t},ne.isProfiler=function(v){return S(v)===o},ne.isStrictMode=function(v){return S(v)===i},ne.isSuspense=function(v){return S(v)===d},ne.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===r||v===c||v===o||v===i||v===d||v===f||typeof v=="object"&&v!==null&&(v.$$typeof===p||v.$$typeof===h||v.$$typeof===s||v.$$typeof===l||v.$$typeof===u||v.$$typeof===g||v.$$typeof===b||v.$$typeof===x||v.$$typeof===m)},ne.typeOf=S,ne}var re={};/** @license React v16.13.1
229
353
  * react-is.development.js
230
354
  *
231
355
  * Copyright (c) Facebook, Inc. and its affiliates.
232
356
  *
233
357
  * This source code is licensed under the MIT license found in the
234
358
  * LICENSE file in the root directory of this source tree.
235
- */var Qt;function Ai(){return Qt||(Qt=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,l=e?Symbol.for("react.provider"):60109,u=e?Symbol.for("react.context"):60110,d=e?Symbol.for("react.async_mode"):60111,p=e?Symbol.for("react.concurrent_mode"):60111,y=e?Symbol.for("react.forward_ref"):60112,v=e?Symbol.for("react.suspense"):60113,O=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,A=e?Symbol.for("react.lazy"):60116,$=e?Symbol.for("react.block"):60121,B=e?Symbol.for("react.fundamental"):60117,L=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function N(b){return typeof b=="string"||typeof b=="function"||b===n||b===p||b===a||b===o||b===v||b===O||typeof b=="object"&&b!==null&&(b.$$typeof===A||b.$$typeof===S||b.$$typeof===l||b.$$typeof===u||b.$$typeof===y||b.$$typeof===B||b.$$typeof===L||b.$$typeof===g||b.$$typeof===$)}function E(b){if(typeof b=="object"&&b!==null){var be=b.$$typeof;switch(be){case t:var Te=b.type;switch(Te){case d:case p:case n:case a:case o:case v:return Te;default:var De=Te&&Te.$$typeof;switch(De){case u:case y:case A:case S:case l:return De;default:return be}}case r:return be}}}var c=d,Y=p,T=u,ee=l,fe=t,me=y,ye=n,Se=A,te=S,Q=r,pe=a,ae=o,ce=v,ge=!1;function we(b){return ge||(ge=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),m(b)||E(b)===d}function m(b){return E(b)===p}function x(b){return E(b)===u}function P(b){return E(b)===l}function R(b){return typeof b=="object"&&b!==null&&b.$$typeof===t}function C(b){return E(b)===y}function z(b){return E(b)===n}function k(b){return E(b)===A}function _(b){return E(b)===S}function j(b){return E(b)===r}function q(b){return E(b)===a}function M(b){return E(b)===o}function re(b){return E(b)===v}U.AsyncMode=c,U.ConcurrentMode=Y,U.ContextConsumer=T,U.ContextProvider=ee,U.Element=fe,U.ForwardRef=me,U.Fragment=ye,U.Lazy=Se,U.Memo=te,U.Portal=Q,U.Profiler=pe,U.StrictMode=ae,U.Suspense=ce,U.isAsyncMode=we,U.isConcurrentMode=m,U.isContextConsumer=x,U.isContextProvider=P,U.isElement=R,U.isForwardRef=C,U.isFragment=z,U.isLazy=k,U.isMemo=_,U.isPortal=j,U.isProfiler=q,U.isStrictMode=M,U.isSuspense=re,U.isValidElementType=N,U.typeOf=E}()),U}var er;function yr(){return er||(er=1,process.env.NODE_ENV==="production"?Ye.exports=Vi():Ye.exports=Ai()),Ye.exports}/*
359
+ */var ma;function v1(){return ma||(ma=1,process.env.NODE_ENV!=="production"&&function(){var n=typeof Symbol=="function"&&Symbol.for,e=n?Symbol.for("react.element"):60103,t=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,o=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,a=n?Symbol.for("react.async_mode"):60111,c=n?Symbol.for("react.concurrent_mode"):60111,u=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,f=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,p=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function S(D){return typeof D=="string"||typeof D=="function"||D===r||D===c||D===o||D===i||D===d||D===f||typeof D=="object"&&D!==null&&(D.$$typeof===p||D.$$typeof===h||D.$$typeof===s||D.$$typeof===l||D.$$typeof===u||D.$$typeof===g||D.$$typeof===b||D.$$typeof===x||D.$$typeof===m)}function k(D){if(typeof D=="object"&&D!==null){var tt=D.$$typeof;switch(tt){case e:var fn=D.type;switch(fn){case a:case c:case r:case o:case i:case d:return fn;default:var qt=fn&&fn.$$typeof;switch(qt){case l:case u:case p:case h:case s:return qt;default:return tt}}case t:return tt}}}var v=a,N=c,O=l,B=s,_=e,oe=u,ge=r,Ee=p,ye=h,pe=t,We=o,xe=i,Ne=d,ut=!1;function vt(D){return ut||(ut=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),M(D)||k(D)===a}function M(D){return k(D)===c}function R(D){return k(D)===l}function K(D){return k(D)===s}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function j(D){return k(D)===u}function X(D){return k(D)===r}function F(D){return k(D)===p}function W(D){return k(D)===h}function J(D){return k(D)===t}function Q(D){return k(D)===o}function Y(D){return k(D)===i}function Ae(D){return k(D)===d}re.AsyncMode=v,re.ConcurrentMode=N,re.ContextConsumer=O,re.ContextProvider=B,re.Element=_,re.ForwardRef=oe,re.Fragment=ge,re.Lazy=Ee,re.Memo=ye,re.Portal=pe,re.Profiler=We,re.StrictMode=xe,re.Suspense=Ne,re.isAsyncMode=vt,re.isConcurrentMode=M,re.isContextConsumer=R,re.isContextProvider=K,re.isElement=U,re.isForwardRef=j,re.isFragment=X,re.isLazy=F,re.isMemo=W,re.isPortal=J,re.isProfiler=Q,re.isStrictMode=Y,re.isSuspense=Ae,re.isValidElementType=S,re.typeOf=k}()),re}var ga;function Lu(){return ga||(ga=1,process.env.NODE_ENV==="production"?br.exports=b1():br.exports=v1()),br.exports}/*
236
360
  object-assign
237
361
  (c) Sindre Sorhus
238
362
  @license MIT
239
- */var lt,tr;function $i(){if(tr)return lt;tr=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function o(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var l={},u=0;u<10;u++)l["_"+String.fromCharCode(u)]=u;var d=Object.getOwnPropertyNames(l).map(function(y){return l[y]});if(d.join("")!=="0123456789")return!1;var p={};return"abcdefghijklmnopqrst".split("").forEach(function(y){p[y]=y}),Object.keys(Object.assign({},p)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return lt=o()?Object.assign:function(a,l){for(var u,d=n(a),p,y=1;y<arguments.length;y++){u=Object(arguments[y]);for(var v in u)t.call(u,v)&&(d[v]=u[v]);if(e){p=e(u);for(var O=0;O<p.length;O++)r.call(u,p[O])&&(d[p[O]]=u[p[O]])}}return d},lt}var ct,rr;function kt(){if(rr)return ct;rr=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ct=e,ct}var ut,nr;function vr(){return nr||(nr=1,ut=Function.call.bind(Object.prototype.hasOwnProperty)),ut}var dt,ir;function zi(){if(ir)return dt;ir=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=kt(),r={},n=vr();e=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}}}function o(a,l,u,d,p){if(process.env.NODE_ENV!=="production"){for(var y in a)if(n(a,y)){var v;try{if(typeof a[y]!="function"){var O=Error((d||"React class")+": "+u+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}v=a[y](l,y,d,u,null,t)}catch(A){v=A}if(v&&!(v instanceof Error)&&e((d||"React class")+": type specification of "+u+" `"+y+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof v+". 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 instanceof Error&&!(v.message in r)){r[v.message]=!0;var S=p?p():"";e("Failed "+u+" type: "+v.message+(S??""))}}}}return o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},dt=o,dt}var ft,or;function Ii(){if(or)return ft;or=1;var e=yr(),t=$i(),r=kt(),n=vr(),o=zi(),a=function(){};process.env.NODE_ENV!=="production"&&(a=function(u){var d="Warning: "+u;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}});function l(){return null}return ft=function(u,d){var p=typeof Symbol=="function"&&Symbol.iterator,y="@@iterator";function v(m){var x=m&&(p&&m[p]||m[y]);if(typeof x=="function")return x}var O="<<anonymous>>",S={array:L("array"),bigint:L("bigint"),bool:L("boolean"),func:L("function"),number:L("number"),object:L("object"),string:L("string"),symbol:L("symbol"),any:g(),arrayOf:N,element:E(),elementType:c(),instanceOf:Y,node:me(),objectOf:ee,oneOf:T,oneOfType:fe,shape:Se,exact:te};function A(m,x){return m===x?m!==0||1/m===1/x:m!==m&&x!==x}function $(m,x){this.message=m,this.data=x&&typeof x=="object"?x:{},this.stack=""}$.prototype=Error.prototype;function B(m){if(process.env.NODE_ENV!=="production")var x={},P=0;function R(z,k,_,j,q,M,re){if(j=j||O,M=M||_,re!==r){if(d){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var be=j+":"+_;!x[be]&&P<3&&(a("You are manually calling a React.PropTypes validation function for the `"+M+"` prop on `"+j+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),x[be]=!0,P++)}}return k[_]==null?z?k[_]===null?new $("The "+q+" `"+M+"` is marked as required "+("in `"+j+"`, but its value is `null`.")):new $("The "+q+" `"+M+"` is marked as required in "+("`"+j+"`, but its value is `undefined`.")):null:m(k,_,j,q,M)}var C=R.bind(null,!1);return C.isRequired=R.bind(null,!0),C}function L(m){function x(P,R,C,z,k,_){var j=P[R],q=ae(j);if(q!==m){var M=ce(j);return new $("Invalid "+z+" `"+k+"` of type "+("`"+M+"` supplied to `"+C+"`, expected ")+("`"+m+"`."),{expectedType:m})}return null}return B(x)}function g(){return B(l)}function N(m){function x(P,R,C,z,k){if(typeof m!="function")return new $("Property `"+k+"` of component `"+C+"` has invalid PropType notation inside arrayOf.");var _=P[R];if(!Array.isArray(_)){var j=ae(_);return new $("Invalid "+z+" `"+k+"` of type "+("`"+j+"` supplied to `"+C+"`, expected an array."))}for(var q=0;q<_.length;q++){var M=m(_,q,C,z,k+"["+q+"]",r);if(M instanceof Error)return M}return null}return B(x)}function E(){function m(x,P,R,C,z){var k=x[P];if(!u(k)){var _=ae(k);return new $("Invalid "+C+" `"+z+"` of type "+("`"+_+"` supplied to `"+R+"`, expected a single ReactElement."))}return null}return B(m)}function c(){function m(x,P,R,C,z){var k=x[P];if(!e.isValidElementType(k)){var _=ae(k);return new $("Invalid "+C+" `"+z+"` of type "+("`"+_+"` supplied to `"+R+"`, expected a single ReactElement type."))}return null}return B(m)}function Y(m){function x(P,R,C,z,k){if(!(P[R]instanceof m)){var _=m.name||O,j=we(P[R]);return new $("Invalid "+z+" `"+k+"` of type "+("`"+j+"` supplied to `"+C+"`, expected ")+("instance of `"+_+"`."))}return null}return B(x)}function T(m){if(!Array.isArray(m))return process.env.NODE_ENV!=="production"&&(arguments.length>1?a("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):a("Invalid argument supplied to oneOf, expected an array.")),l;function x(P,R,C,z,k){for(var _=P[R],j=0;j<m.length;j++)if(A(_,m[j]))return null;var q=JSON.stringify(m,function(re,b){var be=ce(b);return be==="symbol"?String(b):b});return new $("Invalid "+z+" `"+k+"` of value `"+String(_)+"` "+("supplied to `"+C+"`, expected one of "+q+"."))}return B(x)}function ee(m){function x(P,R,C,z,k){if(typeof m!="function")return new $("Property `"+k+"` of component `"+C+"` has invalid PropType notation inside objectOf.");var _=P[R],j=ae(_);if(j!=="object")return new $("Invalid "+z+" `"+k+"` of type "+("`"+j+"` supplied to `"+C+"`, expected an object."));for(var q in _)if(n(_,q)){var M=m(_,q,C,z,k+"."+q,r);if(M instanceof Error)return M}return null}return B(x)}function fe(m){if(!Array.isArray(m))return process.env.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),l;for(var x=0;x<m.length;x++){var P=m[x];if(typeof P!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ge(P)+" at index "+x+"."),l}function R(C,z,k,_,j){for(var q=[],M=0;M<m.length;M++){var re=m[M],b=re(C,z,k,_,j,r);if(b==null)return null;b.data&&n(b.data,"expectedType")&&q.push(b.data.expectedType)}var be=q.length>0?", expected one of type ["+q.join(", ")+"]":"";return new $("Invalid "+_+" `"+j+"` supplied to "+("`"+k+"`"+be+"."))}return B(R)}function me(){function m(x,P,R,C,z){return Q(x[P])?null:new $("Invalid "+C+" `"+z+"` supplied to "+("`"+R+"`, expected a ReactNode."))}return B(m)}function ye(m,x,P,R,C){return new $((m||"React class")+": "+x+" type `"+P+"."+R+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+C+"`.")}function Se(m){function x(P,R,C,z,k){var _=P[R],j=ae(_);if(j!=="object")return new $("Invalid "+z+" `"+k+"` of type `"+j+"` "+("supplied to `"+C+"`, expected `object`."));for(var q in m){var M=m[q];if(typeof M!="function")return ye(C,z,k,q,ce(M));var re=M(_,q,C,z,k+"."+q,r);if(re)return re}return null}return B(x)}function te(m){function x(P,R,C,z,k){var _=P[R],j=ae(_);if(j!=="object")return new $("Invalid "+z+" `"+k+"` of type `"+j+"` "+("supplied to `"+C+"`, expected `object`."));var q=t({},P[R],m);for(var M in q){var re=m[M];if(n(m,M)&&typeof re!="function")return ye(C,z,k,M,ce(re));if(!re)return new $("Invalid "+z+" `"+k+"` key `"+M+"` supplied to `"+C+"`.\nBad object: "+JSON.stringify(P[R],null," ")+`
240
- Valid keys: `+JSON.stringify(Object.keys(m),null," "));var b=re(_,M,C,z,k+"."+M,r);if(b)return b}return null}return B(x)}function Q(m){switch(typeof m){case"number":case"string":case"undefined":return!0;case"boolean":return!m;case"object":if(Array.isArray(m))return m.every(Q);if(m===null||u(m))return!0;var x=v(m);if(x){var P=x.call(m),R;if(x!==m.entries){for(;!(R=P.next()).done;)if(!Q(R.value))return!1}else for(;!(R=P.next()).done;){var C=R.value;if(C&&!Q(C[1]))return!1}}else return!1;return!0;default:return!1}}function pe(m,x){return m==="symbol"?!0:x?x["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&x instanceof Symbol:!1}function ae(m){var x=typeof m;return Array.isArray(m)?"array":m instanceof RegExp?"object":pe(x,m)?"symbol":x}function ce(m){if(typeof m>"u"||m===null)return""+m;var x=ae(m);if(x==="object"){if(m instanceof Date)return"date";if(m instanceof RegExp)return"regexp"}return x}function ge(m){var x=ce(m);switch(x){case"array":case"object":return"an "+x;case"boolean":case"date":case"regexp":return"a "+x;default:return x}}function we(m){return!m.constructor||!m.constructor.name?O:m.constructor.name}return S.checkPropTypes=o,S.resetWarningCache=o.resetWarningCache,S.PropTypes=S,S},ft}var mt,ar;function qi(){if(ar)return mt;ar=1;var e=kt();function t(){}function r(){}return r.resetWarningCache=t,mt=function(){function n(l,u,d,p,y,v){if(v!==e){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}}n.isRequired=n;function o(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return a.PropTypes=a,a},mt}if(process.env.NODE_ENV!=="production"){var Hi=yr(),Li=!0;xt.exports=Ii()(Hi.isElement,Li)}else xt.exports=qi()();var Ge=xt.exports;function gr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=gr(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function sr(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=gr(e))&&(n&&(n+=" "),n+=t);return n}const Wi=Object.freeze(Object.defineProperty({__proto__:null,clsx:sr,default:sr},Symbol.toStringTag,{value:"Module"})),Yi=pn(Wi);var G={},Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.dontSetMe=Ki;Ne.findInArray=Fi;Ne.int=Xi;Ne.isFunction=Ui;Ne.isNum=Bi;function Fi(e,t){for(let r=0,n=e.length;r<n;r++)if(t.apply(t,[e[r],r,e]))return e[r]}function Ui(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function Bi(e){return typeof e=="number"&&!isNaN(e)}function Xi(e){return parseInt(e,10)}function Ki(e,t,r){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(r," - do not set this, set it on the child."))}var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.browserPrefixToKey=Nr;Re.browserPrefixToStyle=Gi;Re.default=void 0;Re.getPrefix=xr;const pt=["Moz","Webkit","O","ms"];function xr(){var e;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const r=(e=window.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.style;if(!r||t in r)return"";for(let n=0;n<pt.length;n++)if(Nr(t,pt[n])in r)return pt[n];return""}function Nr(e,t){return t?"".concat(t).concat(Ji(e)):e}function Gi(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e}function Ji(e){let t="",r=!0;for(let n=0;n<e.length;n++)r?(t+=e[n].toUpperCase(),r=!1):e[n]==="-"?r=!0:t+=e[n];return t}Re.default=xr();Object.defineProperty(G,"__esModule",{value:!0});G.addClassName=wr;G.addEvent=eo;G.addUserSelectStyles=fo;G.createCSSTransform=so;G.createSVGTransform=lo;G.getTouch=co;G.getTouchIdentifier=uo;G.getTranslation=Dt;G.innerHeight=io;G.innerWidth=oo;G.matchesSelector=Sr;G.matchesSelectorAndParentsTo=Qi;G.offsetXYFromParent=ao;G.outerHeight=ro;G.outerWidth=no;G.removeClassName=Cr;G.removeEvent=to;G.removeUserSelectStyles=mo;var de=Ne,lr=Zi(Re);function Er(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Er=function(n){return n?r:t})(e)}function Zi(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Er(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var l=o?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}let Fe="";function Sr(e,t){return Fe||(Fe=(0,de.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(r){return(0,de.isFunction)(e[r])})),(0,de.isFunction)(e[Fe])?e[Fe](t):!1}function Qi(e,t,r){let n=e;do{if(Sr(n,t))return!0;if(n===r)return!1;n=n.parentNode}while(n);return!1}function eo(e,t,r,n){if(!e)return;const o={capture:!0,...n};e.addEventListener?e.addEventListener(t,r,o):e.attachEvent?e.attachEvent("on"+t,r):e["on"+t]=r}function to(e,t,r,n){if(!e)return;const o={capture:!0,...n};e.removeEventListener?e.removeEventListener(t,r,o):e.detachEvent?e.detachEvent("on"+t,r):e["on"+t]=null}function ro(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,de.int)(r.borderTopWidth),t+=(0,de.int)(r.borderBottomWidth),t}function no(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,de.int)(r.borderLeftWidth),t+=(0,de.int)(r.borderRightWidth),t}function io(e){let t=e.clientHeight;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,de.int)(r.paddingTop),t-=(0,de.int)(r.paddingBottom),t}function oo(e){let t=e.clientWidth;const r=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,de.int)(r.paddingLeft),t-=(0,de.int)(r.paddingRight),t}function ao(e,t,r){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),a=(e.clientX+t.scrollLeft-o.left)/r,l=(e.clientY+t.scrollTop-o.top)/r;return{x:a,y:l}}function so(e,t){const r=Dt(e,t,"px");return{[(0,lr.browserPrefixToKey)("transform",lr.default)]:r}}function lo(e,t){return Dt(e,t,"")}function Dt(e,t,r){let{x:n,y:o}=e,a="translate(".concat(n).concat(r,",").concat(o).concat(r,")");if(t){const l="".concat(typeof t.x=="string"?t.x:t.x+r),u="".concat(typeof t.y=="string"?t.y:t.y+r);a="translate(".concat(l,", ").concat(u,")")+a}return a}function co(e,t){return e.targetTouches&&(0,de.findInArray)(e.targetTouches,r=>t===r.identifier)||e.changedTouches&&(0,de.findInArray)(e.changedTouches,r=>t===r.identifier)}function uo(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function fo(e){if(!e)return;let t=e.getElementById("react-draggable-style-el");t||(t=e.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
241
- `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
242
- `,e.getElementsByTagName("head")[0].appendChild(t)),e.body&&wr(e.body,"react-draggable-transparent-selection")}function mo(e){if(e)try{if(e.body&&Cr(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{const t=(e.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function wr(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function Cr(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.canDragX=ho;Ee.canDragY=yo;Ee.createCoreData=go;Ee.createDraggableData=xo;Ee.getBoundPosition=po;Ee.getControlPosition=vo;Ee.snapToGrid=bo;var ue=Ne,Me=G;function po(e,t,r){if(!e.props.bounds)return[t,r];let{bounds:n}=e.props;n=typeof n=="string"?n:No(n);const o=_t(e);if(typeof n=="string"){const{ownerDocument:a}=o,l=a.defaultView;let u;if(n==="parent"?u=o.parentNode:u=a.querySelector(n),!(u instanceof l.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const d=u,p=l.getComputedStyle(o),y=l.getComputedStyle(d);n={left:-o.offsetLeft+(0,ue.int)(y.paddingLeft)+(0,ue.int)(p.marginLeft),top:-o.offsetTop+(0,ue.int)(y.paddingTop)+(0,ue.int)(p.marginTop),right:(0,Me.innerWidth)(d)-(0,Me.outerWidth)(o)-o.offsetLeft+(0,ue.int)(y.paddingRight)-(0,ue.int)(p.marginRight),bottom:(0,Me.innerHeight)(d)-(0,Me.outerHeight)(o)-o.offsetTop+(0,ue.int)(y.paddingBottom)-(0,ue.int)(p.marginBottom)}}return(0,ue.isNum)(n.right)&&(t=Math.min(t,n.right)),(0,ue.isNum)(n.bottom)&&(r=Math.min(r,n.bottom)),(0,ue.isNum)(n.left)&&(t=Math.max(t,n.left)),(0,ue.isNum)(n.top)&&(r=Math.max(r,n.top)),[t,r]}function bo(e,t,r){const n=Math.round(t/e[0])*e[0],o=Math.round(r/e[1])*e[1];return[n,o]}function ho(e){return e.props.axis==="both"||e.props.axis==="x"}function yo(e){return e.props.axis==="both"||e.props.axis==="y"}function vo(e,t,r){const n=typeof t=="number"?(0,Me.getTouch)(e,t):null;if(typeof t=="number"&&!n)return null;const o=_t(r),a=r.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,Me.offsetXYFromParent)(n||e,a,r.props.scale)}function go(e,t,r){const n=!(0,ue.isNum)(e.lastX),o=_t(e);return n?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:r,x:t,y:r}:{node:o,deltaX:t-e.lastX,deltaY:r-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:r}}function xo(e,t){const r=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/r,y:e.state.y+t.deltaY/r,deltaX:t.deltaX/r,deltaY:t.deltaY/r,lastX:e.state.x,lastY:e.state.y}}function No(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function _t(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var Je={},Ze={};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.default=Eo;function Eo(){}Object.defineProperty(Je,"__esModule",{value:!0});Je.default=void 0;var bt=wo(X),le=Ot(Ge),So=Ot(mr),ne=G,Ce=Ee,ht=Ne,$e=Ot(Ze);function Ot(e){return e&&e.__esModule?e:{default:e}}function kr(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(kr=function(n){return n?r:t})(e)}function wo(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=kr(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var l=o?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function oe(e,t,r){return t=Co(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Co(e){var t=ko(e,"string");return typeof t=="symbol"?t:String(t)}function ko(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}const ve={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let ke=ve.mouse,Qe=class extends bt.Component{constructor(){super(...arguments),oe(this,"dragging",!1),oe(this,"lastX",NaN),oe(this,"lastY",NaN),oe(this,"touchIdentifier",null),oe(this,"mounted",!1),oe(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const r=this.findDOMNode();if(!r||!r.ownerDocument||!r.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=r;if(this.props.disabled||!(t.target instanceof n.defaultView.Node)||this.props.handle&&!(0,ne.matchesSelectorAndParentsTo)(t.target,this.props.handle,r)||this.props.cancel&&(0,ne.matchesSelectorAndParentsTo)(t.target,this.props.cancel,r))return;t.type==="touchstart"&&t.preventDefault();const o=(0,ne.getTouchIdentifier)(t);this.touchIdentifier=o;const a=(0,Ce.getControlPosition)(t,o,this);if(a==null)return;const{x:l,y:u}=a,d=(0,Ce.createCoreData)(this,l,u);(0,$e.default)("DraggableCore: handleDragStart: %j",d),(0,$e.default)("calling",this.props.onStart),!(this.props.onStart(t,d)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,ne.addUserSelectStyles)(n),this.dragging=!0,this.lastX=l,this.lastY=u,(0,ne.addEvent)(n,ke.move,this.handleDrag),(0,ne.addEvent)(n,ke.stop,this.handleDragStop))}),oe(this,"handleDrag",t=>{const r=(0,Ce.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:o}=r;if(Array.isArray(this.props.grid)){let u=n-this.lastX,d=o-this.lastY;if([u,d]=(0,Ce.snapToGrid)(this.props.grid,u,d),!u&&!d)return;n=this.lastX+u,o=this.lastY+d}const a=(0,Ce.createCoreData)(this,n,o);if((0,$e.default)("DraggableCore: handleDrag: %j",a),this.props.onDrag(t,a)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const d=document.createEvent("MouseEvents");d.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(d)}return}this.lastX=n,this.lastY=o}),oe(this,"handleDragStop",t=>{if(!this.dragging)return;const r=(0,Ce.getControlPosition)(t,this.touchIdentifier,this);if(r==null)return;let{x:n,y:o}=r;if(Array.isArray(this.props.grid)){let d=n-this.lastX||0,p=o-this.lastY||0;[d,p]=(0,Ce.snapToGrid)(this.props.grid,d,p),n=this.lastX+d,o=this.lastY+p}const a=(0,Ce.createCoreData)(this,n,o);if(this.props.onStop(t,a)===!1||this.mounted===!1)return!1;const u=this.findDOMNode();u&&this.props.enableUserSelectHack&&(0,ne.removeUserSelectStyles)(u.ownerDocument),(0,$e.default)("DraggableCore: handleDragStop: %j",a),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,u&&((0,$e.default)("DraggableCore: Removing handlers"),(0,ne.removeEvent)(u.ownerDocument,ke.move,this.handleDrag),(0,ne.removeEvent)(u.ownerDocument,ke.stop,this.handleDragStop))}),oe(this,"onMouseDown",t=>(ke=ve.mouse,this.handleDragStart(t))),oe(this,"onMouseUp",t=>(ke=ve.mouse,this.handleDragStop(t))),oe(this,"onTouchStart",t=>(ke=ve.touch,this.handleDragStart(t))),oe(this,"onTouchEnd",t=>(ke=ve.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,ne.addEvent)(t,ve.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:r}=t;(0,ne.removeEvent)(r,ve.mouse.move,this.handleDrag),(0,ne.removeEvent)(r,ve.touch.move,this.handleDrag),(0,ne.removeEvent)(r,ve.mouse.stop,this.handleDragStop),(0,ne.removeEvent)(r,ve.touch.stop,this.handleDragStop),(0,ne.removeEvent)(t,ve.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ne.removeUserSelectStyles)(r)}}findDOMNode(){var t,r;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(r=this.props)===null||r===void 0||(r=r.nodeRef)===null||r===void 0?void 0:r.current:So.default.findDOMNode(this)}render(){return bt.cloneElement(bt.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Je.default=Qe;oe(Qe,"displayName","DraggableCore");oe(Qe,"propTypes",{allowAnyClick:le.default.bool,children:le.default.node.isRequired,disabled:le.default.bool,enableUserSelectHack:le.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:le.default.arrayOf(le.default.number),handle:le.default.string,cancel:le.default.string,nodeRef:le.default.object,onStart:le.default.func,onDrag:le.default.func,onStop:le.default.func,onMouseDown:le.default.func,scale:le.default.number,className:ht.dontSetMe,style:ht.dontSetMe,transform:ht.dontSetMe});oe(Qe,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return d.default}}),e.default=void 0;var t=O(X),r=y(Ge),n=y(mr),o=y(Yi),a=G,l=Ee,u=Ne,d=y(Je),p=y(Ze);function y(g){return g&&g.__esModule?g:{default:g}}function v(g){if(typeof WeakMap!="function")return null;var N=new WeakMap,E=new WeakMap;return(v=function(c){return c?E:N})(g)}function O(g,N){if(g&&g.__esModule)return g;if(g===null||typeof g!="object"&&typeof g!="function")return{default:g};var E=v(N);if(E&&E.has(g))return E.get(g);var c={},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var T in g)if(T!=="default"&&Object.prototype.hasOwnProperty.call(g,T)){var ee=Y?Object.getOwnPropertyDescriptor(g,T):null;ee&&(ee.get||ee.set)?Object.defineProperty(c,T,ee):c[T]=g[T]}return c.default=g,E&&E.set(g,c),c}function S(){return S=Object.assign?Object.assign.bind():function(g){for(var N=1;N<arguments.length;N++){var E=arguments[N];for(var c in E)Object.prototype.hasOwnProperty.call(E,c)&&(g[c]=E[c])}return g},S.apply(this,arguments)}function A(g,N,E){return N=$(N),N in g?Object.defineProperty(g,N,{value:E,enumerable:!0,configurable:!0,writable:!0}):g[N]=E,g}function $(g){var N=B(g,"string");return typeof N=="symbol"?N:String(N)}function B(g,N){if(typeof g!="object"||g===null)return g;var E=g[Symbol.toPrimitive];if(E!==void 0){var c=E.call(g,N||"default");if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(N==="string"?String:Number)(g)}class L extends t.Component{static getDerivedStateFromProps(N,E){let{position:c}=N,{prevPropsPosition:Y}=E;return c&&(!Y||c.x!==Y.x||c.y!==Y.y)?((0,p.default)("Draggable: getDerivedStateFromProps %j",{position:c,prevPropsPosition:Y}),{x:c.x,y:c.y,prevPropsPosition:{...c}}):null}constructor(N){super(N),A(this,"onDragStart",(E,c)=>{if((0,p.default)("Draggable: onDragStart: %j",c),this.props.onStart(E,(0,l.createDraggableData)(this,c))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),A(this,"onDrag",(E,c)=>{if(!this.state.dragging)return!1;(0,p.default)("Draggable: onDrag: %j",c);const Y=(0,l.createDraggableData)(this,c),T={x:Y.x,y:Y.y,slackX:0,slackY:0};if(this.props.bounds){const{x:fe,y:me}=T;T.x+=this.state.slackX,T.y+=this.state.slackY;const[ye,Se]=(0,l.getBoundPosition)(this,T.x,T.y);T.x=ye,T.y=Se,T.slackX=this.state.slackX+(fe-T.x),T.slackY=this.state.slackY+(me-T.y),Y.x=T.x,Y.y=T.y,Y.deltaX=T.x-this.state.x,Y.deltaY=T.y-this.state.y}if(this.props.onDrag(E,Y)===!1)return!1;this.setState(T)}),A(this,"onDragStop",(E,c)=>{if(!this.state.dragging||this.props.onStop(E,(0,l.createDraggableData)(this,c))===!1)return!1;(0,p.default)("Draggable: onDragStop: %j",c);const T={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:fe,y:me}=this.props.position;T.x=fe,T.y=me}this.setState(T)}),this.state={dragging:!1,dragged:!1,x:N.position?N.position.x:N.defaultPosition.x,y:N.position?N.position.y:N.defaultPosition.y,prevPropsPosition:{...N.position},slackX:0,slackY:0,isElementSVG:!1},N.position&&!(N.onDrag||N.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var N,E;return(N=(E=this.props)===null||E===void 0||(E=E.nodeRef)===null||E===void 0?void 0:E.current)!==null&&N!==void 0?N:n.default.findDOMNode(this)}render(){const{axis:N,bounds:E,children:c,defaultPosition:Y,defaultClassName:T,defaultClassNameDragging:ee,defaultClassNameDragged:fe,position:me,positionOffset:ye,scale:Se,...te}=this.props;let Q={},pe=null;const ce=!!!me||this.state.dragging,ge=me||Y,we={x:(0,l.canDragX)(this)&&ce?this.state.x:ge.x,y:(0,l.canDragY)(this)&&ce?this.state.y:ge.y};this.state.isElementSVG?pe=(0,a.createSVGTransform)(we,ye):Q=(0,a.createCSSTransform)(we,ye);const m=(0,o.default)(c.props.className||"",T,{[ee]:this.state.dragging,[fe]:this.state.dragged});return t.createElement(d.default,S({},te,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(c),{className:m,style:{...c.props.style,...Q},transform:pe}))}}e.default=L,A(L,"displayName","Draggable"),A(L,"propTypes",{...d.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:u.dontSetMe,style:u.dontSetMe,transform:u.dontSetMe}),A(L,"defaultProps",{...d.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(hr);const{default:Dr,DraggableCore:Do}=hr;Ke.exports=Dr;Ke.exports.default=Dr;Ke.exports.DraggableCore=Do;var _o=Ke.exports,Rt={};Rt.__esModule=!0;Rt.cloneElement=Mo;var Oo=Ro(X);function Ro(e){return e&&e.__esModule?e:{default:e}}function cr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ur(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cr(Object(r),!0).forEach(function(n){To(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function To(e,t,r){return t=Po(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Po(e){var t=jo(e,"string");return typeof t=="symbol"?t:String(t)}function jo(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mo(e,t){return t.style&&e.props.style&&(t.style=ur(ur({},e.props.style),t.style)),t.className&&e.props.className&&(t.className=e.props.className+" "+t.className),Oo.default.cloneElement(e,t)}var qe={};qe.__esModule=!0;qe.resizableProps=void 0;var D=Vo(Ge);function Vo(e){return e&&e.__esModule?e:{default:e}}var Ao={axis:D.default.oneOf(["both","x","y","none"]),className:D.default.string,children:D.default.element.isRequired,draggableOpts:D.default.shape({allowAnyClick:D.default.bool,cancel:D.default.string,children:D.default.node,disabled:D.default.bool,enableUserSelectHack:D.default.bool,offsetParent:D.default.node,grid:D.default.arrayOf(D.default.number),handle:D.default.string,nodeRef:D.default.object,onStart:D.default.func,onDrag:D.default.func,onStop:D.default.func,onMouseDown:D.default.func,scale:D.default.number}),height:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r[0];if(o.axis==="both"||o.axis==="y"){var a;return(a=D.default.number).isRequired.apply(a,r)}return D.default.number.apply(D.default,r)},handle:D.default.oneOfType([D.default.node,D.default.func]),handleSize:D.default.arrayOf(D.default.number),lockAspectRatio:D.default.bool,maxConstraints:D.default.arrayOf(D.default.number),minConstraints:D.default.arrayOf(D.default.number),onResizeStop:D.default.func,onResizeStart:D.default.func,onResize:D.default.func,resizeHandles:D.default.arrayOf(D.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:D.default.number,width:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r[0];if(o.axis==="both"||o.axis==="x"){var a;return(a=D.default.number).isRequired.apply(a,r)}return D.default.number.apply(D.default,r)}};qe.resizableProps=Ao;Ie.__esModule=!0;Ie.default=void 0;var ze=Ho(X),$o=_o,zo=Rt,Io=qe,qo=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function _r(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(_r=function(o){return o?r:t})(e)}function Ho(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=_r(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var l=o?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function Nt(){return Nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nt.apply(this,arguments)}function Lo(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function dr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function yt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dr(Object(r),!0).forEach(function(n){Wo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wo(e,t,r){return t=Yo(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yo(e){var t=Fo(e,"string");return typeof t=="symbol"?t:String(t)}function Fo(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Uo(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Et(e,t)}function Et(e,t){return Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Et(e,t)}var Tt=function(e){Uo(t,e);function t(){for(var n,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return n=e.call.apply(e,[this].concat(a))||this,n.handleRefs={},n.lastHandleRect=null,n.slack=null,n}var r=t.prototype;return r.componentWillUnmount=function(){this.resetData()},r.resetData=function(){this.lastHandleRect=this.slack=null},r.runConstraints=function(o,a){var l=this.props,u=l.minConstraints,d=l.maxConstraints,p=l.lockAspectRatio;if(!u&&!d&&!p)return[o,a];if(p){var y=this.props.width/this.props.height,v=o-this.props.width,O=a-this.props.height;Math.abs(v)>Math.abs(O*y)?a=o/y:o=a*y}var S=o,A=a,$=this.slack||[0,0],B=$[0],L=$[1];return o+=B,a+=L,u&&(o=Math.max(u[0],o),a=Math.max(u[1],a)),d&&(o=Math.min(d[0],o),a=Math.min(d[1],a)),this.slack=[B+(S-o),L+(A-a)],[o,a]},r.resizeHandler=function(o,a){var l=this;return function(u,d){var p=d.node,y=d.deltaX,v=d.deltaY;o==="onResizeStart"&&l.resetData();var O=(l.props.axis==="both"||l.props.axis==="x")&&a!=="n"&&a!=="s",S=(l.props.axis==="both"||l.props.axis==="y")&&a!=="e"&&a!=="w";if(!(!O&&!S)){var A=a[0],$=a[a.length-1],B=p.getBoundingClientRect();if(l.lastHandleRect!=null){if($==="w"){var L=B.left-l.lastHandleRect.left;y+=L}if(A==="n"){var g=B.top-l.lastHandleRect.top;v+=g}}l.lastHandleRect=B,$==="w"&&(y=-y),A==="n"&&(v=-v);var N=l.props.width+(O?y/l.props.transformScale:0),E=l.props.height+(S?v/l.props.transformScale:0),c=l.runConstraints(N,E);N=c[0],E=c[1];var Y=N!==l.props.width||E!==l.props.height,T=typeof l.props[o]=="function"?l.props[o]:null,ee=o==="onResize"&&!Y;T&&!ee&&(u.persist==null||u.persist(),T(u,{node:p,size:{width:N,height:E},handle:a})),o==="onResizeStop"&&l.resetData()}}},r.renderResizeHandle=function(o,a){var l=this.props.handle;if(!l)return ze.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+o,ref:a});if(typeof l=="function")return l(o,a);var u=typeof l.type=="string",d=yt({ref:a},u?{}:{handleAxis:o});return ze.cloneElement(l,d)},r.render=function(){var o=this,a=this.props,l=a.children,u=a.className,d=a.draggableOpts;a.width,a.height,a.handle,a.handleSize,a.lockAspectRatio,a.axis,a.minConstraints,a.maxConstraints,a.onResize,a.onResizeStop,a.onResizeStart;var p=a.resizeHandles;a.transformScale;var y=Lo(a,qo);return(0,zo.cloneElement)(l,yt(yt({},y),{},{className:(u?u+" ":"")+"react-resizable",children:[].concat(l.props.children,p.map(function(v){var O,S=(O=o.handleRefs[v])!=null?O:o.handleRefs[v]=ze.createRef();return ze.createElement($o.DraggableCore,Nt({},d,{nodeRef:S,key:"resizableHandle-"+v,onStop:o.resizeHandler("onResizeStop",v),onStart:o.resizeHandler("onResizeStart",v),onDrag:o.resizeHandler("onResize",v)}),o.renderResizeHandle(v,S))}))}))},t}(ze.Component);Ie.default=Tt;Tt.propTypes=Io.resizableProps;Tt.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var et={};et.__esModule=!0;et.default=void 0;var vt=Jo(X),Bo=Or(Ge),Xo=Or(Ie),Ko=qe,Go=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Or(e){return e&&e.__esModule?e:{default:e}}function Rr(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,r=new WeakMap;return(Rr=function(o){return o?r:t})(e)}function Jo(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var r=Rr(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a)){var l=o?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(n,a,l):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function St(){return St=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},St.apply(this,arguments)}function fr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Xe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fr(Object(r),!0).forEach(function(n){Zo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zo(e,t,r){return t=Qo(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qo(e){var t=ea(e,"string");return typeof t=="symbol"?t:String(t)}function ea(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ta(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function ra(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,wt(e,t)}function wt(e,t){return wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},wt(e,t)}var Tr=function(e){ra(t,e);function t(){for(var n,o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return n=e.call.apply(e,[this].concat(a))||this,n.state={width:n.props.width,height:n.props.height,propsWidth:n.props.width,propsHeight:n.props.height},n.onResize=function(u,d){var p=d.size;n.props.onResize?(u.persist==null||u.persist(),n.setState(p,function(){return n.props.onResize&&n.props.onResize(u,d)})):n.setState(p)},n}t.getDerivedStateFromProps=function(o,a){return a.propsWidth!==o.width||a.propsHeight!==o.height?{width:o.width,height:o.height,propsWidth:o.width,propsHeight:o.height}:null};var r=t.prototype;return r.render=function(){var o=this.props,a=o.handle,l=o.handleSize;o.onResize;var u=o.onResizeStart,d=o.onResizeStop,p=o.draggableOpts,y=o.minConstraints,v=o.maxConstraints,O=o.lockAspectRatio,S=o.axis;o.width,o.height;var A=o.resizeHandles,$=o.style,B=o.transformScale,L=ta(o,Go);return vt.createElement(Xo.default,{axis:S,draggableOpts:p,handle:a,handleSize:l,height:this.state.height,lockAspectRatio:O,maxConstraints:v,minConstraints:y,onResizeStart:u,onResize:this.onResize,onResizeStop:d,resizeHandles:A,transformScale:B,width:this.state.width},vt.createElement("div",St({},L,{style:Xe(Xe({},$),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},t}(vt.Component);et.default=Tr;Tr.propTypes=Xe(Xe({},Ko.resizableProps),{},{children:Bo.default.element});Ct.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};Ct.exports.Resizable=Ie.default;var na=Ct.exports.ResizableBox=et.default;const ia=({node:e,updateAttributes:t,editor:r})=>{const[n,o]=X.useState({width:e.attrs.width||300,height:e.attrs.height||300}),[a,l]=X.useState({left:e.attrs.marginLeft||0,right:e.attrs.marginRight||0}),[u,d]=X.useState(e.attrs.src||""),p=X.useRef(null);X.useEffect(()=>{if(e.attrs.src&&p.current){const S=new Image;S.onload=()=>{(!e.attrs.width||!e.attrs.height)&&o({width:S.width>600?600:S.width,height:S.width>600?600/S.width*S.height:S.height})},S.src=e.attrs.src}},[e.attrs.src]);const y=(S,{size:A})=>{o({width:A.width,height:A.height}),t({width:A.width,height:A.height})},v=()=>{t({src:u,width:n.width,height:n.height,marginLeft:a.left,marginRight:a.right})},O=S=>{S.preventDefault()};return s.jsxDEV(Oe.NodeViewWrapper,{className:"image-wrapper",children:s.jsxDEV(br,{title:"Image",childrenContent:s.jsxDEV("div",{className:"relative",style:{marginLeft:a.left,marginRight:a.right},onContextMenu:O,children:r.isEditable?s.jsxDEV(na,{width:n.width,height:n.height,onResize:y,minConstraints:[100,100],maxConstraints:[800,800],lockAspectRatio:!0,className:"relative",children:s.jsxDEV("img",{ref:p,src:e.attrs.src,alt:"Uploaded",className:"object-contain w-full h-full",draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:89,columnNumber:33},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:80,columnNumber:29},void 0):s.jsxDEV("img",{ref:p,src:e.attrs.src,alt:"Uploaded",style:{width:n.width,height:n.height},className:"object-contain",draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:98,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:71,columnNumber:21},void 0),editable:r.isEditable,childrenEdit:s.jsxDEV("div",{className:"space-y-4",children:[s.jsxDEV("div",{children:[s.jsxDEV("label",{className:"block text-sm font-medium",children:"Image URL"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:116,columnNumber:29},void 0),s.jsxDEV("input",{type:"text",value:u,onChange:S=>d(S.target.value),className:"w-full p-2 border rounded",disabled:!r.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:117,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:115,columnNumber:25},void 0),s.jsxDEV("div",{className:"flex gap-2",children:[s.jsxDEV("div",{children:[s.jsxDEV("label",{className:"block text-sm font-medium",children:"Width"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:128,columnNumber:33},void 0),s.jsxDEV("input",{type:"number",value:n.width,onChange:S=>o({...n,width:Number(S.target.value)}),className:"w-full p-2 border rounded",disabled:!r.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:129,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:127,columnNumber:29},void 0),s.jsxDEV("div",{children:[s.jsxDEV("label",{className:"block text-sm font-medium",children:"Height"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:138,columnNumber:33},void 0),s.jsxDEV("input",{type:"number",value:n.height,onChange:S=>o({...n,height:Number(S.target.value)}),className:"w-full p-2 border rounded",disabled:!r.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:139,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:137,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:126,columnNumber:25},void 0),s.jsxDEV("div",{className:"flex gap-2",children:[s.jsxDEV("div",{children:[s.jsxDEV("label",{className:"block text-sm font-medium",children:"Margin Left"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:151,columnNumber:33},void 0),s.jsxDEV("input",{type:"number",value:a.left,onChange:S=>l({...a,left:Number(S.target.value)}),className:"w-full p-2 border rounded",disabled:!r.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:152,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:150,columnNumber:29},void 0),s.jsxDEV("div",{children:[s.jsxDEV("label",{className:"block text-sm font-medium",children:"Margin Right"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:161,columnNumber:33},void 0),s.jsxDEV("input",{type:"number",value:a.right,onChange:S=>l({...a,right:Number(S.target.value)}),className:"w-full p-2 border rounded",disabled:!r.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:162,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:160,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:149,columnNumber:25},void 0),s.jsxDEV("button",{onClick:v,className:"w-full p-2 text-white bg-blue-500 rounded hover:bg-blue-600",disabled:!r.isEditable,children:"Update Image"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:172,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:114,columnNumber:21},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:68,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:67,columnNumber:9},void 0)},oa=Ue.Node.create({name:"image",group:"block",content:"inline*",atom:!0,draggable:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:300},height:{default:300},marginLeft:{default:0},marginRight:{default:0}}},parseHTML(){return[{tag:"img",getAttrs:e=>e instanceof HTMLElement?{src:e.getAttribute("src"),width:Number(e.getAttribute("width"))||300,height:Number(e.getAttribute("height"))||300,marginLeft:Number(e.getAttribute("marginleft"))||0,marginRight:Number(e.getAttribute("marginright"))||0}:null}]},renderHTML({HTMLAttributes:e}){return["img",Ue.mergeAttributes(e)]},addNodeView(){return Oe.ReactNodeViewRenderer(ia)},addCommands(){return{setImage:e=>({chain:t})=>t().insertContent({type:"image",attrs:e}).run()}}}),aa=[Qr.Color.configure({types:[Yt.name,Zr.name]}),Yt,tn.configure({multicolor:!0}),en.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1}}),Mi,rn,nn,on,an.configure({types:["heading","paragraph"]}),sn,ln,cn.configure({resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"table-wrapper"}}),un,dn,fn.configure({HTMLAttributes:{class:"table-cell"}}),mn,oa],sa=({content:e="",slotBefore:t=!1,className:r="",editorClassName:n="",editable:o=!0,onChange:a})=>{const[l,u]=X.useState(!1);X.useEffect(()=>{u(!0)},[]);const d=Oe.useEditor({extensions:aa,content:e,editable:o,onUpdate:({editor:p})=>{a&&a(p.getHTML())}});return X.useEffect(()=>{d&&e!==d.getHTML()&&d.commands.setContent(e,!1)},[d,e]),!l||!d?null:s.jsxDEV("div",{className:`cyber-editor-container ${r}`,children:[t&&s.jsxDEV(Pi,{editor:d},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:42,columnNumber:28},void 0),s.jsxDEV(Oe.EditorContent,{editor:d,className:n},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:43,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:41,columnNumber:9},void 0)};exports.CyberEditorProvider=sa;
363
+ */var Ui,ya;function x1(){if(ya)return Ui;ya=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},l=0;l<10;l++)s["_"+String.fromCharCode(l)]=l;var a=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(a.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ui=i()?Object.assign:function(o,s){for(var l,a=r(o),c,u=1;u<arguments.length;u++){l=Object(arguments[u]);for(var d in l)e.call(l,d)&&(a[d]=l[d]);if(n){c=n(l);for(var f=0;f<c.length;f++)t.call(l,c[f])&&(a[c[f]]=l[c[f]])}}return a},Ui}var Ki,ba;function ds(){if(ba)return Ki;ba=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ki=n,Ki}var Ji,va;function Vu(){return va||(va=1,Ji=Function.call.bind(Object.prototype.hasOwnProperty)),Ji}var Yi,xa;function S1(){if(xa)return Yi;xa=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var e=ds(),t={},r=Vu();n=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,l,a,c){if(process.env.NODE_ENV!=="production"){for(var u in o)if(r(o,u)){var d;try{if(typeof o[u]!="function"){var f=Error((a||"React class")+": "+l+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}d=o[u](s,u,a,l,null,e)}catch(p){d=p}if(d&&!(d instanceof Error)&&n((a||"React class")+": type specification of "+l+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in t)){t[d.message]=!0;var h=c?c():"";n("Failed "+l+" type: "+d.message+(h??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(t={})},Yi=i,Yi}var Gi,Sa;function w1(){if(Sa)return Gi;Sa=1;var n=Lu(),e=x1(),t=ds(),r=Vu(),i=S1(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(l){var a="Warning: "+l;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}});function s(){return null}return Gi=function(l,a){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(M){var R=M&&(c&&M[c]||M[u]);if(typeof R=="function")return R}var f="<<anonymous>>",h={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:x(),arrayOf:S,element:k(),elementType:v(),instanceOf:N,node:oe(),objectOf:B,oneOf:O,oneOfType:_,shape:Ee,exact:ye};function p(M,R){return M===R?M!==0||1/M===1/R:M!==M&&R!==R}function m(M,R){this.message=M,this.data=R&&typeof R=="object"?R:{},this.stack=""}m.prototype=Error.prototype;function g(M){if(process.env.NODE_ENV!=="production")var R={},K=0;function U(X,F,W,J,Q,Y,Ae){if(J=J||f,Y=Y||W,Ae!==t){if(a){var D=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw D.name="Invariant Violation",D}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var tt=J+":"+W;!R[tt]&&K<3&&(o("You are manually calling a React.PropTypes validation function for the `"+Y+"` prop on `"+J+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),R[tt]=!0,K++)}}return F[W]==null?X?F[W]===null?new m("The "+Q+" `"+Y+"` is marked as required "+("in `"+J+"`, but its value is `null`.")):new m("The "+Q+" `"+Y+"` is marked as required in "+("`"+J+"`, but its value is `undefined`.")):null:M(F,W,J,Q,Y)}var j=U.bind(null,!1);return j.isRequired=U.bind(null,!0),j}function b(M){function R(K,U,j,X,F,W){var J=K[U],Q=xe(J);if(Q!==M){var Y=Ne(J);return new m("Invalid "+X+" `"+F+"` of type "+("`"+Y+"` supplied to `"+j+"`, expected ")+("`"+M+"`."),{expectedType:M})}return null}return g(R)}function x(){return g(s)}function S(M){function R(K,U,j,X,F){if(typeof M!="function")return new m("Property `"+F+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var W=K[U];if(!Array.isArray(W)){var J=xe(W);return new m("Invalid "+X+" `"+F+"` of type "+("`"+J+"` supplied to `"+j+"`, expected an array."))}for(var Q=0;Q<W.length;Q++){var Y=M(W,Q,j,X,F+"["+Q+"]",t);if(Y instanceof Error)return Y}return null}return g(R)}function k(){function M(R,K,U,j,X){var F=R[K];if(!l(F)){var W=xe(F);return new m("Invalid "+j+" `"+X+"` of type "+("`"+W+"` supplied to `"+U+"`, expected a single ReactElement."))}return null}return g(M)}function v(){function M(R,K,U,j,X){var F=R[K];if(!n.isValidElementType(F)){var W=xe(F);return new m("Invalid "+j+" `"+X+"` of type "+("`"+W+"` supplied to `"+U+"`, expected a single ReactElement type."))}return null}return g(M)}function N(M){function R(K,U,j,X,F){if(!(K[U]instanceof M)){var W=M.name||f,J=vt(K[U]);return new m("Invalid "+X+" `"+F+"` of type "+("`"+J+"` supplied to `"+j+"`, expected ")+("instance of `"+W+"`."))}return null}return g(R)}function O(M){if(!Array.isArray(M))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function R(K,U,j,X,F){for(var W=K[U],J=0;J<M.length;J++)if(p(W,M[J]))return null;var Q=JSON.stringify(M,function(Ae,D){var tt=Ne(D);return tt==="symbol"?String(D):D});return new m("Invalid "+X+" `"+F+"` of value `"+String(W)+"` "+("supplied to `"+j+"`, expected one of "+Q+"."))}return g(R)}function B(M){function R(K,U,j,X,F){if(typeof M!="function")return new m("Property `"+F+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var W=K[U],J=xe(W);if(J!=="object")return new m("Invalid "+X+" `"+F+"` of type "+("`"+J+"` supplied to `"+j+"`, expected an object."));for(var Q in W)if(r(W,Q)){var Y=M(W,Q,j,X,F+"."+Q,t);if(Y instanceof Error)return Y}return null}return g(R)}function _(M){if(!Array.isArray(M))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var R=0;R<M.length;R++){var K=M[R];if(typeof K!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ut(K)+" at index "+R+"."),s}function U(j,X,F,W,J){for(var Q=[],Y=0;Y<M.length;Y++){var Ae=M[Y],D=Ae(j,X,F,W,J,t);if(D==null)return null;D.data&&r(D.data,"expectedType")&&Q.push(D.data.expectedType)}var tt=Q.length>0?", expected one of type ["+Q.join(", ")+"]":"";return new m("Invalid "+W+" `"+J+"` supplied to "+("`"+F+"`"+tt+"."))}return g(U)}function oe(){function M(R,K,U,j,X){return pe(R[K])?null:new m("Invalid "+j+" `"+X+"` supplied to "+("`"+U+"`, expected a ReactNode."))}return g(M)}function ge(M,R,K,U,j){return new m((M||"React class")+": "+R+" type `"+K+"."+U+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function Ee(M){function R(K,U,j,X,F){var W=K[U],J=xe(W);if(J!=="object")return new m("Invalid "+X+" `"+F+"` of type `"+J+"` "+("supplied to `"+j+"`, expected `object`."));for(var Q in M){var Y=M[Q];if(typeof Y!="function")return ge(j,X,F,Q,Ne(Y));var Ae=Y(W,Q,j,X,F+"."+Q,t);if(Ae)return Ae}return null}return g(R)}function ye(M){function R(K,U,j,X,F){var W=K[U],J=xe(W);if(J!=="object")return new m("Invalid "+X+" `"+F+"` of type `"+J+"` "+("supplied to `"+j+"`, expected `object`."));var Q=e({},K[U],M);for(var Y in Q){var Ae=M[Y];if(r(M,Y)&&typeof Ae!="function")return ge(j,X,F,Y,Ne(Ae));if(!Ae)return new m("Invalid "+X+" `"+F+"` key `"+Y+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(K[U],null," ")+`
364
+ Valid keys: `+JSON.stringify(Object.keys(M),null," "));var D=Ae(W,Y,j,X,F+"."+Y,t);if(D)return D}return null}return g(R)}function pe(M){switch(typeof M){case"number":case"string":case"undefined":return!0;case"boolean":return!M;case"object":if(Array.isArray(M))return M.every(pe);if(M===null||l(M))return!0;var R=d(M);if(R){var K=R.call(M),U;if(R!==M.entries){for(;!(U=K.next()).done;)if(!pe(U.value))return!1}else for(;!(U=K.next()).done;){var j=U.value;if(j&&!pe(j[1]))return!1}}else return!1;return!0;default:return!1}}function We(M,R){return M==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function xe(M){var R=typeof M;return Array.isArray(M)?"array":M instanceof RegExp?"object":We(R,M)?"symbol":R}function Ne(M){if(typeof M>"u"||M===null)return""+M;var R=xe(M);if(R==="object"){if(M instanceof Date)return"date";if(M instanceof RegExp)return"regexp"}return R}function ut(M){var R=Ne(M);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function vt(M){return!M.constructor||!M.constructor.name?f:M.constructor.name}return h.checkPropTypes=i,h.resetWarningCache=i.resetWarningCache,h.PropTypes=h,h},Gi}var Xi,wa;function k1(){if(wa)return Xi;wa=1;var n=ds();function e(){}function t(){}return t.resetWarningCache=e,Xi=function(){function r(s,l,a,c,u,d){if(d!==n){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:t,resetWarningCache:e};return o.PropTypes=o,o},Xi}if(process.env.NODE_ENV!=="production"){var C1=Lu(),E1=!0;Ro.exports=w1()(C1.isElement,E1)}else Ro.exports=k1()();var ci=Ro.exports;function Bu(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e<n.length;e++)n[e]&&(t=Bu(n[e]))&&(r&&(r+=" "),r+=t);else for(e in n)n[e]&&(r&&(r+=" "),r+=e);return r}function ka(){for(var n,e,t=0,r="";t<arguments.length;)(n=arguments[t++])&&(e=Bu(n))&&(r&&(r+=" "),r+=e);return r}const N1=Object.freeze(Object.defineProperty({__proto__:null,clsx:ka,default:ka},Symbol.toStringTag,{value:"Module"})),M1=bd(N1);var he={},yt={};Object.defineProperty(yt,"__esModule",{value:!0});yt.dontSetMe=R1;yt.findInArray=T1;yt.int=A1;yt.isFunction=O1;yt.isNum=D1;function T1(n,e){for(let t=0,r=n.length;t<r;t++)if(e.apply(e,[n[t],t,n]))return n[t]}function O1(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Function]"}function D1(n){return typeof n=="number"&&!isNaN(n)}function A1(n){return parseInt(n,10)}function R1(n,e,t){if(n[e])return new Error("Invalid prop ".concat(e," passed to ").concat(t," - do not set this, set it on the child."))}var dn={};Object.defineProperty(dn,"__esModule",{value:!0});dn.browserPrefixToKey=ju;dn.browserPrefixToStyle=P1;dn.default=void 0;dn.getPrefix=$u;const Zi=["Moz","Webkit","O","ms"];function $u(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const t=(n=window.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.style;if(!t||e in t)return"";for(let r=0;r<Zi.length;r++)if(ju(e,Zi[r])in t)return Zi[r];return""}function ju(n,e){return e?"".concat(e).concat(I1(n)):n}function P1(n,e){return e?"-".concat(e.toLowerCase(),"-").concat(n):n}function I1(n){let e="",t=!0;for(let r=0;r<n.length;r++)t?(e+=n[r].toUpperCase(),t=!1):n[r]==="-"?t=!0:e+=n[r];return e}dn.default=$u();Object.defineProperty(he,"__esModule",{value:!0});he.addClassName=Wu;he.addEvent=L1;he.addUserSelectStyles=J1;he.createCSSTransform=W1;he.createSVGTransform=q1;he.getTouch=U1;he.getTouchIdentifier=K1;he.getTranslation=fs;he.innerHeight=j1;he.innerWidth=F1;he.matchesSelector=Hu;he.matchesSelectorAndParentsTo=z1;he.offsetXYFromParent=H1;he.outerHeight=B1;he.outerWidth=$1;he.removeClassName=qu;he.removeEvent=V1;he.removeUserSelectStyles=Y1;var Ze=yt,Ca=_1(dn);function Fu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Fu=function(r){return r?t:e})(n)}function _1(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Fu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}let vr="";function Hu(n,e){return vr||(vr=(0,Ze.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,Ze.isFunction)(n[t])})),(0,Ze.isFunction)(n[vr])?n[vr](e):!1}function z1(n,e,t){let r=n;do{if(Hu(r,e))return!0;if(r===t)return!1;r=r.parentNode}while(r);return!1}function L1(n,e,t,r){if(!n)return;const i={capture:!0,...r};n.addEventListener?n.addEventListener(e,t,i):n.attachEvent?n.attachEvent("on"+e,t):n["on"+e]=t}function V1(n,e,t,r){if(!n)return;const i={capture:!0,...r};n.removeEventListener?n.removeEventListener(e,t,i):n.detachEvent?n.detachEvent("on"+e,t):n["on"+e]=null}function B1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ze.int)(t.borderTopWidth),e+=(0,Ze.int)(t.borderBottomWidth),e}function $1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,Ze.int)(t.borderLeftWidth),e+=(0,Ze.int)(t.borderRightWidth),e}function j1(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ze.int)(t.paddingTop),e-=(0,Ze.int)(t.paddingBottom),e}function F1(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,Ze.int)(t.paddingLeft),e-=(0,Ze.int)(t.paddingRight),e}function H1(n,e,t){const i=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),o=(n.clientX+e.scrollLeft-i.left)/t,s=(n.clientY+e.scrollTop-i.top)/t;return{x:o,y:s}}function W1(n,e){const t=fs(n,e,"px");return{[(0,Ca.browserPrefixToKey)("transform",Ca.default)]:t}}function q1(n,e){return fs(n,e,"")}function fs(n,e,t){let{x:r,y:i}=n,o="translate(".concat(r).concat(t,",").concat(i).concat(t,")");if(e){const s="".concat(typeof e.x=="string"?e.x:e.x+t),l="".concat(typeof e.y=="string"?e.y:e.y+t);o="translate(".concat(s,", ").concat(l,")")+o}return o}function U1(n,e){return n.targetTouches&&(0,Ze.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,Ze.findInArray)(n.changedTouches,t=>e===t.identifier)}function K1(n){if(n.targetTouches&&n.targetTouches[0])return n.targetTouches[0].identifier;if(n.changedTouches&&n.changedTouches[0])return n.changedTouches[0].identifier}function J1(n){if(!n)return;let e=n.getElementById("react-draggable-style-el");e||(e=n.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
365
+ `,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
366
+ `,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&Wu(n.body,"react-draggable-transparent-selection")}function Y1(n){if(n)try{if(n.body&&qu(n.body,"react-draggable-transparent-selection"),n.selection)n.selection.empty();else{const e=(n.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function Wu(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)")))||(n.className+=" ".concat(e))}function qu(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp("(?:^|\\s)".concat(e,"(?!\\S)"),"g"),"")}var bt={};Object.defineProperty(bt,"__esModule",{value:!0});bt.canDragX=Z1;bt.canDragY=Q1;bt.createCoreData=tv;bt.createDraggableData=nv;bt.getBoundPosition=G1;bt.getControlPosition=ev;bt.snapToGrid=X1;var Je=yt,Sn=he;function G1(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:rv(r);const i=hs(n);if(typeof r=="string"){const{ownerDocument:o}=i,s=o.defaultView;let l;if(r==="parent"?l=i.parentNode:l=o.querySelector(r),!(l instanceof s.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const a=l,c=s.getComputedStyle(i),u=s.getComputedStyle(a);r={left:-i.offsetLeft+(0,Je.int)(u.paddingLeft)+(0,Je.int)(c.marginLeft),top:-i.offsetTop+(0,Je.int)(u.paddingTop)+(0,Je.int)(c.marginTop),right:(0,Sn.innerWidth)(a)-(0,Sn.outerWidth)(i)-i.offsetLeft+(0,Je.int)(u.paddingRight)-(0,Je.int)(c.marginRight),bottom:(0,Sn.innerHeight)(a)-(0,Sn.outerHeight)(i)-i.offsetTop+(0,Je.int)(u.paddingBottom)-(0,Je.int)(c.marginBottom)}}return(0,Je.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Je.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,Je.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Je.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function X1(n,e,t){const r=Math.round(e/n[0])*n[0],i=Math.round(t/n[1])*n[1];return[r,i]}function Z1(n){return n.props.axis==="both"||n.props.axis==="x"}function Q1(n){return n.props.axis==="both"||n.props.axis==="y"}function ev(n,e,t){const r=typeof e=="number"?(0,Sn.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const i=hs(t),o=t.props.offsetParent||i.offsetParent||i.ownerDocument.body;return(0,Sn.offsetXYFromParent)(r||n,o,t.props.scale)}function tv(n,e,t){const r=!(0,Je.isNum)(n.lastX),i=hs(n);return r?{node:i,deltaX:0,deltaY:0,lastX:e,lastY:t,x:e,y:t}:{node:i,deltaX:e-n.lastX,deltaY:t-n.lastY,lastX:n.lastX,lastY:n.lastY,x:e,y:t}}function nv(n,e){const t=n.props.scale;return{node:e.node,x:n.state.x+e.deltaX/t,y:n.state.y+e.deltaY/t,deltaX:e.deltaX/t,deltaY:e.deltaY/t,lastX:n.state.x,lastY:n.state.y}}function rv(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function hs(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var ui={},di={};Object.defineProperty(di,"__esModule",{value:!0});di.default=iv;function iv(){}Object.defineProperty(ui,"__esModule",{value:!0});ui.default=void 0;var Qi=sv(I),Ue=ps(ci),ov=ps(qr),Re=he,Nt=bt,eo=yt,_n=ps(di);function ps(n){return n&&n.__esModule?n:{default:n}}function Uu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Uu=function(r){return r?t:e})(n)}function sv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Uu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function Be(n,e,t){return e=lv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lv(n){var e=av(n,"string");return typeof e=="symbol"?e:String(e)}function av(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const st={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let Mt=st.mouse,fi=class extends Qi.Component{constructor(){super(...arguments),Be(this,"dragging",!1),Be(this,"lastX",NaN),Be(this,"lastY",NaN),Be(this,"touchIdentifier",null),Be(this,"mounted",!1),Be(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,Re.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,Re.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&e.preventDefault();const i=(0,Re.getTouchIdentifier)(e);this.touchIdentifier=i;const o=(0,Nt.getControlPosition)(e,i,this);if(o==null)return;const{x:s,y:l}=o,a=(0,Nt.createCoreData)(this,s,l);(0,_n.default)("DraggableCore: handleDragStart: %j",a),(0,_n.default)("calling",this.props.onStart),!(this.props.onStart(e,a)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,Re.addUserSelectStyles)(r),this.dragging=!0,this.lastX=s,this.lastY=l,(0,Re.addEvent)(r,Mt.move,this.handleDrag),(0,Re.addEvent)(r,Mt.stop,this.handleDragStop))}),Be(this,"handleDrag",e=>{const t=(0,Nt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let l=r-this.lastX,a=i-this.lastY;if([l,a]=(0,Nt.snapToGrid)(this.props.grid,l,a),!l&&!a)return;r=this.lastX+l,i=this.lastY+a}const o=(0,Nt.createCoreData)(this,r,i);if((0,_n.default)("DraggableCore: handleDrag: %j",o),this.props.onDrag(e,o)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const a=document.createEvent("MouseEvents");a.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(a)}return}this.lastX=r,this.lastY=i}),Be(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,Nt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:i}=t;if(Array.isArray(this.props.grid)){let a=r-this.lastX||0,c=i-this.lastY||0;[a,c]=(0,Nt.snapToGrid)(this.props.grid,a,c),r=this.lastX+a,i=this.lastY+c}const o=(0,Nt.createCoreData)(this,r,i);if(this.props.onStop(e,o)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&(0,Re.removeUserSelectStyles)(l.ownerDocument),(0,_n.default)("DraggableCore: handleDragStop: %j",o),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&((0,_n.default)("DraggableCore: Removing handlers"),(0,Re.removeEvent)(l.ownerDocument,Mt.move,this.handleDrag),(0,Re.removeEvent)(l.ownerDocument,Mt.stop,this.handleDragStop))}),Be(this,"onMouseDown",e=>(Mt=st.mouse,this.handleDragStart(e))),Be(this,"onMouseUp",e=>(Mt=st.mouse,this.handleDragStop(e))),Be(this,"onTouchStart",e=>(Mt=st.touch,this.handleDragStart(e))),Be(this,"onTouchEnd",e=>(Mt=st.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,Re.addEvent)(e,st.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,Re.removeEvent)(t,st.mouse.move,this.handleDrag),(0,Re.removeEvent)(t,st.touch.move,this.handleDrag),(0,Re.removeEvent)(t,st.mouse.stop,this.handleDragStop),(0,Re.removeEvent)(t,st.touch.stop,this.handleDragStop),(0,Re.removeEvent)(e,st.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,Re.removeUserSelectStyles)(t)}}findDOMNode(){var e,t;return(e=this.props)!==null&&e!==void 0&&e.nodeRef?(t=this.props)===null||t===void 0||(t=t.nodeRef)===null||t===void 0?void 0:t.current:ov.default.findDOMNode(this)}render(){return Qi.cloneElement(Qi.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};ui.default=fi;Be(fi,"displayName","DraggableCore");Be(fi,"propTypes",{allowAnyClick:Ue.default.bool,children:Ue.default.node.isRequired,disabled:Ue.default.bool,enableUserSelectHack:Ue.default.bool,offsetParent:function(n,e){if(n[e]&&n[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ue.default.arrayOf(Ue.default.number),handle:Ue.default.string,cancel:Ue.default.string,nodeRef:Ue.default.object,onStart:Ue.default.func,onDrag:Ue.default.func,onStop:Ue.default.func,onMouseDown:Ue.default.func,scale:Ue.default.number,className:eo.dontSetMe,style:eo.dontSetMe,transform:eo.dontSetMe});Be(fi,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DraggableCore",{enumerable:!0,get:function(){return a.default}}),n.default=void 0;var e=f(I),t=u(ci),r=u(qr),i=u(M1),o=he,s=bt,l=yt,a=u(ui),c=u(di);function u(x){return x&&x.__esModule?x:{default:x}}function d(x){if(typeof WeakMap!="function")return null;var S=new WeakMap,k=new WeakMap;return(d=function(v){return v?k:S})(x)}function f(x,S){if(x&&x.__esModule)return x;if(x===null||typeof x!="object"&&typeof x!="function")return{default:x};var k=d(S);if(k&&k.has(x))return k.get(x);var v={},N=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in x)if(O!=="default"&&Object.prototype.hasOwnProperty.call(x,O)){var B=N?Object.getOwnPropertyDescriptor(x,O):null;B&&(B.get||B.set)?Object.defineProperty(v,O,B):v[O]=x[O]}return v.default=x,k&&k.set(x,v),v}function h(){return h=Object.assign?Object.assign.bind():function(x){for(var S=1;S<arguments.length;S++){var k=arguments[S];for(var v in k)Object.prototype.hasOwnProperty.call(k,v)&&(x[v]=k[v])}return x},h.apply(this,arguments)}function p(x,S,k){return S=m(S),S in x?Object.defineProperty(x,S,{value:k,enumerable:!0,configurable:!0,writable:!0}):x[S]=k,x}function m(x){var S=g(x,"string");return typeof S=="symbol"?S:String(S)}function g(x,S){if(typeof x!="object"||x===null)return x;var k=x[Symbol.toPrimitive];if(k!==void 0){var v=k.call(x,S||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(x)}class b extends e.Component{static getDerivedStateFromProps(S,k){let{position:v}=S,{prevPropsPosition:N}=k;return v&&(!N||v.x!==N.x||v.y!==N.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:v,prevPropsPosition:N}),{x:v.x,y:v.y,prevPropsPosition:{...v}}):null}constructor(S){super(S),p(this,"onDragStart",(k,v)=>{if((0,c.default)("Draggable: onDragStart: %j",v),this.props.onStart(k,(0,s.createDraggableData)(this,v))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),p(this,"onDrag",(k,v)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",v);const N=(0,s.createDraggableData)(this,v),O={x:N.x,y:N.y,slackX:0,slackY:0};if(this.props.bounds){const{x:_,y:oe}=O;O.x+=this.state.slackX,O.y+=this.state.slackY;const[ge,Ee]=(0,s.getBoundPosition)(this,O.x,O.y);O.x=ge,O.y=Ee,O.slackX=this.state.slackX+(_-O.x),O.slackY=this.state.slackY+(oe-O.y),N.x=O.x,N.y=O.y,N.deltaX=O.x-this.state.x,N.deltaY=O.y-this.state.y}if(this.props.onDrag(k,N)===!1)return!1;this.setState(O)}),p(this,"onDragStop",(k,v)=>{if(!this.state.dragging||this.props.onStop(k,(0,s.createDraggableData)(this,v))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",v);const O={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:_,y:oe}=this.props.position;O.x=_,O.y=oe}this.setState(O)}),this.state={dragging:!1,dragged:!1,x:S.position?S.position.x:S.defaultPosition.x,y:S.position?S.position.y:S.defaultPosition.y,prevPropsPosition:{...S.position},slackX:0,slackY:0,isElementSVG:!1},S.position&&!(S.onDrag||S.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var S,k;return(S=(k=this.props)===null||k===void 0||(k=k.nodeRef)===null||k===void 0?void 0:k.current)!==null&&S!==void 0?S:r.default.findDOMNode(this)}render(){const{axis:S,bounds:k,children:v,defaultPosition:N,defaultClassName:O,defaultClassNameDragging:B,defaultClassNameDragged:_,position:oe,positionOffset:ge,scale:Ee,...ye}=this.props;let pe={},We=null;const Ne=!!!oe||this.state.dragging,ut=oe||N,vt={x:(0,s.canDragX)(this)&&Ne?this.state.x:ut.x,y:(0,s.canDragY)(this)&&Ne?this.state.y:ut.y};this.state.isElementSVG?We=(0,o.createSVGTransform)(vt,ge):pe=(0,o.createCSSTransform)(vt,ge);const M=(0,i.default)(v.props.className||"",O,{[B]:this.state.dragging,[_]:this.state.dragged});return e.createElement(a.default,h({},ye,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(v),{className:M,style:{...v.props.style,...pe},transform:We}))}}n.default=b,p(b,"displayName","Draggable"),p(b,"propTypes",{...a.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:l.dontSetMe,style:l.dontSetMe,transform:l.dontSetMe}),p(b,"defaultProps",{...a.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(zu);const{default:Ku,DraggableCore:cv}=zu;ai.exports=Ku;ai.exports.default=Ku;ai.exports.DraggableCore=cv;var uv=ai.exports,ms={};ms.__esModule=!0;ms.cloneElement=gv;var dv=fv(I);function fv(n){return n&&n.__esModule?n:{default:n}}function Ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Na(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(r){hv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function hv(n,e,t){return e=pv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pv(n){var e=mv(n,"string");return typeof e=="symbol"?e:String(e)}function mv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function gv(n,e){return e.style&&n.props.style&&(e.style=Na(Na({},n.props.style),e.style)),e.className&&n.props.className&&(e.className=n.props.className+" "+e.className),dv.default.cloneElement(n,e)}var nr={};nr.__esModule=!0;nr.resizableProps=void 0;var H=yv(ci);function yv(n){return n&&n.__esModule?n:{default:n}}var bv={axis:H.default.oneOf(["both","x","y","none"]),className:H.default.string,children:H.default.element.isRequired,draggableOpts:H.default.shape({allowAnyClick:H.default.bool,cancel:H.default.string,children:H.default.node,disabled:H.default.bool,enableUserSelectHack:H.default.bool,offsetParent:H.default.node,grid:H.default.arrayOf(H.default.number),handle:H.default.string,nodeRef:H.default.object,onStart:H.default.func,onDrag:H.default.func,onStop:H.default.func,onMouseDown:H.default.func,scale:H.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=t[0];if(i.axis==="both"||i.axis==="y"){var o;return(o=H.default.number).isRequired.apply(o,t)}return H.default.number.apply(H.default,t)},handle:H.default.oneOfType([H.default.node,H.default.func]),handleSize:H.default.arrayOf(H.default.number),lockAspectRatio:H.default.bool,maxConstraints:H.default.arrayOf(H.default.number),minConstraints:H.default.arrayOf(H.default.number),onResizeStop:H.default.func,onResizeStart:H.default.func,onResize:H.default.func,resizeHandles:H.default.arrayOf(H.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:H.default.number,width:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=t[0];if(i.axis==="both"||i.axis==="x"){var o;return(o=H.default.number).isRequired.apply(o,t)}return H.default.number.apply(H.default,t)}};nr.resizableProps=bv;tr.__esModule=!0;tr.default=void 0;var zn=kv(I),vv=uv,xv=ms,Sv=nr,wv=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Ju(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Ju=function(i){return i?t:e})(n)}function kv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Ju(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function Po(){return Po=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Po.apply(this,arguments)}function Cv(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function to(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ma(Object(t),!0).forEach(function(r){Ev(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ev(n,e,t){return e=Nv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nv(n){var e=Mv(n,"string");return typeof e=="symbol"?e:String(e)}function Mv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Tv(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,Io(n,e)}function Io(n,e){return Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Io(n,e)}var gs=function(n){Tv(e,n);function e(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return r=n.call.apply(n,[this].concat(o))||this,r.handleRefs={},r.lastHandleRect=null,r.slack=null,r}var t=e.prototype;return t.componentWillUnmount=function(){this.resetData()},t.resetData=function(){this.lastHandleRect=this.slack=null},t.runConstraints=function(i,o){var s=this.props,l=s.minConstraints,a=s.maxConstraints,c=s.lockAspectRatio;if(!l&&!a&&!c)return[i,o];if(c){var u=this.props.width/this.props.height,d=i-this.props.width,f=o-this.props.height;Math.abs(d)>Math.abs(f*u)?o=i/u:i=o*u}var h=i,p=o,m=this.slack||[0,0],g=m[0],b=m[1];return i+=g,o+=b,l&&(i=Math.max(l[0],i),o=Math.max(l[1],o)),a&&(i=Math.min(a[0],i),o=Math.min(a[1],o)),this.slack=[g+(h-i),b+(p-o)],[i,o]},t.resizeHandler=function(i,o){var s=this;return function(l,a){var c=a.node,u=a.deltaX,d=a.deltaY;i==="onResizeStart"&&s.resetData();var f=(s.props.axis==="both"||s.props.axis==="x")&&o!=="n"&&o!=="s",h=(s.props.axis==="both"||s.props.axis==="y")&&o!=="e"&&o!=="w";if(!(!f&&!h)){var p=o[0],m=o[o.length-1],g=c.getBoundingClientRect();if(s.lastHandleRect!=null){if(m==="w"){var b=g.left-s.lastHandleRect.left;u+=b}if(p==="n"){var x=g.top-s.lastHandleRect.top;d+=x}}s.lastHandleRect=g,m==="w"&&(u=-u),p==="n"&&(d=-d);var S=s.props.width+(f?u/s.props.transformScale:0),k=s.props.height+(h?d/s.props.transformScale:0),v=s.runConstraints(S,k);S=v[0],k=v[1];var N=S!==s.props.width||k!==s.props.height,O=typeof s.props[i]=="function"?s.props[i]:null,B=i==="onResize"&&!N;O&&!B&&(l.persist==null||l.persist(),O(l,{node:c,size:{width:S,height:k},handle:o})),i==="onResizeStop"&&s.resetData()}}},t.renderResizeHandle=function(i,o){var s=this.props.handle;if(!s)return zn.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+i,ref:o});if(typeof s=="function")return s(i,o);var l=typeof s.type=="string",a=to({ref:o},l?{}:{handleAxis:i});return zn.cloneElement(s,a)},t.render=function(){var i=this,o=this.props,s=o.children,l=o.className,a=o.draggableOpts;o.width,o.height,o.handle,o.handleSize,o.lockAspectRatio,o.axis,o.minConstraints,o.maxConstraints,o.onResize,o.onResizeStop,o.onResizeStart;var c=o.resizeHandles;o.transformScale;var u=Cv(o,wv);return(0,xv.cloneElement)(s,to(to({},u),{},{className:(l?l+" ":"")+"react-resizable",children:[].concat(s.props.children,c.map(function(d){var f,h=(f=i.handleRefs[d])!=null?f:i.handleRefs[d]=zn.createRef();return zn.createElement(vv.DraggableCore,Po({},a,{nodeRef:h,key:"resizableHandle-"+d,onStop:i.resizeHandler("onResizeStop",d),onStart:i.resizeHandler("onResizeStart",d),onDrag:i.resizeHandler("onResize",d)}),i.renderResizeHandle(d,h))}))}))},e}(zn.Component);tr.default=gs;gs.propTypes=Sv.resizableProps;gs.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var hi={};hi.__esModule=!0;hi.default=void 0;var no=Pv(I),Ov=Yu(ci),Dv=Yu(tr),Av=nr,Rv=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function Yu(n){return n&&n.__esModule?n:{default:n}}function Gu(n){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Gu=function(i){return i?t:e})(n)}function Pv(n,e){if(n&&n.__esModule)return n;if(n===null||typeof n!="object"&&typeof n!="function")return{default:n};var t=Gu(e);if(t&&t.has(n))return t.get(n);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in n)if(o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)){var s=i?Object.getOwnPropertyDescriptor(n,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=n[o]}return r.default=n,t&&t.set(n,r),r}function _o(){return _o=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},_o.apply(this,arguments)}function Ta(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(r){Iv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Iv(n,e,t){return e=_v(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _v(n){var e=zv(n,"string");return typeof e=="symbol"?e:String(e)}function zv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Lv(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Vv(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,zo(n,e)}function zo(n,e){return zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},zo(n,e)}var Xu=function(n){Vv(e,n);function e(){for(var r,i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return r=n.call.apply(n,[this].concat(o))||this,r.state={width:r.props.width,height:r.props.height,propsWidth:r.props.width,propsHeight:r.props.height},r.onResize=function(l,a){var c=a.size;r.props.onResize?(l.persist==null||l.persist(),r.setState(c,function(){return r.props.onResize&&r.props.onResize(l,a)})):r.setState(c)},r}e.getDerivedStateFromProps=function(i,o){return o.propsWidth!==i.width||o.propsHeight!==i.height?{width:i.width,height:i.height,propsWidth:i.width,propsHeight:i.height}:null};var t=e.prototype;return t.render=function(){var i=this.props,o=i.handle,s=i.handleSize;i.onResize;var l=i.onResizeStart,a=i.onResizeStop,c=i.draggableOpts,u=i.minConstraints,d=i.maxConstraints,f=i.lockAspectRatio,h=i.axis;i.width,i.height;var p=i.resizeHandles,m=i.style,g=i.transformScale,b=Lv(i,Rv);return no.createElement(Dv.default,{axis:h,draggableOpts:c,handle:o,handleSize:s,height:this.state.height,lockAspectRatio:f,maxConstraints:d,minConstraints:u,onResizeStart:l,onResize:this.onResize,onResizeStop:a,resizeHandles:p,transformScale:g,width:this.state.width},no.createElement("div",_o({},b,{style:Wr(Wr({},m),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},e}(no.Component);hi.default=Xu;Xu.propTypes=Wr(Wr({},Av.resizableProps),{},{children:Ov.default.element});us.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")};us.exports.Resizable=tr.default;var Bv=us.exports.ResizableBox=hi.default;const $v=({node:n,updateAttributes:e,editor:t})=>{const[r,i]=I.useState({width:n.attrs.width||300,height:n.attrs.height||300}),[o,s]=I.useState({left:n.attrs.marginLeft||0,right:n.attrs.marginRight||0}),[l,a]=I.useState(n.attrs.src||""),c=I.useRef(null);I.useEffect(()=>{if(n.attrs.src&&c.current){const h=new Image;h.onload=()=>{(!n.attrs.width||!n.attrs.height)&&i({width:h.width>600?600:h.width,height:h.width>600?600/h.width*h.height:h.height})},h.src=n.attrs.src}},[n.attrs.src]);const u=(h,{size:p})=>{i({width:p.width,height:p.height}),e({width:p.width,height:p.height})},d=()=>{e({src:l,width:r.width,height:r.height,marginLeft:o.left,marginRight:o.right})},f=h=>{h.preventDefault()};return w.jsxDEV(bu,{className:"image-wrapper",children:w.jsxDEV(_u,{title:"Image",childrenContent:w.jsxDEV("div",{className:"relative",style:{marginLeft:o.left,marginRight:o.right},onContextMenu:f,children:t.isEditable?w.jsxDEV(Bv,{width:r.width,height:r.height,onResize:u,minConstraints:[100,100],maxConstraints:[800,800],lockAspectRatio:!0,className:"relative",children:w.jsxDEV("img",{ref:c,src:n.attrs.src,alt:"Uploaded",className:"object-contain w-full h-full",draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:89,columnNumber:33},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:80,columnNumber:29},void 0):w.jsxDEV("img",{ref:c,src:n.attrs.src,alt:"Uploaded",style:{width:r.width,height:r.height},className:"object-contain",draggable:!1},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:98,columnNumber:29},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:71,columnNumber:21},void 0),editable:t.isEditable,childrenEdit:w.jsxDEV("div",{className:"space-y-4",children:[w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Image URL"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:116,columnNumber:29},void 0),w.jsxDEV("input",{type:"text",value:l,onChange:h=>a(h.target.value),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:117,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:115,columnNumber:25},void 0),w.jsxDEV("div",{className:"flex gap-2",children:[w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Width"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:128,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:r.width,onChange:h=>i({...r,width:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:129,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:127,columnNumber:29},void 0),w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Height"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:138,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:r.height,onChange:h=>i({...r,height:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:139,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:137,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:126,columnNumber:25},void 0),w.jsxDEV("div",{className:"flex gap-2",children:[w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Margin Left"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:151,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:o.left,onChange:h=>s({...o,left:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:152,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:150,columnNumber:29},void 0),w.jsxDEV("div",{children:[w.jsxDEV("label",{className:"block text-sm font-medium",children:"Margin Right"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:161,columnNumber:33},void 0),w.jsxDEV("input",{type:"number",value:o.right,onChange:h=>s({...o,right:Number(h.target.value)}),className:"w-full p-2 border rounded",disabled:!t.isEditable},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:162,columnNumber:33},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:160,columnNumber:29},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:149,columnNumber:25},void 0),w.jsxDEV("button",{onClick:d,className:"w-full p-2 text-white bg-blue-500 rounded hover:bg-blue-600",disabled:!t.isEditable,children:"Update Image"},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:172,columnNumber:25},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:114,columnNumber:21},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:68,columnNumber:13},void 0)},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/image/image-view.tsx",lineNumber:67,columnNumber:9},void 0)},jv=ce.create({name:"image",group:"block",content:"inline*",atom:!0,draggable:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:300},height:{default:300},marginLeft:{default:0},marginRight:{default:0}}},parseHTML(){return[{tag:"img",getAttrs:n=>n instanceof HTMLElement?{src:n.getAttribute("src"),width:Number(n.getAttribute("width"))||300,height:Number(n.getAttribute("height"))||300,marginLeft:Number(n.getAttribute("marginleft"))||0,marginRight:Number(n.getAttribute("marginright"))||0}:null}]},renderHTML({HTMLAttributes:n}){return["img",ie(n)]},addNodeView(){return vu($v)},addCommands(){return{setImage:n=>({chain:e})=>e().insertContent({type:"image",attrs:n}).run()}}}),Fv=[Zy.configure({types:[Kl.name,Su.name]}),Kl,e0.configure({multicolor:!0}),Xb.configure({bulletList:{keepMarks:!0,keepAttributes:!1},orderedList:{keepMarks:!0,keepAttributes:!1}}),m1,t0,n0,r0,i0.configure({types:["heading","paragraph"]}),o0,l0,u1.configure({resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"table-wrapper"}}),d1,f1,h1.configure({HTMLAttributes:{class:"table-cell"}}),y1,jv],Hv=({content:n="",slotBefore:e=!1,className:t="",editorClassName:r="",editable:i=!0,onChange:o})=>{const[s,l]=I.useState(!1);I.useEffect(()=>{l(!0)},[]);const a=Tg({extensions:Fv,content:n,editable:i,onUpdate:({editor:c})=>{o&&o(c.getHTML())}});return I.useEffect(()=>{a&&n!==a.getHTML()&&a.commands.setContent(n,!1)},[a,n]),!s||!a?null:w.jsxDEV("div",{className:`cyber-editor-container ${t}`,children:[e&&w.jsxDEV(Gy,{editor:a},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:42,columnNumber:28},void 0),w.jsxDEV(bg,{editor:a,className:r},void 0,!1,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:43,columnNumber:13},void 0)]},void 0,!0,{fileName:"E:/CyberSkill/cyber-editor/src/extensions/editor-provider.tsx",lineNumber:41,columnNumber:9},void 0)};exports.CyberEditorProvider=Hv;
243
367
  //# sourceMappingURL=cyber-editor.cjs.js.map