2025-08-27 20:20:03 +03:30
import { _ as Bc } from "./bZLhHpjY.js" ; import { B as zc } from "./CLgN2r-F.js" ; import { _ as Fc } from "./B8AwamLT.js" ; import { d as Ui , ed as $c , h as Vc , r as Wt , be as Hc , ad as yi , I as D , aY as jc , e as rl , dm as Wc , ee as _c , a0 as il , k as ge , y as Kc , z as sl , A as ue , C as I , au as Uc , a3 as ye , D as P , E as G , K as qc , H as Jc , o as Gc , F as Yc , T as Wr , B as Is , ai as Rs , Q as Ps } from "./BAjARngS.js" ; import { B as _r } from "./B7wqwN_w.js" ; import { I as Xc } from "./BfAmxrMI.js" ; import { B as Qc } from "./DlKYmSOP.js" ; import { B as Zc } from "./DplKu3xL.js" ; import { g as eu , u as tu , c as nu } from "./Cby349sk.js" ; import "./BN9g1uF7.js" ; import { a as ru } from "./BpD_6mz8.js" ; import { _ as ol } from "./DlAUqK2U.js" ; import { F as iu } from "./Lb6ve5HJ.js" ; import { _ as su } from "./BSFNXxy5.js" ; function ee ( n ){ this . content = n } ee . prototype = { constructor : ee , find : function ( n ){ for ( var e = 0 ; e < this . content . length ; e += 2 ) if ( this . content [ e ] === n ) return e ; return - 1 }, get : function ( n ){ var e = this . find ( n ); return e ==- 1 ? void 0 : this . content [ e + 1 ]}, update : function ( n , e , t ){ var r = t && t != n ? this . remove ( t ) : this , i = r . find ( n ), s = r . content . slice (); return i ==- 1 ? s . push ( t || n , e ) : ( s [ i + 1 ] = e , t && ( s [ i ] = t )), new ee ( s )}, remove : function ( n ){ var e = this . find ( n ); if ( e ==- 1 ) return this ; var t = this . content . slice (); return t . splice ( e , 2 ), new ee ( t )}, addToStart : function ( n , e ){ return new ee ([ n , e ]. concat ( this . remove ( n ). content ))}, addToEnd : function ( n , e ){ var t = this . remove ( n ). content . slice (); return t . push ( n , e ), new ee ( t )}, addBefore : function ( n , e , t ){ var r = this . remove ( e ), i = r . content . slice (), s = r . find ( n ); return i . splice ( s ==- 1 ? i . length : s , 0 , e , t ), new ee ( 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 = ee . from ( n ), n . size ? new ee ( n . content . concat ( this . subtract ( n ). content )) : this }, append : function ( n ){ return n = ee . from ( n ), n . size ? new ee ( this . subtract ( n ). content . concat ( n . content )) : this }, subtract : function ( n ){ var e = this ; n = ee . 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 }}; ee . from = function ( n ){ if ( n instanceof ee ) return n ; var e = []; if ( n ) for ( var t in n ) e . push ( t , n [ t ]); return new ee ( e )}; function ll ( n , e , t ){ for ( let r = 0 ;; r ++ ){ if ( r == n . childCount || r == e . childCount ) return n . childCount == e . childCount ? null : t ; let i = n . child ( r ), s = e . child ( r ); if ( i == s ){ t += i . nodeSize ; continue } if ( ! i . sameMarkup ( s )) return t ; if ( i . isText && i . text != s . text ){ for ( let o = 0 ; i . text [ o ] == s . text [ o ]; o ++ ) t ++ ; return t } if ( i . content . size || s . content . size ){ let o = ll ( i . content , s . content , t + 1 ); if ( o != null ) return o } t += i . nodeSize }} function al ( n , e , t , r ){ for ( let i = n . childCount , s = e . childCount ;;){ if ( i == 0 || s == 0 ) return i == s ? null : { a : t , b : r }; let o = n . child ( -- i ), l = e . child ( -- s ), a = o . nodeSize ; if ( o == l ){ t -= a , r -= a ; continue } if ( ! o . sameMarkup ( l )) return { a : t , b : r }; if ( o . isText && o . text != l . text ){ let c = 0 , u = Math . min ( o . text . length , l . text . length ); for (; c < u && o . text [ o . text . length - c - 1 ] == l . text [ l . text . length - c - 1 ];) c ++ , t -- , r -- ; return { a : t , b : r }} if ( o . content . size || l . content . size ){ let c = al ( o . content , l . content , t - 1 , r - 1 ); if ( c ) return c } t -= a , r -= a }} class b { constructor ( e , t ){ if ( this . content = e , this . size = t || 0 , t == null ) for ( let r = 0 ; r < e . length ; r ++ ) this . size += e [ r ]. nodeSize } nodesBetween ( e , t , r , i = 0 , s ){ for ( let o = 0 , l = 0 ; l < t ; o ++ ){ let a = this . content [ o ], c = l + a . nodeSize ; if ( c > e && r ( a , i + l , s || null , o ) !==! 1 && a . content . size ){ let u = l + 1 ; a . nodesBetween ( Math . max ( 0 , e - u ), Math . min ( a . content . size , t - u ), r , i + u )} l = c }} descendants ( e ){ this . nodesBetween ( 0 , this . size , e )} textBetween ( e , t , r , i ){ let s = "" , o =! 0 ; return this . nodesBetween ( e , t ,( l , a )=>{ let c = l . isText ? l . text . slice ( Math . max ( e , a ) - a , t - a ) : l . isLeaf ? i ? typeof i == "function" ? i ( l ) : i : l . type . spec . leafText ? l . type . spec . leafText ( l ) : "" : "" ; l . isBlock && ( l . isLeaf && c || l . isTextblock ) && r && ( o ? o =! 1 : s += r ), s += c }, 0 ), s } append ( e ){ if ( ! e . size ) return this ; if ( ! this . size ) return e ; let t = this . lastChild , r = e . firstChild , i = this . content . slice (), s = 0 ; for ( t . isText && t . sameMarkup ( r ) && ( i [ i . length - 1 ] = t . withText ( t . text + r . text ), s = 1 ); s < e . content . length ; s ++ ) i . push ( e . content [ s ]); return new b ( i , this . size + e . size )} cut ( e , t = this . size ){ if ( e == 0 && t == this . size ) return this ; let r = [], i = 0 ; if ( t > e ) for ( let s = 0 , o = 0 ; o < t ; s ++ ){ let l = this . content [ s ]
2025-08-19 21:38:30 +03:30
`)}}gt.empty=new gt(!0);class du{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 ml(n){let e=[];do e.push(fu(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function fu(n){let e=[];do e.push(hu(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function hu(n){let e=gu(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=pu(n,e);else break;return e}function Bs(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function pu(n,e){let t=Bs(n),r=t;return n.eat(",")&&(n.next!="}"?r=Bs(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function mu(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function gu(n){if(n.eat("(")){let e=ml(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=mu(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 yu(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function gl(n,e){return e-n}function zs(n,e){let t=[];return r(e),t.sort(gl);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}}function bu(n){let e=Object.create(null);return t(zs(n,0));function t(r){let i=[];r.forEach(o=>{n[o].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]);zs(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new gt(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(gl);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function ku(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function yl(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 bl(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function kl(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 s=n[i];s.validate&&s.validate(e[i])}}function xl
` ); 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 ], l = e . previousSibling ;( ! o || l && l . nodeName == "BR" || o . isText && /[ \t\r\n\u000c]$/ . test ( o . text )) && ( r = r . slice ( 1 ))} r && this . insertNode ( this . parser . schema . text ( r ), t , ! /\S/ . test ( r )), this . findInText ( e )} else this . findInside ( e )} addElement ( e , t , r ){ let i = this . localPreserveWS , s = this . top ;( e . tagName == "PRE" || /pre/ . test ( e . style && e . style . whiteSpace )) && ( this . localPreserveWS =! 0 ); let o = e . nodeName . toLowerCase (), l ; wl . hasOwnProperty ( o ) && this . parser . normalizeLists && vu ( e ); let a = this . options . ruleFromNode && this . options . ruleFromNode ( e ) || ( l = this . parser . matchTag ( e , this , r )); e : if ( a ? a . ignore : wu . hasOwnProperty ( o )) this . findInside ( e ), this . ignoreFallback ( e , t ); else if ( ! a || a . skip || a . closeParent ){ a && a . closeParent ? this . open = Math . max ( 0 , this . open - 1 ) : a && a . skip . nodeType && ( e = a . skip ); let c , u = this . needsBlock ; if ( Ml . hasOwnProperty ( o )) s . content . length && s . content [ 0 ]. isInline && this . open && ( this . open -- , s = this . top ), c =! 0 , s . type || ( this . needsBlock =! 0 ); else if ( ! e . firstChild ){ this . leafFallback ( e , t ); break e } let d = a && a . skip ? t : this . readStyles ( e , t ); d && this . addAll ( e , d ), c && this . sync ( s ), this . needsBlock = u } else { let c = this . readStyles ( e , t ); c && this . addElementByRule ( e , a , c , a . consuming ===! 1 ? l : void 0 )} this . localPreserveWS = i } leafFallback ( e , t ){ e . nodeName == "BR" && this . top . type && this . top . type . inlineContent && this . addTextNode ( e . ownerDocument . createTextNode ( `
` ), t )} ignoreFallback ( e , t ){ e . nodeName == "BR" && ( ! this . top . type ||! this . top . type . inlineContent ) && this . findPlace ( this . parser . schema . text ( "-" ), t , ! 0 )} readStyles ( e , t ){ let r = e . style ; if ( r && r . length ) for ( let i = 0 ; i < this . parser . matchedStyles . length ; i ++ ){ let s = this . parser . matchedStyles [ i ], o = r . getPropertyValue ( s ); if ( o ) for ( let l = void 0 ;;){ let a = this . parser . matchStyle ( s , o , 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 s , o ; if ( t . node ) if ( o = this . parser . schema . nodes [ t . node ], o . isLeaf ) this . insertNode ( o . create ( t . attrs ), r , e . nodeName == "BR" ) || this . leafFallback ( e , r ); else { let a = this . enter ( o , t . attrs || null , r , t . preserveWhitespace ); a && ( s =! 0 , r = a )} else { let a = this . parser . schema . marks [ t . mark ]; r = r . concat ( a . create ( t . attrs ))} let l = this . top ; if ( o && o . 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 , ! 1 )); 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 )} s && this . sync ( l ) && this . open -- } addAll ( e , t , r , i ){ let s = r || 0 ; for ( let o = r ? e . childNodes [ r ] : e . firstChild , l = i == null ? null : e . childNodes [ i ]; o != l ; o = o . nextSibling , ++ s ) this . findAtPoint ( e , s ), this . addDOM ( o , t ); this . findAtPoint ( e , s )} findPlace ( e , t , r ){ let i , s ; for ( let o = this . open , l = 0 ; o >= 0 ; o -- ){ let a = this . nodes [ o ], c = a . findWrapping ( e ); if ( c && ( ! i || i . length > c . length + l ) && ( i = c , s = a , ! c . length )) break ; if ( a . solid ){ if ( r ) break ; l += 2 }} if ( ! i ) return null ; this . sync ( s ); for ( let o = 0 ; o < i . length ; o ++ ) t = this . enterInner ( i [ o ], null , t , ! 1 ); return t } insertNode ( e , t , r ){ if ( e . isInline && this . needsBlock &&! this . top . type ){ let s = this . textblockFromContext (); s && ( t = this . enterInner ( s , null , t ))} let i = this . findPlace ( e , t , r ); if ( i ){ this . closeExtra (); let s = this . top ; s . match && ( s . match = s . match . matchType ( e . type )); let o = B . none ; for ( let l of i . concat ( e . marks ))( s . type ? s . type . allowsMarkType ( l . type ) : Ws ( l . type , e . type )) && ( o = l . addToSet ( o )); return s . content . push ( e . mark ( o )), ! 0 } return ! 1 } enter ( e , t , r , i ){ let s = this . findPlace ( e . create ( t ), r , ! 1 ); return s && ( s = this . enterInner ( e , t , r , ! 0 , i )), s } enterInner ( e , t , r , i =! 1 , s ){ this . closeExtra (); let o = this . top ; o . match = o . match && o . match . matchType ( e ); let l = Vs ( e , s , o . options ); o . options & Gt && o . content . length == 0 && ( l |= Gt ); let a = B . none ; return r = r . filter ( c =>( o . type ? o . type . allowsMarkType ( c . type ) : Ws ( c . type , e )) ? ( a = c . addToSet ( a ), ! 1 ) :! 0 ), this . nodes . push ( new Mn ( 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 ; this . localPreserveWS && ( this . nodes [ t ]. options |= on )} 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 .
`))}})}function $u(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Vu(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new X(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new S(b.from(o),0,0),1,!0))}function Fe(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;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(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Hu(n,e,t=1,r){let i=n.doc.resolve(e),s=b.empty,o=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=b.from(i.node(l).copy(s));let u=r&&r[c];o=b.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new Y(e,e,new S(s.append(o),t,t),!0))}function rt(n,e){let t=n.resolve(e),r=t.index();return Il(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function ju(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 s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Il(n,e){return!!(n&&e&&!n.isLeaf&&ju(n,e))}function Er(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Il(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Wu(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.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);Dl(n,u.node(),u.before(),l)}o.inlineContent&&Ji(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new Y(c,a.map(e+t,-1),S.empty,!0)),r===!0){let u=n.doc.resolve(c);Nl(n,u.node(),u.before(),n.steps.length)}return n}function _u(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Rl(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==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(o+1):r.after(o+1)}return null}function Ar(n,e,t=e,r=S.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Pl(i,s,r)?new Y(e,t,r):new Ku(i,s,r).fit()}function Pl(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ku{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.pu
` ), 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 y = m . pmViewDesc ; if ( y && y . node && y . node . isBlock ) break }} else { let m = h . childNodes [ p - 1 ]; d = m && ( m . nodeName == "BR" || m . contentEditable == "false" )}} if ( Te && 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 && le ) && bt ( l . node , l . offset , u . anchorNode , u . anchorOffset ) && bt ( 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 s = this . children [ i ], o = r + s . size ; if ( r == o ? e <= o && t >= r : e < o && t > r ){ let l = r + s . border , a = o - s . border ; if ( e >= l && t <= a ){ this . dirty = e == r || t == o ? lt : lo , e == l && t == a && ( s . contentLost || s . dom . parentNode != this . contentDOM ) ? s . dirty = De : s . markDirty ( e - l , t - l ); return } else s . dirty = s . dom == s . contentDOM && s . dom . parentNode == this . contentDOM &&! s . children . length ? lt : De } r = o } this . dirty = lt } markParentsDirty (){ let e = 1 ; for ( let t = this . parent ; t ; t = t . parent , e ++ ){ let r = e == 1 ? lt : lo ; t . dirty < r && ( t . dirty = r )}} get domAtom (){ return ! 1 } get ignoreForCoords (){ return ! 1 } get ignoreForSelection (){ return ! 1 } isText ( e ){ return ! 1 }} class Gl extends bn { constructor ( e , t , r , i ){ let s , o = t . type . toDOM ; if ( typeof o == "function" && ( o = o ( r ,()=>{ if ( ! s ) return i ; if ( s . parent ) return s . parent . posBeforeChild ( s )})), ! t . type . spec . raw ){ if ( o . nodeType != 1 ){ let l = document . createElement ( "span" ); l . appendChild ( o ), o = l } o . contentEditable = "false" , o . classList . add ( "ProseMirror-widget" )} super ( e ,[], o , null ), this . widget = t , this . widget = t , s = this } matchesWidget ( e ){ return this . dirty == Ce && 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 ignoreForSelection (){ return !! this . widget . type . spec . relaxedSide } get side (){ return this . widget . type . side }} class vd extends bn { 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 kt extends bn { constructor ( e , t , r , i , s ){ super ( e ,[], r , i ), this . mark = t , this . spec = s } static create ( e , t , r , i ){ let s = i . nodeViews [ t . type . name ], o = s && s ( t , i , r ); return ( ! o ||! o . dom ) && ( o = St . renderSpec ( document , t . type . spec . toDOM ( t , r ), null , t . attrs )), new kt ( e , t , o . dom , o . contentDOM || o . dom , o )} parseRule (){ return this . dirty & De || this . mark . type . spec . reparseInView ? null : { mark : this . mark . type . name , attrs : this . mark . attrs , contentElement : this . contentDOM }} matchesMark ( e ){ return this . dirty != De && this . mark . eq ( e )} markDirty ( e , t ){ if ( super . markDirty ( e , t ), this . dirty != Ce ){ let r = this . parent ; for (; ! r . node ;) r = r . parent ; r . dirty < this . dirty && ( r . dirty = this . dirty ), this . dirty = Ce }} slice ( e , t , r ){ let i = kt . create ( this . parent , this . mark , ! 0 , r ), s = this . children , o = this . size ; t < o && ( s = Ai ( s , t , o , r )), e > 0 && ( s = Ai ( s , 0 , e , r )); for ( let l = 0 ; l < s . length ; l ++ ) s [ l ]. parent = i ; return i . children = s , i } ignoreMutation ( e ){ return this . spec . ignoreMutation ? this . spec . ignoreMutation ( e ) : super . ignoreMutation ( e )} destroy (){ this . spec . destroy && this . spec . destroy (), super . destroy ()}} class Ze extends bn { constructor ( e , t , r , i , s , o , l , a , c ){ super ( e ,[], s , o ), this . node = t , this . outerDeco = r , this . innerDeco = i , this . nodeDOM = l } static create ( e , t , r , i , s , o ){ let l = s . nodeViews [ t . type . name ], a , c = l && l ( t , s ,()=>{ if ( ! a ) return o ; 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
`);return{dom:a,text:f,slice:e}}function ia(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return e?new S(b.from(n.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0):S.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=St.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=qd(t),yn&&Jd(o);let c=o&&o.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=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Xe.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!_d.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Gd(So(l,+u[1],+u[2]),u[4]);else if(l=S.maxOpen(Kd(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=So(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n)}),l}const _d=/^(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 Kd(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)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&oa(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=la(o[o.length-1],s.length));let u=sa(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return b.from(o)}return n}function sa(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function oa(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=oa(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(b.from(sa(t,n,i+1))))}}function la(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,la(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(b.empty,!0);return n.copy(t.append(r))}function Di(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=Di(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function So(n,e,t){return e<n.openStart&&(n=new S(Di(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new S(Di(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const aa={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 Co=null;function ca(){return Co||(Co=document.implementation.createHTMLDocument("title"))}let ti=null;function Ud(n){let e=window.trustedTypes;return e?(ti||(ti=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ti.createHTML(n)):n}function qd(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ca().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&aa[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Ud(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Jd(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 Gd(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:s,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i
` ). scrollIntoView ()), ! 0 )}; function us ( 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 Gf = ( 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 ), s = t . indexAfter ( - 1 ), o = us ( i . contentMatchAt ( s )); if ( ! o ||! i . canReplaceWith ( s , s , o )) return ! 1 ; if ( e ){ let l = t . after (), a = n . tr . replaceWith ( l , l , o . createAndFill ()); a . setSelection ( O . near ( a . doc . resolve ( l ), 1 )), e ( a . scrollIntoView ())} return ! 0 }, Na = ( n , e )=>{ let t = n . selection ,{ $from : r , $to : i } = t ; if ( t instanceof me || r . parent . inlineContent || i . parent . inlineContent ) return ! 1 ; let s = us ( i . parent . contentMatchAt ( i . indexAfter ())); if ( ! s ||! s . isTextblock ) return ! 1 ; if ( e ){ let o = ( ! r . parentOffset && i . index () < i . parent . childCount ? r : i ). pos , l = n . tr . insert ( o , s . createAndFill ()); l . setSelection ( A . create ( l . doc , o + 1 )), e ( l . scrollIntoView ())} return ! 0 }, Da = ( 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 s = t . before (); if ( Fe ( n . doc , s )) return e && e ( n . tr . split ( s ). scrollIntoView ()), ! 0 } let r = t . blockRange (), i = r && $t ( r ); return i == null ?! 1 : ( e && e ( n . tr . lift ( r , i ). scrollIntoView ()), ! 0 )}; function Yf ( n ){ return ( e , t )=>{ let { $from : r , $to : i } = e . selection ; if ( e . selection instanceof M && e . selection . node . isBlock ) return ! r . parentOffset ||! Fe ( e . doc , r . pos ) ?! 1 : ( t && t ( e . tr . split ( r . pos ). scrollIntoView ()), ! 0 ); if ( ! r . depth ) return ! 1 ; let s = [], o , 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 = us ( r . node ( h - 1 ). contentMatchAt ( r . indexAfter ( h - 1 ))), s . unshift ( a && l ? { type : l } : null ), o = h ; break } else { if ( h == 1 ) return ! 1 ; s . unshift ( null )} let u = e . tr ;( e . selection instanceof A || e . selection instanceof me ) && u . deleteSelection (); let d = u . mapping . map ( r . pos ), f = Fe ( u . doc , d , s . length , s ); if ( f || ( s [ 0 ] = l ? { type : l } : null , f = Fe ( u . doc , d , s . length , s )), ! f ) return ! 1 ; if ( u . split ( d , s . length , s ), ! a && c && r . node ( o ). type != l ){ let h = u . mapping . map ( r . before ( o )), p = u . doc . resolve ( h ); l && r . node ( o - 1 ). canReplaceWith ( p . index (), p . index () + 1 , l ) && u . setNodeMarkup ( u . mapping . map ( r . before ( o )), l )} return t && t ( u . scrollIntoView ()), ! 0 }} const Xf = Yf (), Qf = ( n , e )=>{ let { $from : t , to : r } = n . selection , i , s = t . sharedDepth ( r ); return s == 0 ?! 1 : ( i = t . before ( s ), e && e ( n . tr . setSelection ( M . create ( n . doc , i ))), ! 0 )}; function Zf ( n , e , t ){ let r = e . nodeBefore , i = e . nodeAfter , s = e . index (); return ! r ||! i ||! r . type . compatibleContent ( i . type ) ?! 1 :! r . content . size && e . parent . canReplace ( s - 1 , s ) ? ( t && t ( n . tr . delete ( e . pos - r . nodeSize , e . pos ). scrollIntoView ()), ! 0 ) :! e . parent . canReplace ( s , s + 1 ) ||! ( i . isTextblock || rt ( n . doc , e . pos )) ?! 1 : ( t && t ( n . tr . join ( e . pos ). scrollIntoView ()), ! 0 )} function Ia ( n , e , t , r ){ let i = e . nodeBefore , s = e . nodeAfter , o , l , a = i . type . spec . isolating || s . type . spec . isolating ; if ( ! a && Zf ( n , e , t )) return ! 0 ; let c =! a && e . parent . canReplace ( e . index (), e . index () + 1 ); if ( c && ( o = ( l = i . contentMatchAt ( i . childCount )). findWrapping ( s . type )) && l . matchType ( o [ 0 ] || s . type ). validEnd ){ if ( t ){ let h = e . pos + s . nodeSize , p = b . empty ; for ( let y = o . length - 1 ; y >= 0 ; y -- ) p = b . from ( o [ y ]. create ( null , p )); p = b . from ( i . copy ( p )); let m = n . tr . step ( new X ( e . pos - 1 , h , e . pos , h , new S ( p , 1 , 0 ), o . length , ! 0 )), g = m . doc . resolve ( h + 2 * o . length ); g . nodeAfter && g . nodeAfter . type == i . type && rt ( m . doc , g . pos ) && m . join ( g . pos ), t ( m . scrollIntoView ())} return ! 0 } let u = s . type . spec . isolating || r > 0 && a ? null : O . findFrom ( e , 1 ), d = u && u . $from . blockRange ( u . $to ), f = d && $t ( d ); if ( f != null && f >= e . depth ) return t && t ( n . tr . lift ( d , f ). scrollIntoView ()), ! 0 ; if ( c && Bt ( s , "start" , ! 0 ) && Bt ( i , "end" )){ let h = i , p = []; for (; p . push ( h ), ! h . isTextblock ;) h = h . lastChild ; let m = s , g = 1 ; for (; ! m . isTextblock ; m = m . firstChild ) g ++ ; if ( h . canReplace ( h . childCount , h . childCount , m . content )){ if ( t ){ let y = b . empty ; for ( let w = p . length - 1 ; w >= 0 ; w -- ) y = b . from ( p [ w ]. copy ( y )); let x = n . tr . step ( new X ( e . pos - p . length , e . pos + s . nodeSize , e . pos + g , e . pos + s . nodeSize - g , new S ( y , p . length , 0 ), 0 , ! 0 )); t ( x . scrollIntoView ())} return ! 0 }} return ! 1 } function Ra ( n ){ return function ( e , t ){ let r = e . selection , i = n < 0 ? r . $from : r . $to , s = i . depth ; for (; i . node ( s ). isInline ;){ if ( ! s ) return ! 1 ; s -- } return i . node ( s ). isTextblock ? ( t && t ( e . tr . setSelection ( A . create ( e . doc , n < 0 ? i . start ( s ) : i . end ( s )))), ! 0 ) :! 1 }} const eh = Ra ( - 1 ), th = Ra ( 1 ); function nh ( n , e = null ){ return function ( t , r ){ let { $from : i , $to : s
`,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,i,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=s);const h=o?.[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?.text)==null?void 0:f.slice(Math.max(r,c)-c,i-c))}),l}function kh(n,e){const t={from:0,to:n.content.size};return Va(n,t,e)}function Ha(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Ve(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}function ja(n,e){const t=Ve(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function q(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 xh(n,e){const t=q(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function Br(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Wa(n,e){const t=Br(typeof e=="string"?e:e.name,n.schema);return t==="node"?xh(n,e):t==="mark"?ja(n,e):{}}function Sh(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Ch(n){const e=Sh(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function _a(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),u=e.slice(s).map(a),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),Ch(r)}function ms(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Yn(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:ms(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function Ka(n,e,t={}){return n.find(r=>r.type===e&&Yn(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function zo(n,e,t={}){return!!Ka(n,e,t)}function gs(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?void 0:r.attrs),!Ka([...i.node.marks],e,t)))return;let o=i.index,l=n.start()+i.offset,a=o+1,c=l+i.node.nodeSize;for(;o>0&&zo([...n.parent.child(o-1).marks],e,t);)o-=1,l-=n.parent.child(o).nodeSize;for(;a<n.parent.childCount&&zo([...n.parent.child(a).marks],e,t);)c+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function ys(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=gs(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var Mh=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const l=i.node(s);l?.type.name===e?o=l:s-=1}return[o,s]};function oi(n,e){return e.nodes[n]||e.marks[n]||null}function Ln(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var wh=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;const u=((c=(a=i.type.spec).toText)==null?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-s))}),t};function Pi(n,e,t={
` , rules : t , plugin : r }) :! 1 }}, isInputRules :! 0 }); return r } function Dh ( n ){ return Object . prototype . toString . call ( n ). slice ( 8 , - 1 )} function En ( n ){ return Dh ( n ) !== "Object" ?! 1 : n . constructor === Object && Object . getPrototypeOf ( n ) === Object . prototype } function Ga ( n , e ){ const t = {... n }; return En ( n ) && En ( e ) && Object . keys ( e ). forEach ( r =>{ En ( e [ r ]) && En ( n [ r ]) ? t [ r ] = Ga ( n [ r ], e [ r ]) : t [ r ] = e [ r ]}), t } var bs = class { constructor ( n = {}){ this . type = "extendable" , this . parent = null , this . child = null , this . name = "" , this . config = { name : this . name }, this . config = {... this . config ,... n }, this . name = this . config . name } get options (){ return {... R ( C ( this , "addOptions" ,{ name : this . name })) || {}}} get storage (){ return {... R ( C ( this , "addStorage" ,{ name : this . name , options : this . options })) || {}}} configure ( n = {}){ const e = this . extend ({... this . config , addOptions : ()=> Ga ( this . options , n )}); return e . name = this . name , e . parent = this . parent , e } extend ( n = {}){ const e = new this . constructor ({... this . config ,... n }); return e . parent = this , this . child = e , e . name = "name" in n ? n . name : e . parent . name , e }}, Ct = class Ya extends bs { constructor (){ super (... arguments ), this . type = "mark" } static create ( e = {}){ const t = typeof e == "function" ? e () : e ; return new Ya ( t )} static handleExit ({ editor : e , mark : t }){ const { tr : r } = e . state , i = e . state . selection . $from ; if ( i . pos === i . end ()){ const o = i . marks (); if ( !!! o . find ( c => c ? . type . name === t . name )) return ! 1 ; const a = o . find ( c => c ? . type . name === t . name ); return a && r . removeStoredMark ( a ), r . insertText ( " " , i . pos ), e . view . dispatch ( r ), ! 0 } return ! 1 } configure ( e ){ return super . configure ( e )} extend ( e ){ const t = typeof e == "function" ? e () : e ; return super . extend ( t )}}; function Ih ( n ){ return typeof n == "number" } var Rh = class { constructor ( n ){ this . find = n . find , this . handler = n . handler }}, Ph = ( n , e , t )=>{ if ( ms ( e )) return [... n . matchAll ( e )]; const r = e ( n , t ); return r ? r . map ( i =>{ const s = [ i . text ]; return s . index = i . index , s . input = n , s . data = i . data , i . replaceWith && ( i . text . includes ( i . replaceWith ) || console . warn ( '[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".' ), s . push ( i . replaceWith )), s }) : []}; function Lh ( n ){ const { editor : e , state : t , from : r , to : i , rule : s , pasteEvent : o , dropEvent : l } = n ,{ commands : a , chain : c , can : u } = new Pr ({ 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 ), y = h . textBetween ( m - p , g - p , void 0 , " " ); Ph ( y , s . find , o ). forEach ( w =>{ if ( w . index === void 0 ) return ; const E = m + w . index + 1 , v = E + w [ 0 ]. length , L = { from : t . tr . mapping . map ( E ), to : t . tr . mapping . map ( v )}, F = s . handler ({ state : t , range : L , match : w , commands : a , chain : c , can : u , pasteEvent : o , dropEvent : l }); d . push ( F )})}), d . every ( h => h !== null )} var An = null , Bh = n =>{ var e ; const t = new ClipboardEvent ( "paste" ,{ clipboardData : new DataTransfer }); return ( e = t . clipboardData ) == null || e . setData ( "text/html" , n ), t }; function zh ( n ){ const { editor : e , rules : t } = n ; let r = null , i =! 1 , s =! 1 , o = 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 = Rr ({ state : u , transaction : m }); if ( ! ( ! Lh ({ 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 o = typeof ClipboardEvent < "u" ? new ClipboardEvent ( "paste" ) : null , m }}; return t . map ( u => new W ({ view ( d ){ const f = p =>{ var m ; r = ( m = d . dom . parentElement ) != null && m . contains ( p . target ) ? d . dom . parentElement : null , r && ( An = e )}, h = ()=>{ An && ( An = 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 ( s = r === d . dom . parentElement , l = f , ! s ){ const h = An ; h ? . isEditable && 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 ? void 0 : h . getData ( "text/html" ); return o = f , i =!! 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" &&! s , y = p . getMeta ( "applyPasteRules" ), x =!! y ; if ( ! m &&! g &&! x )
position : relative ;
}
. ProseMirror {
word - wrap : break - word ;
white - space : pre - wrap ;
white - space : break - spaces ;
- webkit - font - variant - ligatures : none ;
font - variant - ligatures : none ;
font - feature - settings : "liga" 0 ; /* the above doesn't seem to work in Edge */
}
. ProseMirror [ contenteditable = "false" ] {
white - space : normal ;
}
. ProseMirror [ contenteditable = "false" ] [ contenteditable = "true" ] {
white - space : pre - wrap ;
}
. ProseMirror pre {
white - space : pre - wrap ;
}
img . ProseMirror - separator {
display : inline ! important ;
border : none ! important ;
margin : 0 ! important ;
width : 0 ! important ;
height : 0 ! important ;
}
. ProseMirror - gapcursor {
display : none ;
pointer - events : none ;
position : absolute ;
margin : 0 ;
}
. ProseMirror - gapcursor : after {
content : "" ;
display : block ;
position : absolute ;
top : - 2 px ;
width : 20 px ;
border - top : 1 px solid black ;
animation : ProseMirror - cursor - blink 1.1 s steps ( 2 , start ) infinite ;
}
@ keyframes ProseMirror - cursor - blink {
to {
visibility : hidden ;
}
}
. ProseMirror - hideselection *:: selection {
background : transparent ;
}
. ProseMirror - hideselection *::- moz - selection {
background : transparent ;
}
. ProseMirror - hideselection * {
caret - color : transparent ;
}
. ProseMirror - focused . ProseMirror - gapcursor {
display : block ;
} `;function Gp(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}var Yp=class extends dh{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>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.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:i,slice:s,moved:o})=>this.options.onDrop(i,s,o)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=Ja(t,this.options.autofocus);this.editorState=Nt.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null}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&&typeof document<"u"&&(this.css=Gp(Jp,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!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,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.editorState=this.state.apply(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(` [ tiptap error ] : The editor view is not available . Cannot access view [ '${t}' ]. The editor may not be mounted yet . `)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=za(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.up
` , textSerializers : r = {}} = e || {}; return kh ( this . state . doc ,{ blockSeparator : t , textSerializers : {... Ha ( this . schema ),... r }})} get isEmpty (){ return zr ( this . state . doc )} destroy (){ this . emit ( "destroy" ), this . unmount (), this . removeAllListeners ()} get isDestroyed (){ var e , t ; return ( t = ( e = this . editorView ) == null ? void 0 : e . isDestroyed ) != null ? t :! 0 } $node ( e , t ){ var r ; return (( r = this . $doc ) == null ? void 0 : r . querySelector ( e , t )) || null } $nodes ( e , t ){ var r ; return (( r = this . $doc ) == null ? void 0 : r . querySelectorAll ( e , t )) || null } $pos ( e ){ const t = this . state . doc . resolve ( e ); return new qp ( t , this )} get $doc (){ return this . $pos ( 0 )}}; function zt ( n ){ return new Fr ({ find : n . find , handler : ({ state : e , range : t , match : r })=>{ const i = R ( n . getAttributes , void 0 , r ); if ( i ===! 1 || i === null ) return null ; const { tr : s } = e , o = r [ r . length - 1 ], l = r [ 0 ]; if ( o ){ const a = l . search ( /\S/ ), c = t . from + l . indexOf ( o ), u = c + o . length ; if ( ys ( 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 && s . delete ( u , t . to ), c > t . from && s . delete ( t . from + a , c ); const f = t . from + a + o . length ; s . addMark ( t . from + a , f , n . type . create ( i || {})), s . removeStoredMark ( n . type )}}})} function uc ( n ){ return new Fr ({ find : n . find , handler : ({ state : e , range : t , match : r })=>{ const i = R ( n . getAttributes , void 0 , r ) || {},{ tr : s } = e , o = t . from ; let l = t . to ; const a = n . type . create ( i ); if ( r [ 1 ]){ const c = r [ 0 ]. lastIndexOf ( r [ 1 ]); let u = o + c ; u > l ? u = l : l = u + r [ 1 ]. length ; const d = r [ 0 ][ r [ 0 ]. length - 1 ]; s . insertText ( d , o + r [ 0 ]. length - 1 ), s . replaceWith ( u , l , a )} else if ( r [ 0 ]){ const c = n . type . isInline ? o : o - 1 ; s . insert ( c , n . type . create ( i )). delete ( s . mapping . map ( o ), s . mapping . map ( l ))} s . scrollIntoView ()}})} function Li ( n ){ return new Fr ({ find : n . find , handler : ({ state : e , range : t , match : r })=>{ const i = e . doc . resolve ( t . from ), s = R ( 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 , s )}})} function Ft ( n ){ return new Fr ({ find : n . find , handler : ({ state : e , range : t , match : r , chain : i })=>{ const s = R ( n . getAttributes , void 0 , r ) || {}, o = e . tr . delete ( t . from , t . to ), a = o . doc . resolve ( t . from ). blockRange (), c = a && Gi ( a , n . type , s ); if ( ! c ) return null ; if ( o . 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 )); o . ensureMarks ( m )}} if ( n . keepAttributes ){ const d = n . type . name === "bulletList" || n . type . name === "orderedList" ? "listItem" : "taskList" ; i (). updateAttributes ( d , s ). run ()} const u = o . doc . resolve ( t . from - 1 ). nodeBefore ; u && u . type === n . type && rt ( o . doc , t . from - 1 ) && ( ! n . joinPredicate || n . joinPredicate ( r , u )) && o . join ( t . from - 1 )}})} function Xp ( n , e ){ const { selection : t } = n ,{ $from : r } = t ; if ( t instanceof M ){ const s = r . index (); return r . parent . canReplaceWith ( s , s + 1 , e )} let i = r . depth ; for (; i >= 0 ;){ const s = r . index ( i ); if ( r . node ( i ). contentMatchAt ( s ). matchType ( e )) return ! 0 ; i -= 1 } return ! 1 } function Qp ( n , e , t = {}){ const { state : r } = e ,{ doc : i , tr : s } = r , o = n ; i . descendants (( l , a )=>{ const c = s . mapping . map ( a ), u = s . mapping . map ( a ) + l . nodeSize ; let d = null ; if ( l . marks . forEach ( h =>{ if ( h !== o ) return ! 1 ; d = h }), ! d ) return ; let f =! 1 ; if ( Object . keys ( t ). forEach ( h =>{ t [ h ] !== d . attrs [ h ] && ( f =! 0 )}), f ){ const h = n . type . create ({... n . attrs ,... t }); s . removeMark ( c , u , n . type ), s . addMark ( c , u , h )}}), s . docChanged && e . view . dispatch ( s )} var he = class dc extends bs { constructor (){ super (... arguments ), this . type = "node" } static create ( e = {}){ const t = typeof e == "function" ? e () : e ; return new dc ( t )} configure ( e ){ return super . configure ( e )} extend ( e ){ const t = typeof e == "function" ? e () : e ; return super . extend ( t )}}; function xt ( n ){ return new Rh ({ find : n . find , handler : ({ state : e , range : t , match : r , pasteEvent : i })=>{ const s = R ( n . getAttributes , void 0 , r , i ); if ( s ===! 1 || s === null ) return null ; const { tr : o } = 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 ( ys ( 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 && o . delete ( f , t . to ), d > t . from && o . delete ( t . from + u , d ), c = t . from + u + l . length , o . addMark ( t . from + u , c , n . type . create ( s || {})), o . removeStoredMark ( n . type )}}})} function jo ( n ){ return Wc (( e , t )=>({
`);return!s||!o?!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:s}=t;if(!s||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(O.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Li({find:dm,type:this.type,getAttributes:n=>({language:n[1]})}),Li({find:fm,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new W({key:new Z("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,s=i?.mode;if(!t||!s)return!1;const{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(A.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),pm=he.create({name:"doc",topNode:!0,content:"block+"}),mm=he.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",_(this.options.HTMLAttributes,n)]},renderText(){return`
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){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()}}}),gm=he.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 ]} `,_(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=>Li({find:new RegExp(` ^ ( # { $ { Math . min (... this . options . levels )}, $ { n }}) \\ s$ `),type:this.type,getAttributes:{level:n}}))}}),ym=he.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",_(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Xp(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return Ua(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({tr:s,dispatch:o})=>{var l;if(o){const{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(A.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(M.create(s.doc,a.pos)):s.setSelection(A.create(s.doc,a.pos));else{const u=(l=a.parent.type.contentMatch.defaultType)==null?void 0:l.create();u&&(s.insert(c,u),s.setSelection(A.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[uc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),bm=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,km=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,xm=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Sm=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Cm=Ct.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",_(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[zt({find:bm,type:this.type}),zt({find:xm,type:this.type})]},addPasteRules(){return[xt({find:km,type:this.type}),xt({find:Sm,type:this.type})]}});const Mm="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j
` , Om = "️ " , Nm = " " , hi = " " ; let On = null , Nn = null ; function Dm ( n = []){ const e = {}; de . groups = e ; const t = new de ; On == null && ( On = Ko ( Mm )), Nn == null && ( Nn = Ko ( wm )), k ( t , "'" , hr ), k ( t , "{" , Zt ), k ( t , "}" , en ), k ( t , "[" , Qn ), k ( t , "]" , Zn ), k ( t , "(" , er ), k ( t , ")" , tr ), k ( t , "<" , nr ), k ( t , ">" , rr ), k ( t , "( " , ir ), k ( t , ") " , sr ), k ( t , "「" , or ), k ( t , "」" , lr ), k ( t , "『" , ar ), k ( t , "』" , cr ), k ( t , "< " , ur ), k ( t , "> " , dr ), k ( t , "&" , fr ), k ( t , "*" , pr ), k ( t , "@" , _e ), k ( t , "`" , gr ), k ( t , "^" , yr ), k ( t , ":" , qe ), k ( t , "," , Cs ), k ( t , "$" , br ), k ( t , "." , Ee ), k ( t , "=" , kr ), k ( t , "!" , Ms ), k ( t , "-" , ke ), k ( t , "%" , tn ), k ( t , "|" , xr ), k ( t , "+" , Sr ), k ( t , "#" , Cr ), k ( t , "?" , nn ), k ( t , '"' , ws ), k ( t , "/" , Ae ), k ( t , ";" , vs ), k ( t , "~" , rn ), k ( t , "_" , Mr ), k ( t , "\\" , mr ), k ( t , "・" , mc ); const r = H ( t , Pe , xs ,{[ Bi ] :! 0 }); H ( r , Pe , r ); const i = H ( r , Re , hc ,{[ Qt ] :! 0 }), s = H ( r , jt , pc ,{[ qt ] :! 0 }), o = H ( t , Re , Le ,{[ zi ] :! 0 }); H ( o , Pe , i ), H ( o , Re , o ), H ( i , Pe , i ), H ( i , Re , i ); const l = H ( t , jt , Vi ,{[ Fi ] :! 0 }); H ( l , Re ), H ( l , Pe , s ), H ( l , jt , l ), H ( s , Pe , s ), H ( s , Re ), H ( s , jt , s ); const a = k ( t , fi , Ss ,{[ ci ] :! 0 }), c = k ( t , _o , Wi ,{[ ci ] :! 0 }), u = H ( t , di , Wi ,{[ ci ] :! 0 }); k ( t , hi , u ), k ( c , fi , a ), k ( c , hi , u ), H ( c , di , u ), k ( u , _o ), k ( u , fi ), H ( u , di , u ), k ( u , hi , u ); const d = H ( t , ui , gc ,{[ fc ] :! 0 }); k ( d , "#" ), H ( d , ui , d ), k ( d , Om , d ); const f = k ( d , Nm ); k ( f , "#" ), H ( f , ui , d ); const h = [[ Re , o ],[ Pe , i ]], p = [[ Re , null ],[ jt , l ],[ Pe , s ]]; for ( let m = 0 ; m < On . length ; m ++ ) He ( t , On [ m ], Hi , Le , h ); for ( let m = 0 ; m < Nn . length ; m ++ ) He ( t , Nn [ m ], ji , Vi , p ); ut ( Hi ,{ tld :! 0 , ascii :! 0 }, e ), ut ( ji ,{ utld :! 0 , alpha :! 0 }, e ), He ( t , "file" , Bn , Le , h ), He ( t , "mailto" , Bn , Le , h ), He ( t , "http" , Ot , Le , h ), He ( t , "https" , Ot , Le , h ), He ( t , "ftp" , Ot , Le , h ), He ( t , "ftps" , Ot , Le , h ), ut ( Bn ,{ scheme :! 0 , ascii :! 0 }, e ), ut ( Ot ,{ slashscheme :! 0 , ascii :! 0 }, e ), n = n . sort (( m , g )=> m [ 0 ] > g [ 0 ] ? 1 :- 1 ); for ( let m = 0 ; m < n . length ; m ++ ){ const g = n [ m ][ 0 ], x = n [ m ][ 1 ] ? {[ vm ] :! 0 } : {[ Tm ] :! 0 }; g . indexOf ( "-" ) >= 0 ? x [ $i ] =! 0 : Re . test ( g ) ? Pe . test ( g ) ? x [ Qt ] =! 0 : x [ zi ] =! 0 : x [ Bi ] =! 0 , Wo ( t , g , g , x )} return Wo ( t , "localhost" , pn ,{ ascii :! 0 }), t . jd = new de ( wr ),{ start : t , tokens : Object . assign ({ groups : e }, yc )}} function bc ( n , e ){ const t = Im ( e . replace ( /[A-Z]/g , l => l . toLowerCase ())), r = t . length , i = []; let s = 0 , o = 0 ; for (; o < r ;){ let l = n , a = null , c = 0 , u = null , d =- 1 , f =- 1 ; for (; o < r && ( a = l . go ( t [ o ]));) l = a , l . accepts () ? ( d = 0 , f = 0 , u = l ) : d >= 0 && ( d += t [ o ]. length , f ++ ), c += t [ o ]. length , s += t [ o ]. length , o ++ ; s -= d , o -= f , c -= d , i . push ({ t : u . t , v : e . slice ( s - c , s ), s : s - c , e : s })} return i } function Im ( n ){ const e = [], t = n . length ; let r = 0 ; for (; r < t ;){ let i = n . charCodeAt ( r ), s , o = i < 55296 || i > 56319 || r + 1 === t || ( s = n . charCodeAt ( r + 1 )) < 56320 || s > 57343 ? n [ r ] : n . slice ( r , r + 2 ); e . push ( o ), r += o . length } return e } function He ( n , e , t , r , i ){ let s ; const o = e . length ; for ( let l = 0 ; l < o - 1 ; l ++ ){ const a = e [ l ]; n . j [ a ] ? s = n . j [ a ] : ( s = new de ( r ), s . jr = i . slice (), n . j [ a ] = s ), n = s } return s = new de ( t ), s . jr = i . slice (), n . j [ e [ o - 1 ]] = s , s } function Ko ( n ){ const e = [], t = []; let r = 0 , i = "0123456789" ; for (; r < n . length ;){ let s = 0 ; for (; i . indexOf ( n [ r + s ]) >= 0 ;) s ++ ; if ( s > 0 ){ e . push ( t . join ( "" )); for ( let o = parseInt ( n . substring ( r , r + s ), 10 ); o > 0 ; o -- ) t . pop (); r += s } else t . push ( n [ r ]), r ++ } return e } const mn = { defaultProtocol : "http" , events : null , format : Uo , formatHref : Uo , nl2br :! 1 , tagName : "a" , target : null , rel : null , validate :! 0 , truncate : 1 / 0 , className : null , attributes : null , ignoreTags : [], render : null }; function Ts ( n , e = null ){ let t = Object . assign ({}, mn ); n && ( t = Object . assign ( t , n instanceof Ts ? n . o : n )); const r = t . ignoreTags , i = []; for ( let s = 0 ; s < r . length ; s ++ ) i . push ( r [ s ]. toUpperCase ()); this . o = t , e && ( this . defaultRender = e ), this . ignoreTags = i } Ts . prototype = { o : mn , ignoreTags : [], defaultRender ( n ){ return n }, check ( n ){ return this . get ( "validate" , n . toString (), n )}, get ( n , e , t ){ const r = e != null ; let i = this . o [ n ]; return i && ( typeof i == "object" ? ( i = t . t in i ? i [ t . t ] : mn [ n ], typeof i == "function" && r && ( i = i ( e , t ))) : typeof i == "function" && r && ( i = i ( e , t . t , t )), i )}, getObj ( n , e , t ){ let r = this . o [ n ]; return typeof r == "function" && e != null && ( r = r ( e , t . t , t )), r }, render ( n ){ const e = n . render ( this ); return ( this . get ( "render" , null , n ) || this . defaultRender )( e , n . t , n )}}; function Uo ( n ){ return n } function kc ( n , e ){ this . t = "token" , this . v = n , this . tk = e } kc . prototype = { isLink :! 1 , toString (){ return this . v }, toHref ( n ){ return this . toString ()}, toFormattedString ( n ){ const e = this . toString (), t = n . get ( "truncate" , e , this ), r = n . get ( "format" , e , this ); return t && r . length > t ? r . substring ( 0 , t ) + "…" : r }, toFormattedHref ( n ){ return n . get ( "formatHref" , this . toHref ( n . get ( "defaultProtocol" )), this )}, startIndex (){ return this
1. Must only contain digits , lowercase ASCII letters or "-"
2. Cannot start or end with "-"
2025-08-24 22:15:30 +03:30
3. "-" cannot repeat `);z.customSchemes.push([n,e])}function $m(){z.scanner=Dm(z.customSchemes);for(let n=0;n<z.tokenQueue.length;n++)z.tokenQueue[n][1]({scanner:z.scanner});z.parser=Pm(z.scanner.tokens);for(let n=0;n<z.pluginQueue.length;n++)z.pluginQueue[n][1]({scanner:z.scanner,parser:z.parser});return z.initialized=!0,z}function Es(n){return z.initialized||$m(),Lm(z.parser.start,n,bc(z.scanner.start,n))}Es.scan=bc;function xc(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(` linkifyjs : Invalid link type $ { e }; must be a string `);t=e,e=null}const r=new Ts(t),i=Es(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var As="[\0- -\u2029 ]",Vm=new RegExp(As),Hm=new RegExp(` $ { As } $ `),jm=new RegExp(As,"g");function Wm(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function _m(n){return new W({key:new Z("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=La(t.doc,[...e]);if(_a(l).forEach(({newRange:c})=>{const u=hh(r.doc,c,h=>h.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!Hm.test(h))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const h=f.split(Vm).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const g=Es(p).map(y=>y.toObject(n.defaultProtocol));if(!Wm(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{ys(y.from,y.to,r.doc).some(x=>x.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function Km(n){return new W({key:new Z("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;o=d.find(f=>f.nodeName==="A")}if(!o)return!1;const l=Wa(e.state,n.type.name),a=(i=o?.href)!=null?i:l.href,c=(s=o?.target)!=null?s:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&a?(window.open(a,c),!0):!1}}})}function Um(n){return new W({key:new Z("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=xc(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:n.editor.commands.setMark(n.type,{href:a.href})}}})}function st(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(jm,"").match(new RegExp(` ^ ( ?: ( ?: $ { t . join ( "|" )}) :| [ ^ a - z ] | [ a - z0 - 9 + . - ] + ( ?: [ ^ a - z + . -: ] | $ )) `,"i"))}var Sc=Ct.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The ` validate ` option is deprecated. Rename to the ` shouldAutoLink ` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Go(n);return}Go(n.scheme,n.optionalSlashes)})},onDestroy(){Fm()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!st(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.re