4a5feb12465f66947af2f40a4785344e/******/////*///// 请勿使用非法用途


过安全狗、云锁、阿里云、360、护卫神、D盾、百度云、各种杀软!

iamH4CKEERRRRRRRRRRRS

I am a hacker in the dark of a very cold night

path :/home/drive/domains/drive.vcenetwork.com/public_html/public

upload file:

List of files:

name file size edit permission action
.htaccess1125 KBFebruary 26 2023 04:58:260644
1.zip1856 KBMay 26 2025 03:52:060644
arl.txt1 KBMay 26 2025 03:58:190644
build-August 19 2024 20:27:470755
cabs.jpg.phtml34996 KBMay 25 2025 13:50:430644
cool30203 KBMay 26 2025 03:49:270644
cool.php44 KBMay 26 2025 03:50:140644
favicon-May 26 2025 07:38:380755
favicon.ico502 KBAugust 19 2024 21:12:300644
htaccess.example1125 KBMay 20 2024 07:03:520755
images-August 19 2024 20:27:470755
index.php1949 KBMay 20 2024 07:03:520755
install_files-July 31 2023 19:05:060755
invoice.css99133 KBMay 20 2024 07:03:520644
manifest.json1055 KBAugust 19 2024 21:25:160644
robots.txt1154 KBJune 07 2025 12:24:520755
storage-May 25 2025 13:49:550755
style.php26 KBMay 26 2025 03:52:280644
swagger.yaml33646 KBMay 20 2024 07:03:520755
web.config914 KBMay 20 2024 07:03:520755
import{R as vr,cl as cu,j as K,ab as dr,a as g,r as ue,cn as uu,u as du,c as me,w as fu,B as gt,T as q,y as hu,G as pu,E as Ja,d as Do,g as ge,t as hi,q as Ns,n as Ya,D as Xa,o as Za,p as Qa,F as el,ac as Or,al as mu,I as te,M as tl,a9 as gu,aJ as pi,aK as mi,cg as bu,bH as yu,K as Eu,m as hr,e as nl,A as Du,l as Su,N as ku,ax as Cu,v as rl,ad as Rs,z as xu,a1 as Au,cA as Mu}from"./main.b7d280d4.js";import{a as wu}from"./format.eba72cc5.js";import{E as vu}from"./Edit.b85e7693.js";import{z as il,o as Ou,M as Tu,s as Nu}from"./date-picker.5c1c2eea.js";import{P as Ru,A as _u,u as Iu,C as Bu,a as Fu}from"./admin-routes.da893e6b.js";import{U as Lu,A as Pu}from"./ArrowBack.974075c7.js";import{U as zu,R as Hu,C as sl,F as $u,a as Uu,b as Vu,c as Ku,d as Wu,I as ju,e as Gu,H as qu,S as Ju,P as Yu,N as Xu,f as Zu,g as Qu,h as ed,i as td,j as nd,k as rd,l as id,m as sd,n as od}from"./UnfoldLess.4eafab54.js";import"./index.6553f71f.js";import"./use-resume-subscription.493553db.js";function Se(n){this.content=n}Se.prototype={constructor:Se,find:function(n){for(var e=0;e>1}};Se.from=function(n){if(n instanceof Se)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Se(e)};function ol(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=ol(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),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;ce&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{a.isText?(s+=a.text.slice(Math.max(e,l)-l,t-l),o=!r):a.isLeaf?(i?s+=typeof i=="function"?i(a):i:a.type.spec.leafText&&(s+=a.type.spec.leafText(a)),o=!r):!o&&a.isBlock&&(s+=r,o=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new x(r,i)}cutByIndex(e,t){return e==t?x.empty:e==0&&t==this.content.length?this:new x(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new x(i,s)}addToStart(e){return new x([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new x(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?pr(r+1,o):pr(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return x.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new x(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return x.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}}Q.none=[];class Nr 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=cl(this.content,e+this.openStart,t);return r&&new T(r,this.openStart,this.openEnd)}removeBetween(e,t){return new T(ll(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(x.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new T(e,r,i)}}T.empty=new T(x.empty,0,0);function ll(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(ll(s.content,e-i-1,t-i-1)))}function cl(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=cl(o.content,e-s-1,t);return a&&n.replaceChild(i,o.copy(a))}function ad(n,e,t){if(t.openStart>n.depth)throw new Nr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Nr("Inconsistent open depths");return ul(n,e,t,0)}function ul(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Gn(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Kt(n.nodeAfter,r),s++));for(let a=s;ai&&us(n,e,i+1),o=r.depth>i&&us(t,r,i+1),a=[];return Gn(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(dl(s,o),Kt(Wt(s,fl(n,e,t,r,i+1)),a)):(s&&Kt(Wt(s,Rr(n,e,i+1)),a),Gn(e,t,i,a),o&&Kt(Wt(o,Rr(t,r,i+1)),a)),Gn(r,null,i,a),new x(a)}function Rr(n,e,t){let r=[];if(Gn(null,n,t,r),n.depth>t){let i=us(n,e,t+1);Kt(Wt(i,Rr(n,e,t+1)),r)}return Gn(e,null,t,r),new x(r)}function ld(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(x.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class tr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new _r(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=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new tr(t,r,s)}static resolveCached(e,t){for(let i=0;ie&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),hl(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=x.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;lt.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=x.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}}at.prototype.text=void 0;class Ir extends at{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):hl(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 Ir(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ir(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 hl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Yt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new dd(e,t);if(r.next==null)return Yt.empty;let i=pl(r);r.next&&r.err("Unexpected trailing text");let s=yd(bd(i));return Ed(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=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{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` `)}}Yt.empty=new Yt(!0);class dd{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 pl(n){let e=[];do e.push(fd(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function fd(n){let e=[];do e.push(hd(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function hd(n){let e=gd(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=pd(n,e);else break;return e}function So(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function pd(n,e){let t=So(n),r=t;return n.eat(",")&&(n.next!="}"?r=So(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function md(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.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function gd(n){if(n.eat("(")){let e=pl(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=md(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 bd(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new Yt(r.indexOf(n.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new Br(s,t,o));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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}class Dd{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class gi{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=yl(i.attrs),this.excluded=null;let s=gl(this.attrs);this.instance=s?new Q(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Q(this,bl(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new gi(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}}class Sd{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Se.from(e.nodes),t.marks=Se.from(e.marks||{}),this.nodes=Br.compile(this.spec.nodes,this),this.marks=gi.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 s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;s.contentMatch=r[o]||(r[o]=Yt.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=a=="_"?null:a?Co(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Co(this,o.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 Br){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 Ir(r,r.defaultAttrs,e,Q.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return at.fromJSON(this,e)}markFromJSON(e){return Q.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Co(n,e){let t=[];for(let r=0;r-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class An{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Ao(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Ao(this,t,!0);return r.addAll(e,t.from,t.to),T.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=Mo(o)),o.mark=i})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=Mo(o)),o.node=i})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new An(e,An.schemaRules(e)))}}const El={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},kd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Dl={ol:!0,ul:!0},Fr=1,Lr=2,qn=4;function xo(n,e,t){return e!=null?(e?Fr:0)|(e==="full"?Lr:0):n&&n.whitespace=="pre"?Fr|Lr:t&~qn}class mr{constructor(e,t,r,i,s,o,a){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=s,this.options=a,this.content=[],this.activeMarks=Q.none,this.stashMarks=[],this.match=o||(a&qn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(x.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&Fr)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=x.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(x.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;tthis.insertNode(l));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l)}i&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;ithis.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-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=wd(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let o=i.popFromStashMark(e);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==t)break}}}function Cd(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Dl.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function xd(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Ad(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function Mo(n){let e={};for(let t in n)e[t]=n[t];return e}function Md(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l{if(s.length||o.marks.length){let a=0,l=0;for(;a=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&st.renderSpec(Hi(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let o,a=r?e.createElementNS(r,i):e.createElement(i),l=t[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let d=u.indexOf(" ");d>0?a.setAttributeNS(u.slice(0,d),u.slice(d+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;uc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:f,contentDOM:h}=st.renderSpec(e,d,r);if(a.appendChild(f),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new st(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=wo(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return wo(e.marks)}}function wo(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Hi(n){return n.document||window.document}const Sl=65535,kl=Math.pow(2,16);function vd(n,e){return n+e*kl}function vo(n){return n&Sl}function Od(n){return(n-(n&Sl))/kl}const Cl=1,xl=2,Cr=4,Al=8;class ds{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Al)>0}get deletedBefore(){return(this.delInfo&(Cl|Cr))>0}get deletedAfter(){return(this.delInfo&(xl|Cr))>0}get deletedAcross(){return(this.delInfo&Cr)>0}}class Ke{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ke.empty)return Ke.empty}recover(e){let t=0,r=vo(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,h=l+i+(f<0?0:u);if(r)return h;let p=e==(t<0?l:d)?null:vd(a/3,e-l),m=e==l?xl:e==d?Cl:Cr;return(t<0?e!=l:e!=d)&&(m|=Al),new ds(h,m,p)}i+=u-c}return r?e+i:new ds(e+i,0,null)}touches(e,t){let r=0,i=vo(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=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 Dn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&l!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return fe.fromReplace(e,this.from,this.to,s)}invert(){return new ot(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 Ct(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ct&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ct(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 Ct(t.from,t.to,e.markFromJSON(t.mark))}}Le.jsonID("addMark",Ct);class ot extends Le{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(_s(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return fe.fromReplace(e,this.from,this.to,r)}invert(){return new Ct(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 ot(t.pos,r.pos,this.mark)}merge(e){return e instanceof ot&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ot(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 ot(t.from,t.to,e.markFromJSON(t.mark))}}Le.jsonID("removeMark",ot);class xt extends Le{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return fe.fromReplace(e,this.pos,this.pos+1,new T(x.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;ir.pos?null:new be(t.pos,r.pos,i,s,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 be(t.from,t.to,t.gapFrom,t.gapTo,T.fromJSON(e,t.slice),t.insert,!!t.structure)}}Le.jsonID("replaceAround",be);function fs(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Td(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+l.nodeSize,t),p=r.addToSet(d);for(let m=0;mn.step(l)),s.forEach(l=>n.step(l))}function Nd(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof gi){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;un.step(new ot(o.from,o.to,o.style)))}function Rd(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),s=[],o=e+1;for(let a=0;a=0;a--)n.step(s[a])}function _d(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function _n(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,u=x.from(r.node(p).copy(u)),d++):l--;let f=x.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=x.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new be(i,s,i,s,new T(r,0,0),t.length,!0))}function Pd(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,i)&&zd(n.doc,n.mapping.slice(s).map(a),r)){n.clearIncompatible(n.mapping.slice(s).map(a,1),r);let l=n.mapping.slice(s),c=l.map(a,1),u=l.map(a+o.nodeSize,1);return n.step(new be(c,u,c+1,u-1,new T(x.from(r.create(i,null,o.marks)),0,0),1,!0)),!1}})}function zd(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Hd(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 be(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new T(x.from(o),0,0),1,!0))}function Sn(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]||d;if(p!=d&&(h=h.replaceChild(0,p.type.create(p.attrs))),!d.canReplace(f+1,d.childCount)||!p.type.validContent(h))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function $d(n,e,t=1,r){let i=n.doc.resolve(e),s=x.empty,o=x.empty;for(let a=i.depth,l=i.depth-t,c=t-1;a>l;a--,c--){s=x.from(i.node(a).copy(s));let u=r&&r[c];o=x.from(u?u.type.create(u.attrs,o):i.node(a).copy(o))}n.step(new ve(e,e,new T(s.append(o),t,t),!0))}function In(n,e){let t=n.resolve(e),r=t.index();return Ud(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Ud(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Vd(n,e,t){let r=new ve(e-t,e+t,T.empty,!0);n.step(r)}function Kd(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=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(l,l,i);else{let d=c.contentMatchAt(l).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Bs(n,e,t=e,r=T.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return wl(i,s,r)?new ve(e,t,r):new Wd(i,s,r).fit()}function wl(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Wd{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=x.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=x.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 s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new T(s,o,a);return e>-1?new be(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new ve(r.pos,i.pos,l):null}findFittable(){for(let e=1;e<=2;e++)for(let t=this.unplaced.openStart;t>=0;t--){let r,i=null;t?(i=Ui(this.unplaced.content,t-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let o=this.depth;o>=0;o--){let{type:a,match:l}=this.frontier[o],c,u=null;if(e==1&&(s?l.matchType(s.type)||(u=l.fillBefore(x.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:t,frontierDepth:o,parent:i,inject:u};if(e==2&&s&&(c=l.findWrapping(s.type)))return{sliceDepth:t,frontierDepth:o,parent:i,wrap:c};if(i&&l.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Ui(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=Ui(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new T(Kn(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new T(Kn(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||l==0||m.content.size)&&(d=y,u.push(vl(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=Wn(this.placed,t,x.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,y=a;m1&&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],s=t=0;a--){let{match:l,type:c}=this.frontier[a],u=Vi(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?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=Wn(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Wn(this.placed,this.depth,x.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(x.empty,!0);t.childCount&&(this.placed=Wn(this.placed,this.frontier.length,t))}}function Kn(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Kn(n.firstChild.content,e-1,t)))}function Wn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Wn(n.lastChild.content,e-1,t)))}function Ui(n,e){for(let t=0;t1&&(r=r.replaceChild(0,vl(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(x.empty,!0)))),n.copy(r)}function Vi(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!jd(t,s.content,o)?a:null}function jd(n,e,t){for(let r=t;r0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),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].type,p=Gd(h);if(p&&i.node(l).type!=h)u=f;else if(p||!h.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=0&&(n.replace(e,t,r),!(n.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),t=s.after(h))}}function Ol(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(x.empty,!0))}return n}function Jd(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=Kd(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new T(x.from(r),0,0))}function Yd(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=Tl(r,i);for(let o=0;o0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o)return n.delete(r.before(o),t);n.delete(e,t)}function Tl(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class kn extends Le{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 fe.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return fe.fromReplace(e,this.pos,this.pos+1,new T(x.from(i),0,t.isLeaf?0:1))}getMap(){return Ke.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)}}Le.jsonID("attr",kn);let wn=class extends Error{};wn=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};wn.prototype=Object.create(Error.prototype);wn.prototype.constructor=wn;wn.prototype.name="TransformError";class Nl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Dn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new wn(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=Bs(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new T(x.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 qd(this,e,t,r),this}replaceRangeWith(e,t,r){return Jd(this,e,t,r),this}deleteRange(e,t){return Yd(this,e,t),this}lift(e,t){return Id(this,e,t),this}join(e,t=1){return Vd(this,e,t),this}wrap(e,t){return Ld(this,e,t),this}setBlockType(e,t=e,r,i=null){return Pd(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i=[]){return Hd(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new kn(e,t,r)),this}addNodeMark(e,t){return this.step(new xt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Q)){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 Mn(e,t)),this}split(e,t=1,r){return $d(this,e,t,r),this}addMark(e,t,r){return Td(this,e,t,r),this}removeMark(e,t,r){return Nd(this,e,t,r),this}clearIncompatible(e,t,r){return Rd(this,e,t,r),this}}const Ki=Object.create(null);class U{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Xd(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=0;s--){let o=t<0?ln(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):ln(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new We(e.node(0))}static atStart(e){return ln(e,e,0,0,1)||new We(e)}static atEnd(e){return ln(e,e,e.content.size,e.childCount,-1)||new We(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ki[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 Ki)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ki[e]=t,t.prototype.jsonID=e,t}getBookmark(){return V.between(this.$anchor,this.$head).getBookmark()}}U.prototype.visible=!0;class Xd{constructor(e,t){this.$from=e,this.$to=t}}let To=!1;function No(n){!To&&!n.parent.inlineContent&&(To=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class V extends U{constructor(e,t=e){No(e),No(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 U.near(r);let i=e.resolve(t.map(this.anchor));return new V(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 V&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bi(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 V(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 s=U.findFrom(t,r,!0)||U.findFrom(t,-r,!0);if(s)t=s.$head;else return U.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(U.findFrom(e,-r,!0)||U.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&z.isSelectable(a))return z.create(n,t-(i<0?a.nodeSize:0))}else{let l=ln(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function Ro(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=u)}),n.setSelection(U.near(n.doc.resolve(o),t))}const _o=1,gr=2,Io=4;class Qd extends Nl{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.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=gr,this}ensureMarks(e){return Q.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&gr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~gr,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)||Q.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==null?t:r,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(U.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|=Io,this}get scrolledIntoView(){return(this.updated&Io)>0}}function Bo(n,e){return!e||!n?n:n.bind(e)}class jn{constructor(e,t,r){this.name=e,this.init=Bo(t.init,r),this.apply=Bo(t.apply,r)}}const ef=[new jn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new jn("selection",{init(n,e){return n.selection||U.atStart(e.doc)},apply(n){return n.selection}}),new jn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new jn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Wi{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ef.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 jn(r.key,r.spec.state,r))})}}class dn{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;rr.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],s=i.spec.state;s&&s.toJSON&&(t[r]=s.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 Wi(e.schema,e.plugins),s=new dn(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=at.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=U.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[o.name]=c.fromJSON.call(l,e,t[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function Rl(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Rl(i,e,{})),t[r]=i}return t}class Oe{constructor(e){this.spec=e,this.props={},e.props&&Rl(e.props,this,this.props),this.key=e.key?e.key.key:_l("plugin")}getState(e){return e[this.key]}}const ji=Object.create(null);function _l(n){return n in ji?n+"$"+ ++ji[n]:(ji[n]=0,n+"$")}class je{constructor(e="key"){this.key=_l(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Pe=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},nr=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Fo=null;const ft=function(n,e,t){let r=Fo||(Fo=document.createRange());return r.setEnd(n,t==null?n.nodeValue.length:t),r.setStart(n,e||0),r},Xt=function(n,e,t,r){return t&&(Lo(n,e,t,r,-1)||Lo(n,e,t,r,1))},tf=/^(img|br|input|textarea|hr)$/i;function Lo(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:rt(n))){let s=n.parentNode;if(!s||s.nodeType!=1||rf(n)||tf.test(n.nodeName)||n.contentEditable=="false")return!1;e=Pe(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?rt(n):0}else return!1}}function rt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function nf(n,e,t){for(let r=e==0,i=e==rt(n);r||i;){if(n==t)return!0;let s=Pe(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==rt(n)}}function rf(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 yi=function(n){return n.focusNode&&Xt(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function fn(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}const Nt=typeof navigator<"u"?navigator:null,Po=typeof document<"u"?document:null,_t=Nt&&Nt.userAgent||"",hs=/Edge\/(\d+)/.exec(_t),Il=/MSIE \d/.exec(_t),ps=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_t),Fe=!!(Il||ps||hs),vt=Il?document.documentMode:ps?+ps[1]:hs?+hs[1]:0,Ze=!Fe&&/gecko\/(\d+)/i.test(_t);Ze&&+(/Firefox\/(\d+)/.exec(_t)||[0,0])[1];const ms=!Fe&&/Chrome\/(\d+)/.exec(_t),Be=!!ms,of=ms?+ms[1]:0,Re=!Fe&&!!Nt&&/Apple Computer/.test(Nt.vendor),vn=Re&&(/Mobile\/\w+/.test(_t)||!!Nt&&Nt.maxTouchPoints>2),Ve=vn||(Nt?/Mac/.test(Nt.platform):!1),it=/Android \d/.test(_t),Ei=!!Po&&"webkitFontSmoothing"in Po.documentElement.style,af=Ei?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function lf(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function bt(n,e){return typeof n=="number"?n:n[e]}function cf(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 zo(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=nr(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,c=l?lf(s):cf(a),u=0,d=0;if(e.topc.bottom-bt(r,"bottom")&&(d=e.bottom-c.bottom+bt(i,"bottom")),e.leftc.right-bt(r,"right")&&(u=e.right-c.right+bt(i,"right")),u||d)if(l)s.defaultView.scrollBy(u,d);else{let f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let p=a.scrollLeft-f,m=a.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(l)break}}function uf(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Bl(n.dom)}}function Bl(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=nr(r));return e}function df({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Fl(t,r==0?0:r-e)}function Fl(n,e){for(let t=0;t=a){o=Math.max(f.bottom,o),a=Math.min(f.top,a);let h=f.left>e.left?f.left-e.left:f.right=(f.left+f.right)/2?1:0));continue}}!t&&(e.left>=f.right&&e.top>=f.top||e.left>=f.left&&e.top>=f.bottom)&&(s=c+1)}}return t&&t.nodeType==3?hf(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Ll(t,i)}function hf(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Ls(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function pf(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function gf(n,e,t,r){let i=-1;for(let s=e;s!=n.dom;){let o=n.docView.nearestDesc(s,!0);if(!o)return null;if(o.node.isBlock&&o.parent){let a=o.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)i=o.posBefore;else if(a.right-1?i:n.docView.posFromDOM(e,t,1)}function Pl(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?o=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(o=gf(n,r,i,e))}o==null&&(o=mf(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:o,inside:a?a.posAtStart-a.border:-1}}function yt(n,e){let t=n.getClientRects();return t.length?t[e<0?0:t.length-1]:n.getBoundingClientRect()}const yf=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function zl(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=Ei||Ze;if(r.nodeType==3)if(o&&(yf.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=yt(ft(r,i,i),t);if(Ze&&i&&/\s/.test(r.nodeValue[i-1])&&i=0&&i==r.nodeValue.length?(l--,u=1):t<0?l--:c++,zn(yt(ft(r,l,c),1),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==rt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Gi(l.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==rt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?ft(l,rt(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return zn(yt(c,1),!1)}if(s==null&&i=0)}function zn(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 Gi(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 Hl(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 Ef(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Hl(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.dom;break}s=a.dom.parentNode}let o=zl(n,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ft(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cu.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const Df=/[\u0590-\u08ac]/;function Sf(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=n.domSelection();return!Df.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Hl(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),y=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),y})}let Ho=null,$o=null,Uo=!1;function kf(n,e,t){return Ho==e&&$o==t?Uo:(Ho=e,$o=t,Uo=t=="up"||t=="down"?Ef(n,e,t):Sf(n,e,t))}const Xe=0,Vo=1,hn=2,lt=3;class fr{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Xe,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;tPe(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 s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return(i==null?r>0:i)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}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 s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof Ul){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof $l&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?Pe(s.dom)+1:0}}else{let s,o=!0;for(;s=r=u&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,u);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Pe(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||a==this.children.length-1)){t=c;for(let u=a+1;uh&&ot){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}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=r:er){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?hn:Vo,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=lt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?hn:lt}r=o}this.dirty=hn}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?hn:Vo;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}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==Xe&&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 Cf extends fr{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 Zt extends fr{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}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))),new Zt(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty<||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(e){return this.dirty!=lt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Xe){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=ys(s,0,e,r));for(let a=0;a{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},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}=st.renderSpec(document,t.type.spec.toDOM(t)));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Wl(u,r,t),c?l=new xf(e,t,r,i,u,d||null,f,c,s,o+1):t.isText?new Di(e,t,r,i,u,f,s):new Qt(e,t,r,i,u,d||null,f,s,o+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=()=>x.empty)}return e}matchesNode(e,t,r){return this.dirty==Xe&&e.eq(this.node)&&bs(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,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new Mf(this,o&&o.node,e);Of(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Q.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,i)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let h;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>i&&e.state.selection.to-1&&l.updateNodeAt(c,u,d,h,e)||l.updateNextNode(c,u,d,e,f)||l.addNode(c,u,d,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==hn)&&(o&&this.protectLocalComposition(e,o),Vl(this.contentDOM,this.children,e),vn&&Tf(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof V)||rt+this.node.content.size)return null;let s=e.domSelectionRange(),o=Nf(s.focusNode,s.focusOffset);if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let a=o.nodeValue,l=Rf(this.node.content,a,r-t,i-t);return l<0?null:{node:o,pos:l,text:a}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Cf(this,s,t,i);e.input.compositionNodes.push(o),this.children=ys(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==lt||!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=Xe}updateOuterDeco(e){if(bs(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Kl(this.dom,this.nodeDOM,gs(this.outerDeco,this.node,t),gs(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 Ko(n,e,t,r,i){return Wl(r,e,n),new Qt(void 0,n,e,t,r,r,r,i,0)}class Di extends Qt{constructor(e,t,r,i,s,o,a){super(e,t,r,i,s,null,o,a,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==lt||this.dirty!=Xe&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Xe||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=Xe,!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),s=document.createTextNode(i.text);return new Di(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=lt)}get domAtom(){return!1}}class Ul extends fr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xe&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class xf extends Qt{constructor(e,t,r,i,s,o,a,l,c,u){super(e,t,r,i,s,o,a,c,u),this.spec=l}update(e,t,r,i){if(this.dirty==lt)return!1;if(this.spec.update){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}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):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 Vl(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Zt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof Zt)t=c,r=c.children.length;else{a=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let l=a.node;if(!!l){if(l!=n.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function vf(n,e){return n.type.side-e.type.side}function Of(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)a.push(i[o++]);let f=s+u.nodeSize;if(u.isText){let p=f;o!p.inline):a.slice();r(u,h,e.forChild(s,u),d),s=f}}function Tf(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 Nf(n,e){for(;;){if(n.nodeType==3)return n;if(n.nodeType==1&&e>0){if(n.childNodes.length>e&&n.childNodes[e].nodeType==3)return n.childNodes[e];n=n.childNodes[e-1],e=rt(n)}else if(n.nodeType==1&&e=t){let c=a=0&&c+e.length+a>=t)return a+c;if(t==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function ys(n,e,t,r,i){let s=[];for(let o=0,a=0;o=t||u<=e?s.push(l):(ct&&s.push(l.slice(t-c,l.size,r)))}return s}function Ps(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(yi(t)){for(l=a;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&z.isSelectable(u)&&i.parent&&!(u.isInline&&nf(t.focusNode,t.focusOffset,i.dom))){let d=i.posBefore;c=new z(o==d?a:r.resolve(d))}}else{let u=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(u<0)return null;l=r.resolve(u)}if(!c){let u=e=="pointer"||n.state.selection.head{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!jl(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function If(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,Pe(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Fe&&vt<=11&&(r.disabled=!0,r.disabled=!1)}function Gl(n,e){if(e instanceof z){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Jo(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Jo(n)}function Jo(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function zs(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||V.between(e,t,r)}function Yo(n){return n.editable&&!n.hasFocus()?!1:ql(n)}function ql(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 Bf(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Xt(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Es(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&U.findFrom(s,e)}function Ht(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Xo(n,e,t){let r=n.state.selection;if(r instanceof V){if(!r.empty||t.indexOf("s")>-1)return!1;if(n.endOfTextblock(e>0?"right":"left")){let i=Es(n.state,e);return i&&i instanceof z?Ht(n,i):!1}else if(!(Ve&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(a))&&!o.contentDOM?z.isSelectable(s)?Ht(n,new z(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Ei?Ht(n,new V(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else{if(r instanceof z&&r.node.isInline)return Ht(n,new V(e>0?r.$to:r.$from));{let i=Es(n.state,e);return i?Ht(n,i):!1}}}function Pr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Yn(n){let e=n.pmViewDesc;return e&&e.size==0&&(n.nextSibling||n.nodeName!="BR")}function Ji(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Ze&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(Yn(a))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Jl(t))break;{let a=t.previousSibling;for(;a&&Yn(a);)i=t.parentNode,s=Pe(a),a=a.previousSibling;if(a)t=a,r=Pr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Ds(n,t,r):i&&Ds(n,i,s)}function Yi(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Pr(t),s,o;for(;;)if(r{n.state==i&&mt(n)},50)}function Zo(n,e,t){let r=n.state.selection;if(r instanceof V&&!r.empty||t.indexOf("s")>-1||Ve&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Es(n.state,e);if(o&&o instanceof z)return Ht(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof We?U.near(o,e):U.findFrom(o,e);return a?Ht(n,a):!1}return!1}function Qo(n,e){if(!(n.state.selection instanceof V))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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function ea(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ff(n){if(!Re||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;ea(n,r,"true"),setTimeout(()=>ea(n,r,"false"),20)}return!1}function Lf(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Pf(n,e){let t=e.keyCode,r=Lf(e);return t==8||Ve&&t==72&&r=="c"?Qo(n,-1)||Ji(n):t==46||Ve&&t==68&&r=="c"?Qo(n,1)||Yi(n):t==13||t==27?!0:t==37||Ve&&t==66&&r=="c"?Xo(n,-1,r)||Ji(n):t==39||Ve&&t==70&&r=="c"?Xo(n,1,r)||Yi(n):t==38||Ve&&t==80&&r=="c"?Zo(n,-1,r)||Ji(n):t==40||Ve&&t==78&&r=="c"?Ff(n)||Zo(n,1,r)||Yi(n):r==(Ve?"m":"c")&&(t==66||t==73||t==89||t==90)}function Yl(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||st.fromSchema(n.state.schema),a=nc(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=tc[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=a.createElement(u[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` `);return{dom:l,text:f}}function Xl(n,e,t,r,i){let s=i.parent.type.spec.code,o,a;if(!t&&!e)return null;let l=e&&(r||s||!t);if(l){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return e?new T(x.from(n.state.schema.text(e.replace(/\r\n?/g,` `))),0,0):T.empty;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)a=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 y=o.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=$f(t),Ei&&Uf(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(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||An.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!zf.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Vf(ta(a,+u[1],+u[2]),u[4]);else if(a=T.maxOpen(Hf(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d{a=d(a,n)}),a}const zf=/^(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 Hf(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(a=>{if(!o)return;let l=i.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&s.length&&Ql(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=ec(o[o.length-1],s.length));let u=Zl(a,l);o.push(u),i=i.matchType(u.type),s=l}}),o)return x.from(o)}return n}function Zl(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,x.from(n));return n}function Ql(n,e,t,r,i){if(i=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,n.childCount>1||s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(x.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(a))}function ta(n,e,t){return e]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=nc().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&tc[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=n,i)for(let s=0;s=0;a-=2){let l=t.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=x.from(l.create(r[a+1],i)),s++,o++}return new T(i,s,o)}const _e={},Ie={},Kf={touchstart:!0,touchmove:!0};class Wf{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.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function jf(n){for(let e in _e){let t=_e[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{qf(n,r)&&!Hs(n,r)&&(n.editable||!(r.type in Ie))&&t(n,r)},Kf[e]?{passive:!0}:void 0)}Re&&n.dom.addEventListener("input",()=>null),ks(n)}function At(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Gf(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 ks(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Hs(n,r))})}function Hs(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function qf(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 Jf(n,e){!Hs(n,e)&&_e[e.type]&&(n.editable||!(e.type in Ie))&&_e[e.type](n,e)}Ie.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!ic(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(it&&Be&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),vn&&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,fn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Pf(n,t)?t.preventDefault():At(n,"key")};Ie.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Ie.keypress=(n,e)=>{let t=e;if(ic(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ve&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof V)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))||n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Si(n){return{left:n.clientX,top:n.clientY}}function Yf(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function $s(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,a=>o>s.depth?a(n,t,s.nodeAfter,s.before(o),i,!0):a(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Cn(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Xf(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),"pointer"),!0):!1}function Zf(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof z&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(z.isSelectable(a)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Cn(n,z.create(n.state.doc,i),"pointer"),!0):!1}function Qf(n,e,t,r,i){return $s(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Zf(n,t):Xf(n,t))}function eh(n,e,t,r){return $s(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function th(n,e,t,r){return $s(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||nh(n,t,r)}function nh(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Cn(n,V.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)Cn(n,V.create(r,a+1,a+1+o.content.size),"pointer");else if(z.isSelectable(o))Cn(n,z.create(r,a),"pointer");else continue;return!0}}function Us(n){return zr(n)}const rc=Ve?"metaKey":"ctrlKey";_e.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Us(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Yf(t,n.input.lastClick)&&!t[rc]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(Si(t));!o||(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new rh(n,o,t,!!r)):(s=="doubleClick"?eh:th)(n,o.pos,o.inside,t)?t.preventDefault():At(n,"pointer"))};class rh{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[rc],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof z&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ze&&!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)),At(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(()=>mt(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(Si(e))),this.updateAllowDefault(e),this.allowDefault||!t?At(this.view,"pointer"):Qf(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Re&&this.mightDrag&&!this.mightDrag.node.isAtom||Be&&!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,U.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):At(this.view,"pointer")}move(e){this.updateAllowDefault(e),At(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)}}_e.touchstart=n=>{n.input.lastTouch=Date.now(),Us(n),At(n,"pointer")};_e.touchmove=n=>{n.input.lastTouch=Date.now(),At(n,"pointer")};_e.contextmenu=n=>Us(n);function ic(n,e){return n.composing?!0:Re&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const ih=it?5e3:-1;Ie.compositionstart=Ie.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),zr(n,!0),n.markCursor=null;else if(zr(n),Ze&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){n.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}sc(n,ih)};Ie.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,sc(n,20))};function sc(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>zr(n),e))}function oc(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=sh());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function sh(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function zr(n,e=!1){if(!(it&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),oc(n),e||n.docView&&n.docView.dirty){let t=Ps(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function oh(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 On=Fe&&vt<15||vn&&af<604;_e.copy=Ie.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=On?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Yl(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):oh(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function ah(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function lh(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(),setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Cs(n,r.value,null,e):Cs(n,r.textContent,r.innerHTML,e)},50)}function Cs(n,e,t,r){let i=Xl(n,e,t,n.input.shiftKey,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||T.empty)))return!0;if(!i)return!1;let s=ah(i),o=s?n.state.tr.replaceSelectionWith(s,n.input.shiftKey):n.state.tr.replaceSelection(i);return n.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Ie.paste=(n,e)=>{let t=e;if(n.composing&&!it)return;let r=On?null:t.clipboardData;r&&Cs(n,r.getData("text/plain"),r.getData("text/html"),t)?t.preventDefault():lh(n,t)};class ch{constructor(e,t){this.slice=e,this.move=t}}const ac=Ve?"altKey":"ctrlKey";_e.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Si(t));if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)n.dispatch(n.state.tr.setSelection(z.create(n.state.doc,r.mightDrag.pos)));else if(t.target&&t.target.nodeType==1){let c=n.docView.nearestDesc(t.target,!0);c&&c.node.type.spec.draggable&&c!=n.docView&&n.dispatch(n.state.tr.setSelection(z.create(n.state.doc,c.posBefore)))}}let o=n.state.selection.content(),{dom:a,text:l}=Yl(n,o);t.dataTransfer.clearData(),t.dataTransfer.setData(On?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",On||t.dataTransfer.setData("text/plain",l),n.dragging=new ch(o,!t[ac])};_e.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Ie.dragover=Ie.dragenter=(n,e)=>e.preventDefault();Ie.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Si(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=Xl(n,t.dataTransfer.getData(On?"Text":"text/plain"),On?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!t[ac]);if(n.someProp("handleDrop",p=>p(n,t,o||T.empty,a))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?Ml(n.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let c=n.state.tr;a&&c.deleteSelection();let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let h=c.doc.resolve(u);if(d&&z.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new z(h));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,D,C)=>p=C),c.setSelection(zs(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};_e.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())&&mt(n)},20))};_e.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)};_e.beforeinput=(n,e)=>{if(Be&&it&&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",s=>s(n,fn(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 Ie)_e[n]=Ie[n];function rr(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 Vs{constructor(e,t){this.toDOM=e,this.spec=t||jt,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new ze(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Vs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&rr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ot{constructor(e,t){this.attrs=e,this.spec=t||jt}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ze(s,o,this)}valid(e,t){return t.from=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;oe){let a=this.children[o]+1;this.children[o+2].findInner(e-a,t-a,r,i+a,s)}}map(e,t,r){return this==we||e.maps.length==0?this:this.mapInner(e,t,0,0,r||jt)}mapInner(e,t,r,i,s){let o;for(let a=0;a{let c=l+r,u;if(!!(u=cc(t,a,c))){for(i||(i=this.children.slice());sa&&d.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;as&&l.type instanceof Ot){let c=Math.max(s,l.from)-s,u=Math.min(o,l.to)-s;ci.map(e,t,jt));return kt.from(r)}forChild(e,t){if(t.isLeaf)return ce.empty;let r=[];for(let i=0;it instanceof ce)?e:e.reduce((t,r)=>t.concat(r instanceof ce?r:r.members),[]))}}}function uh(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,u=s;c{let y=m-p-(h-f);for(let D=0;DC+u-d)continue;let _=a[D]+u-d;h>=_?a[D+1]=f<=_?-2:-1:p>=i&&y&&(a[D]+=y,a[D+1]+=y)}d+=y}),u=t.maps[c].map(u,-1)}let l=!1;for(let c=0;c=r.content.size){l=!0;continue}let f=t.map(n[c+1]+s,-1),h=f-i,{index:p,offset:m}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&m==d&&m+y.nodeSize==h){let D=a[c+2].mapInner(t,y,u+1,n[c]+s+1,o);D!=we?(a[c]=d,a[c+1]=h,a[c+2]=D):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=dh(a,n,e,t,i,s,o),u=Hr(c,r,0,o);e=u.local;for(let d=0;dt&&o.to{let c=cc(n,a,l+t);if(c){s=!0;let u=Hr(c,a,t+l+1,r);u!=we&&i.push(l,l+a.nodeSize,u)}});let o=lc(s?uc(n):n,-t).sort(Gt);for(let a=0;a0;)e++;n.splice(e,0,t)}function Xi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=we&&e.push(r)}),n.cursorWrapper&&e.push(ce.create(n.state.doc,[n.cursorWrapper.deco])),kt.from(e)}const fh={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},hh=Fe&&vt<=11;class ph{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 mh{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ph,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),hh&&(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,fh)),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;tthis.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(!!Yo(this.view)){if(this.suppressingSelectionUpdates)return mt(this.view);if(Fe&&vt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Xt(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 s=e.focusNode;s;s=nr(s))t.add(s);for(let s=e.anchorNode;s;s=nr(s))if(t.has(s)){r=s;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}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.observer?this.observer.takeRecords():[];this.queue.length&&(t=this.queue.concat(t),this.queue.length=0);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Yo(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u1){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let d=u[0],f=u[1];d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&e.input.lastTouch-1||i)&&(s>-1&&(e.docView.markDirty(s,o),gh(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||mt(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;ui;y--){let D=r.childNodes[y-1],C=D.pmViewDesc;if(D.nodeName=="BR"&&!C){s=y;break}if(!C||C.size)break}let d=n.state.doc,f=n.someProp("domParser")||An.fromSchema(n.state.schema),h=d.resolve(o),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Eh,context:h});if(c&&c[0].pos!=null){let y=c[0].pos,D=c[1]&&c[1].pos;D==null&&(D=y),p={anchor:y+o,head:D+o}}return{doc:m,sel:p,from:o,to:a}}function Eh(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Re&&/^(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||Re&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}function Dh(n,e,t,r,i){if(e<0){let I=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,W=Ps(n,I);if(W&&!n.state.selection.eq(W)){let oe=n.state.tr.setSelection(W);I=="pointer"?oe.setMeta("pointer",!0):I=="key"&&oe.scrollIntoView(),n.dispatch(oe)}return}let s=n.state.doc.resolve(e),o=s.sharedDepth(t);e=s.before(o+1),t=n.state.doc.resolve(t).after(o+1);let a=n.state.selection,l=yh(n,e,t),c=n.state.doc,u=c.slice(l.from,l.to),d,f;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||it)&&i.some(I=>I.nodeName=="DIV"||I.nodeName=="P"||I.nodeName=="LI")&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",I=>I(n,fn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(r&&a instanceof V&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(l.sel){let I=oa(n,n.state.doc,l.sel);I&&!I.eq(n.state.selection)&&n.dispatch(n.state.tr.setSelection(I))}return}if(Be&&n.cursorWrapper&&l.sel&&l.sel.anchor==n.cursorWrapper.deco.from&&l.sel.head==l.sel.anchor){let I=h.endB-h.start;l.sel={anchor:l.sel.anchor+I,head:l.sel.anchor+I}}n.input.domChangeCount++,n.state.selection.fromn.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=l.from?h.start=n.state.selection.from:h.endA=n.state.selection.to-2&&n.state.selection.to<=l.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),Fe&&vt<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>l.from&&l.doc.textBetween(h.start-l.from-1,h.start-l.from+1)==" \xA0"&&(h.start--,h.endA--,h.endB--);let p=l.doc.resolveNoCache(h.start-l.from),m=l.doc.resolveNoCache(h.endB-l.from),y=c.resolve(h.start),D=p.sameParent(m)&&p.parent.inlineContent&&y.end()>=h.endA,C;if((vn&&n.input.lastIOSEnter>Date.now()-225&&(!D||i.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!D&&p.posI(n,fn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&kh(c,h.start,h.endA,p,m)&&n.someProp("handleKeyDown",I=>I(n,fn(8,"Backspace")))){it&&Be&&n.domObserver.suppressSelectionUpdates();return}Be&&it&&h.endB==h.start&&(n.input.lastAndroidDelete=Date.now()),it&&!D&&p.start()!=m.start()&&m.parentOffset==0&&p.depth==m.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==h.endA&&(h.endB-=2,m=l.doc.resolveNoCache(h.endB-l.from),setTimeout(()=>{n.someProp("handleKeyDown",function(I){return I(n,fn(13,"Enter"))})},20));let _=h.start,P=h.endA,H,J,Z;if(D){if(p.pos==m.pos)Fe&&vt<=11&&p.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>mt(n),20)),H=n.state.tr.delete(_,P),J=c.resolve(h.start).marksAcross(c.resolve(h.endA));else if(h.endA==h.endB&&(Z=Sh(p.parent.content.cut(p.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start()))))H=n.state.tr,Z.type=="add"?H.addMark(_,P,Z.mark):H.removeMark(_,P,Z.mark);else if(p.parent.child(p.index()).isText&&p.index()==m.index()-(m.textOffset?0:1)){let I=p.parent.textBetween(p.parentOffset,m.parentOffset);if(n.someProp("handleTextInput",W=>W(n,_,P,I)))return;H=n.state.tr.insertText(I,_,P)}}if(H||(H=n.state.tr.replace(_,P,l.doc.slice(h.start-l.from,h.endB-l.from))),l.sel){let I=oa(n,H.doc,l.sel);I&&!(Be&&it&&n.composing&&I.empty&&(h.start!=h.endB||n.input.lastAndroidDeletee.content.size?null:zs(n,e.resolve(t.anchor),e.resolve(t.head))}function Sh(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let u=0;uu.mark(a.addToSet(u.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;ut||Zi(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function Ch(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o=o?s-r:0;s-=l,a=s+(a-o),o=s}else if(a=a?s-r:0;s-=l,o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}class xh{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 Wf,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(da),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=ca(this),la(this),this.nodeViews=ua(this),this.docView=Ko(this.state.doc,aa(this),Xi(this),this.dom,this),this.domObserver=new mh(this,(r,i,s,o)=>Dh(this,r,i,s,o)),this.domObserver.start(),jf(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&&ks(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(da),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){let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(oc(this),s=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(o||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=ua(this);Mh(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(o||t.handleDOMEvents!=this._props.handleDOMEvents)&&ks(this),this.editable=ca(this),la(this);let a=Xi(this),l=aa(this),c=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,l,a);(u||!e.selection.eq(r.selection))&&(s=!0);let d=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&uf(this);if(s){this.domObserver.stop();let f=u&&(Fe||Be)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&Ah(r.selection,e.selection);if(u){let h=Be?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(e.doc,l,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Ko(e.doc,l,a,this.dom,this)),h&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Bf(this))?mt(this,f):(Gl(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&df(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;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&&zo(this,t.getBoundingClientRect(),e)}else zo(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;tt.ownerDocument.getSelection()),this._root=t}return e||document}posAtCoords(e){return bf(this,e)}coordsAtPos(e,t=1){return zl(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 kf(this,t||this.state,e)}destroy(){!this.docView||(Gf(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Jf(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Re&&this.root.nodeType===11&&sf(this.dom.ownerDocument)==this.dom?bh(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function aa(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),e.translate="no",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]))}),[ze.node(0,n.state.doc.content.size,e)]}function la(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:ze.widget(n.state.selection.head,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ca(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ah(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 ua(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 Mh(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 da(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 Rt={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:"'"},$r={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},fa=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent);typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent);var wh=typeof navigator<"u"&&/Mac/.test(navigator.platform),vh=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Oh=wh||fa&&+fa[1]<57;for(var ke=0;ke<10;ke++)Rt[48+ke]=Rt[96+ke]=String(ke);for(var ke=1;ke<=24;ke++)Rt[ke+111]="F"+ke;for(var ke=65;ke<=90;ke++)Rt[ke]=String.fromCharCode(ke+32),$r[ke]=String.fromCharCode(ke);for(var Qi in Rt)$r.hasOwnProperty(Qi)||($r[Qi]=Rt[Qi]);function Th(n){var e=Oh&&(n.ctrlKey||n.altKey||n.metaKey)||vh&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?$r:Rt)[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 Nh=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Rh(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a127)&&(o=Rt[r.keyCode])&&o!=i){let l=e[es(o,r,!0)];if(l&&l(t.state,t.dispatch,t))return!0}else if(s&&r.shiftKey){let l=e[es(i,r,!0)];if(l&&l(t.state,t.dispatch,t))return!0}return!1}}const Bh=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0),Fh=(n,e,t)=>{let{$cursor:r}=n.selection;if(!r||(t?!t.endOfTextblock("backward",n):r.parentOffset>0))return!1;let i=fc(r);if(!i){let o=r.blockRange(),a=o&&_n(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(!s.type.spec.isolating&&mc(n,i,e))return!0;if(r.parent.content.size==0&&(Tn(s,"end")||z.isSelectable(s))){let o=Bs(n.doc,r.before(),r.after(),T.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=fc(r)}let o=s&&s.nodeBefore;return!o||!z.isSelectable(o)?!1:(e&&e(n.tr.setSelection(z.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function fc(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}const Ph=(n,e,t)=>{let{$cursor:r}=n.selection;if(!r||(t?!t.endOfTextblock("forward",n):r.parentOffset{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&_n(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},$h=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` `).scrollIntoView()),!0)};function pc(n){for(let e=0;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=pc(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=t.after(),l=n.tr.replaceWith(a,a,o.createAndFill());l.setSelection(U.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Vh=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof We||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=pc(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){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(Sn(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&_n(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Wh=(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(z.create(n.doc,i))),!0)};function jh(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||In(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function mc(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(jh(n,e,t))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(t){let d=e.pos+i.nodeSize,f=x.empty;for(let m=s.length-1;m>=0;m--)f=x.from(s[m].create(null,f));f=x.from(r.copy(f));let h=n.tr.step(new be(e.pos-1,d,e.pos,d,new T(f,1,0),s.length,!0)),p=d+2*s.length;In(h.doc,p)&&h.join(p),t(h.scrollIntoView())}return!0}let l=U.findFrom(e,1),c=l&&l.$from.blockRange(l.$to),u=c&&_n(c);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(c,u).scrollIntoView()),!0;if(a&&Tn(i,"start",!0)&&Tn(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let h=i,p=1;for(;!h.isTextblock;h=h.firstChild)p++;if(d.canReplace(d.childCount,d.childCount,h.content)){if(t){let m=x.empty;for(let D=f.length-1;D>=0;D--)m=x.from(f[D].copy(m));let y=n.tr.step(new be(e.pos-f.length,e.pos+i.nodeSize,e.pos+p,e.pos+i.nodeSize-p,new T(m,f.length,0),0,!0));t(y.scrollIntoView())}return!0}}return!1}function gc(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(V.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Gh=gc(-1),qh=gc(1);function Jh(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&Is(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function ha(n,e=null){return function(t,r){let{from:i,to:s}=t.selection,o=!1;return t.doc.nodesBetween(i,s,(a,l)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)o=!0;else{let c=t.doc.resolve(l),u=c.index();o=c.parent.canReplaceWith(u,u+1,n)}}),o?(r&&r(t.tr.setBlockType(i,s,n,e).scrollIntoView()),!0):!1}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Yh(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=!1,l=o;if(!o)return!1;if(o.depth>=2&&i.node(o.depth-1).type.compatibleContent(n)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=t.doc.resolve(o.start-2);l=new _r(u,u,o.depth),o.endIndex=0;u--)s=x.from(t[u].type.create(t[u].attrs,s));n.step(new be(e.start-(r?2:0),e.end,e.start,e.end,new T(s,0,0),t.length,!0));let o=0;for(let u=0;uo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Qh(e,t,n,s):ep(e,t,s):!0:!1}}function Qh(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sm;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,l=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?x.empty:x.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new be(d-(a?1:0),f+(l?1:0),d+1,f-1,new T((a?x.empty:x.from(i.copy(x.empty))).append(l?x.empty:x.from(i.copy(x.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function tp(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=n)return!1;if(t){let c=l.lastChild&&l.lastChild.type==a.type,u=x.from(c?n.create():null),d=new T(x.from(n.create(null,x.from(a.type.create(null,u)))),c?3:1,0),f=s.start,h=s.end;t(e.tr.step(new be(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function ki(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}class Ci{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:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...u)=>{const d=l(...u)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,c=e||s.tr,u=()=>(!l&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{const y=this.buildProps(c,t),D=h(...m)(y);return a.push(D),d}])),run:u};return d}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...u)=>c(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i;s.storedMarks&&e.setStoredMarks(s.storedMarks);const a={tr:e,editor:i,view:o,state:ki({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}}class np{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}removeAllListeners(){this.callbacks={}}}function N(n,e,t){return n.config[e]===void 0&&n.parent?N(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?N(n.parent,e,t):null}):n.config[e]}function xi(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 bc(n){const e=[],{nodeExtensions:t,markExtensions:r}=xi(n),i=[...t,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=N(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=N(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...s,...d};(d==null?void 0:d.isRequired)&&(d==null?void 0:d.default)===void 0&&delete f.default,e.push({type:o.name,name:u,attribute:f})})}),e}function ye(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 re(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}i==="class"?r[i]=[r[i],s].join(" "):i==="style"?r[i]=[r[i],s].join("; "):r[i]=s}),r},{})}function xs(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>re(t,r),{})}function yc(n){return typeof n=="function"}function $(n,e=void 0,...t){return yc(n)?e?n.bind(e)(...t):n(...t):n}function rp(n={}){return Object.keys(n).length===0&&n.constructor===Object}function ip(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function pa(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):ip(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function ma(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&rp(t)?!1:t!=null))}function sp(n){var e;const t=bc(n),{nodeExtensions:r,markExtensions:i}=xi(n),s=(e=r.find(l=>N(l,"topNode")))===null||e===void 0?void 0:e.name,o=Object.fromEntries(r.map(l=>{const c=t.filter(y=>y.type===l.name),u={name:l.name,options:l.options,storage:l.storage},d=n.reduce((y,D)=>{const C=N(D,"extendNodeSchema",u);return{...y,...C?C(l):{}}},{}),f=ma({...d,content:$(N(l,"content",u)),marks:$(N(l,"marks",u)),group:$(N(l,"group",u)),inline:$(N(l,"inline",u)),atom:$(N(l,"atom",u)),selectable:$(N(l,"selectable",u)),draggable:$(N(l,"draggable",u)),code:$(N(l,"code",u)),defining:$(N(l,"defining",u)),isolating:$(N(l,"isolating",u)),attrs:Object.fromEntries(c.map(y=>{var D;return[y.name,{default:(D=y==null?void 0:y.attribute)===null||D===void 0?void 0:D.default}]}))}),h=$(N(l,"parseHTML",u));h&&(f.parseDOM=h.map(y=>pa(y,c)));const p=N(l,"renderHTML",u);p&&(f.toDOM=y=>p({node:y,HTMLAttributes:xs(y,c)}));const m=N(l,"renderText",u);return m&&(f.toText=m),[l.name,f]})),a=Object.fromEntries(i.map(l=>{const c=t.filter(m=>m.type===l.name),u={name:l.name,options:l.options,storage:l.storage},d=n.reduce((m,y)=>{const D=N(y,"extendMarkSchema",u);return{...m,...D?D(l):{}}},{}),f=ma({...d,inclusive:$(N(l,"inclusive",u)),excludes:$(N(l,"excludes",u)),group:$(N(l,"group",u)),spanning:$(N(l,"spanning",u)),code:$(N(l,"code",u)),attrs:Object.fromEntries(c.map(m=>{var y;return[m.name,{default:(y=m==null?void 0:m.attribute)===null||y===void 0?void 0:y.default}]}))}),h=$(N(l,"parseHTML",u));h&&(f.parseDOM=h.map(m=>pa(m,c)));const p=N(l,"renderHTML",u);return p&&(f.toDOM=m=>p({mark:m,HTMLAttributes:xs(m,c)})),[l.name,f]}));return new Sd({topNode:s,nodes:o,marks:a})}function ts(n,e){return e.nodes[n]||e.marks[n]||null}function ga(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const op=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,c;const u=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=u.slice(0,Math.max(0,r-s))}),t};function js(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class Ai{constructor(e){this.find=e.find,this.handler=e.handler}}const ap=(n,e)=>{if(js(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[];return r.push(t.text),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 ns(n){var e;const{editor:t,from:r,to:i,text:s,rules:o,plugin:a}=n,{view:l}=t;if(l.composing)return!1;const c=l.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=op(c)+s;return o.forEach(f=>{if(u)return;const h=ap(d,f.find);if(!h)return;const p=l.state.tr,m=ki({state:l.state,transaction:p}),y={from:r-(h[0].length-s.length),to:i},{commands:D,chain:C,can:_}=new Ci({editor:t,state:m});f.handler({state:m,range:y,match:h,commands:D,chain:C,can:_})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),u=!0)}),u}function lp(n){const{editor:e,rules:t}=n,r=new Oe({state:{init(){return null},apply(i,s){const o=i.getMeta(r);return o||(i.selectionSet||i.docChanged?null:s)}},props:{handleTextInput(i,s,o,a){return ns({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&ns({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?ns({editor:e,from:o.pos,to:o.pos,text:` `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function cp(n){return typeof n=="number"}class up{constructor(e){this.find=e.find,this.handler=e.handler}}const dp=(n,e)=>{if(js(e))return[...n.matchAll(e)];const t=e(n);return t?t.map(r=>{const i=[];return i.push(r.text),i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function fp(n){const{editor:e,state:t,from:r,to:i,rule:s}=n,{commands:o,chain:a,can:l}=new Ci({editor:e,state:t}),c=[];return t.doc.nodesBetween(r,i,(d,f)=>{if(!d.isTextblock||d.type.spec.code)return;const h=Math.max(r,f),p=Math.min(i,f+d.content.size),m=d.textBetween(h-f,p-f,void 0,"\uFFFC");dp(m,s.find).forEach(D=>{if(D.index===void 0)return;const C=h+D.index+1,_=C+D[0].length,P={from:t.tr.mapping.map(C),to:t.tr.mapping.map(_)},H=s.handler({state:t,range:P,match:D,commands:o,chain:a,can:l});c.push(H)})}),c.every(d=>d!==null)}function hp(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1;return t.map(a=>new Oe({view(l){const c=u=>{var d;r=!((d=l.dom.parentElement)===null||d===void 0)&&d.contains(u.target)?l.dom.parentElement:null};return window.addEventListener("dragstart",c),{destroy(){window.removeEventListener("dragstart",c)}}},props:{handleDOMEvents:{drop:l=>(s=r===l.dom.parentElement,!1),paste:(l,c)=>{var u;const d=(u=c.clipboardData)===null||u===void 0?void 0:u.getData("text/html");return i=!!(d!=null&&d.includes("data-pm-slice")),!1}}},appendTransaction:(l,c,u)=>{const d=l[0],f=d.getMeta("uiEvent")==="paste"&&!i,h=d.getMeta("uiEvent")==="drop"&&!s;if(!f&&!h)return;const p=c.doc.content.findDiffStart(u.doc.content),m=c.doc.content.findDiffEnd(u.doc.content);if(!cp(p)||!m||p===m.b)return;const y=u.tr,D=ki({state:u,transaction:y});if(!(!fp({editor:e,state:D,from:Math.max(p-1,0),to:m.b-1,rule:a})||!y.steps.length))return y}}))}function pp(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class pn{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=pn.resolve(e),this.schema=sp(this.extensions),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const s={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:ts(r.name,this.schema)};r.type==="mark"&&((i=$(N(r,"keepOnSplit",s)))!==null&&i!==void 0?i:!0)&&this.splittableMarks.push(r.name);const o=N(r,"onBeforeCreate",s);o&&this.editor.on("beforeCreate",o);const a=N(r,"onCreate",s);a&&this.editor.on("create",a);const l=N(r,"onUpdate",s);l&&this.editor.on("update",l);const c=N(r,"onSelectionUpdate",s);c&&this.editor.on("selectionUpdate",c);const u=N(r,"onTransaction",s);u&&this.editor.on("transaction",u);const d=N(r,"onFocus",s);d&&this.editor.on("focus",d);const f=N(r,"onBlur",s);f&&this.editor.on("blur",f);const h=N(r,"onDestroy",s);h&&this.editor.on("destroy",h)})}static resolve(e){const t=pn.sort(pn.flatten(e)),r=pp(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=N(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=N(r,"priority")||100,o=N(i,"priority")||100;return s>o?-1:s{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ts(t.name,this.schema)},i=N(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=pn.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:ts(o.name,this.schema)},l=[],c=N(o,"addKeyboardShortcuts",a);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>He.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([y,D])=>[y,()=>D({editor:e})]));u={...u,...m}}const d=Ih(u);l.push(d);const f=N(o,"addInputRules",a);ga(o,e.options.enableInputRules)&&f&&r.push(...f());const h=N(o,"addPasteRules",a);ga(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=N(o,"addProseMirrorPlugins",a);if(p){const m=p();l.push(...m)}return l}).flat();return[lp({editor:e,rules:r}),...hp({editor:e,rules:i}),...s]}get attributes(){return bc(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=xi(this.extensions);return Object.fromEntries(t.filter(r=>!!N(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:ye(r.name,this.schema)},o=N(r,"addNodeView",s);if(!o)return[];const a=(l,c,u,d)=>{const f=xs(l,i);return o()({editor:e,node:l,getPos:u,decorations:d,HTMLAttributes:f,extension:r})};return[r.name,a]}))}}function mp(n){return Object.prototype.toString.call(n).slice(8,-1)}function rs(n){return mp(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Mi(n,e){const t={...n};return rs(n)&&rs(e)&&Object.keys(e).forEach(r=>{rs(e[r])?r in n?t[r]=Mi(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class xe{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&&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=$(N(this,"addOptions",{name:this.name}))),this.storage=$(N(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new xe(e)}configure(e={}){const t=this.extend();return t.options=Mi(this.options,e),t.storage=$(N(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new xe(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=$(N(t,"addOptions",{name:t.name})),t.storage=$(N(t,"addStorage",{name:t.name,options:t.options})),t}}function Ec(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=` `,textSerializers:o={}}=t||{};let a="",l=!0;return n.nodesBetween(r,i,(c,u,d,f)=>{var h;const p=o==null?void 0:o[c.type.name];p?(c.isBlock&&!l&&(a+=s,l=!0),d&&(a+=p({node:c,pos:u,parent:d,index:f,range:e}))):c.isText?(a+=(h=c==null?void 0:c.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,i-u),l=!1):c.isBlock&&!l&&(a+=s,l=!0)}),a}function Dc(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const gp=xe.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Oe({key:new je("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),l=Dc(t);return Ec(r,{from:o,to:a},{textSerializers:l})}}})]}}),bp=()=>({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),yp=(n=!1)=>({commands:e})=>e.setContent("",n),Ep=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=_n(h);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Dp=n=>e=>n(e),Sp=()=>({state:n,dispatch:e})=>Vh(n,e),kp=n=>({tr:e,state:t,dispatch:r})=>{const i=ye(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const l=s.before(o),c=s.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},Cp=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},xp=()=>({state:n,dispatch:e})=>Bh(n,e),Ap=()=>({commands:n})=>n.keyboardShortcut("Enter"),Mp=()=>({state:n,dispatch:e})=>Uh(n,e);function Ur(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:js(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function As(n,e,t={}){return n.find(r=>r.type===e&&Ur(r.attrs,t))}function wp(n,e,t={}){return!!As(n,e,t)}function Gs(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=As([...r.node.marks],e,t);if(!i)return;let s=r.index,o=n.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(As([...r.node.marks],e,t);s>0&&i.isInSet(n.parent.child(s-1).marks);)s-=1,o-=n.parent.child(s).nodeSize;for(;a({tr:t,state:r,dispatch:i})=>{const s=It(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:u}=a;if(i){const d=Gs(l,s,e);if(d&&d.from<=c&&d.to>=u){const f=V.create(o,d.from,d.to);t.setSelection(f)}}return!0},Op=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{qs()&&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(s&&n===null&&!Sc(t.state.selection))return o(),!0;const a=kc(i.doc,n)||t.state.selection,l=t.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Np=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),Rp=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e);function ba(n){const e=`${n}`;return new window.DOMParser().parseFromString(e,"text/html").body}function Vr(n,e,t){if(t={slice:!0,parseOptions:{},...t},typeof n=="object"&&n!==null)try{return Array.isArray(n)?x.fromArray(n.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Vr("",e,t)}if(typeof n=="string"){const r=An.fromSchema(e);return t.slice?r.parseSlice(ba(n),t.parseOptions).content:r.parse(ba(n),t.parseOptions)}return Vr("",e,t)}function _p(n,e,t){const r=n.steps.length-1;if(r{o===0&&(o=u)}),n.setSelection(U.near(n.doc.resolve(o),t))}const Ip=n=>n.toString().startsWith("<"),Bp=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{if(i){t={parseOptions:{},updateSelection:!0,...t};const o=Vr(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(o.toString()==="<>")return!0;let{from:a,to:l}=typeof n=="number"?{from:n,to:n}:n,c=!0,u=!0;if((Ip(o)?o:[o]).forEach(f=>{f.check(),c=c?f.isText&&f.marks.length===0:!1,u=u?f.isBlock:!1}),a===l&&u){const{parent:f}=r.doc.resolve(a);f.isTextblock&&!f.type.spec.code&&!f.childCount&&(a-=1,l+=1)}c?r.insertText(e,a,l):r.replaceWith(a,l,o),t.updateSelection&&_p(r,r.steps.length-1,-1)}return!0},Fp=()=>({state:n,dispatch:e})=>Fh(n,e),Lp=()=>({state:n,dispatch:e})=>Ph(n,e);function Cc(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Pp(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a({editor:e,view:t,tr:r,dispatch:i})=>{const s=Pp(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function ir(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?ye(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=i-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Ur(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}const Hp=(n,e={})=>({state:t,dispatch:r})=>{const i=ye(n,t.schema);return ir(t,i,e)?Hh(t,r):!1},$p=()=>({state:n,dispatch:e})=>Kh(n,e),Up=n=>({state:e,dispatch:t})=>{const r=ye(n,e.schema);return Zh(r)(e,t)},Vp=()=>({state:n,dispatch:e})=>$h(n,e);function wi(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ya(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 Kp=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=wi(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=ye(n,r.schema)),a==="mark"&&(o=It(n,r.schema)),i&&t.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{s&&s===c.type&&t.setNodeMarkup(u,void 0,ya(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&t.addMark(u,u+c.nodeSize,o.create(ya(d.attrs,e)))})})}),!0):!1},Wp=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),jp=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),Gp=()=>({state:n,dispatch:e})=>Lh(n,e),qp=()=>({state:n,dispatch:e})=>zh(n,e),Jp=()=>({state:n,dispatch:e})=>Wh(n,e),Yp=()=>({state:n,dispatch:e})=>qh(n,e),Xp=()=>({state:n,dispatch:e})=>Gh(n,e);function xc(n,e,t={}){return Vr(n,e,{slice:!1,parseOptions:t})}const Zp=(n,e=!1,t={})=>({tr:r,editor:i,dispatch:s})=>{const{doc:o}=r,a=xc(n,i.schema,t);return s&&r.replaceWith(0,o.content.size,a).setMeta("preventUpdate",!e),!0};function Qp(n,e){const t=new Nl(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function em(n){for(let e=0;e{e(r)&&t.push({node:r,pos:i})}),t}function tm(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function nm(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 Js(n){return e=>nm(e.$from,n)}function rm(n,e){const t=st.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function im(n,e){const t={from:0,to:n.content.size};return Ec(n,t,e)}function Ys(n,e){const t=It(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,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===t.name);return a?{...a.attrs}:{}}function sm(n,e){const t=ye(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===t.name);return o?{...o.attrs}:{}}function Ac(n,e){const t=wi(typeof e=="string"?e:e.name,n.schema);return t==="node"?sm(n,e):t==="mark"?Ys(n,e):{}}function om(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 am(n){const e=om(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 lm(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=t[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(s).map(a,-1),u=e.slice(s).map(l),d=e.invert().map(c,-1),f=e.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),am(r)}function Kr(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n-1),o=Gs(s,i.type);!o||r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function ws(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?It(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Ur(d.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;n.doc.nodesBetween(h,p,(m,y)=>{if(!m.isText&&!m.marks.length)return;const D=Math.max(h,y),C=Math.min(p,y+m.nodeSize),_=C-D;o+=_,a.push(...m.marks.map(P=>({mark:P,from:D,to:C})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Ur(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function cm(n,e,t={}){if(!e)return ir(n,null,t)||ws(n,null,t);const r=wi(e,n.schema);return r==="node"?ir(n,e,t):r==="mark"?ws(n,e,t):!1}function Ea(n,e){const{nodeExtensions:t}=xi(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=$(N(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function um(n){var e;const t=(e=n.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=n.toJSON();return JSON.stringify(t)===JSON.stringify(r)}function dm(n,e,t){var r;const{selection:i}=e;let s=null;if(Sc(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(a)||!a.some(l=>l.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,l.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 fm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=It(n,r.schema);if(i)if(o){const c=Ys(r,l);t.addStoredMark(l.create({...c,...e}))}else a.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(D=>D.type===l)?f.marks.forEach(D=>{l===D.type&&t.addMark(p,m,l.create({...D.attrs,...e}))}):t.addMark(p,m,l.create(e))})});return dm(r,t,l)},hm=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),pm=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=ye(n,t.schema);return s.isTextblock?i().command(({commands:o})=>ha(s,e)(t)?!0:o.clearNodes()).command(({state:o})=>ha(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},mm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Vt(n,0,r.content.size),s=z.create(r,i);e.setSelection(s)}return!0},gm=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=V.atStart(r).from,a=V.atEnd(r).to,l=Vt(i,o,a),c=Vt(s,o,a),u=V.create(r,l,c);e.setSelection(u)}return!0},bm=n=>({state:e,dispatch:t})=>{const r=ye(n,e.schema);return tp(r)(e,t)};function xr(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}))}function Da(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 ym=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,c=i.extensionManager.attributes,u=xr(c,a.node().type.name,a.node().attrs);if(s instanceof z&&s.node.isBlock)return!a.parentOffset||!Sn(o,a.pos)?!1:(r&&(n&&Da(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){const d=l.parentOffset===l.parent.content.size;s instanceof V&&e.deleteSelection();const f=a.depth===0?void 0:em(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:u}]:void 0,p=Sn(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&Sn(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:u}]:void 0),p&&(e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),y=e.doc.resolve(m);a.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&Da(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},Em=n=>({tr:e,state:t,dispatch:r,editor:i})=>{var s;const o=ye(n,t.schema),{$from:a,$to:l}=t.selection,c=t.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==o)return!1;const d=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let y=x.empty;const D=a.index(-1)?1:a.index(-2)?2:3;for(let Z=a.depth-D;Z>=a.depth-3;Z-=1)y=x.from(a.node(Z).copy(y));const C=a.indexAfter(-1){if(J>-1)return!1;Z.isTextblock&&Z.content.size===0&&(J=I+1)}),J>-1&&e.setSelection(V.near(e.doc.resolve(J))),e.scrollIntoView()}return!0}const f=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,h=xr(d,u.type.name,u.attrs),p=xr(d,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);const m=f?[{type:o,attrs:h},{type:f,attrs:p}]:[{type:o,attrs:h}];return Sn(e.doc,a.pos,2)?(r&&e.split(a.pos,2,m).scrollIntoView(),!0):!1},Sa=(n,e)=>{const t=Js(o=>o.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)&&In(n.doc,t.pos)&&n.join(t.pos),!0},ka=(n,e)=>{const t=Js(o=>o.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)&&In(n.doc,r)&&n.join(r),!0},Dm=(n,e)=>({editor:t,tr:r,state:i,dispatch:s,chain:o,commands:a,can:l})=>{const{extensions:c}=t.extensionManager,u=ye(n,i.schema),d=ye(e,i.schema),{selection:f}=i,{$from:h,$to:p}=f,m=h.blockRange(p);if(!m)return!1;const y=Js(D=>Ea(D.type.name,c))(f);if(m.depth>=1&&y&&m.depth-y.depth<=1){if(y.node.type===u)return a.liftListItem(d);if(Ea(y.node.type.name,c)&&u.validContent(y.node.content)&&s)return o().command(()=>(r.setNodeMarkup(y.pos,u),!0)).command(()=>Sa(r,u)).command(()=>ka(r,u)).run()}return o().command(()=>l().wrapInList(u)?!0:a.clearNodes()).wrapInList(u).command(()=>Sa(r,u)).command(()=>ka(r,u)).run()},Sm=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=It(n,r.schema);return ws(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},km=(n,e,t={})=>({state:r,commands:i})=>{const s=ye(n,r.schema),o=ye(e,r.schema);return ir(r,s,t)?i.setNode(o):i.setNode(s,t)},Cm=(n,e={})=>({state:t,commands:r})=>{const i=ye(n,t.schema);return ir(t,i,e)?r.lift(i):r.wrapIn(i,e)},xm=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},Am=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},Mm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=It(n,r.schema),{$from:c,empty:u,ranges:d}=a;if(!i)return!0;if(u&&o){let{from:f,to:h}=a;const p=(s=c.marks().find(y=>y.type===l))===null||s===void 0?void 0:s.attrs,m=Gs(c,l,p);m&&(f=m.from,h=m.to),t.removeMark(f,h,l)}else d.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},wm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=wi(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=ye(n,r.schema)),a==="mark"&&(o=It(n,r.schema)),i&&t.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{s&&s===d.type&&t.setNodeMarkup(f,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(h=>{if(o===h.type){const p=Math.max(f,c),m=Math.min(f+d.nodeSize,u);t.addMark(p,m,o.create({...h.attrs,...e}))}})})}),!0):!1},vm=(n,e={})=>({state:t,dispatch:r})=>{const i=ye(n,t.schema);return Jh(i,e)(t,r)},Om=(n,e={})=>({state:t,dispatch:r})=>{const i=ye(n,t.schema);return Yh(i,e)(t,r)};var Tm=Object.freeze({__proto__:null,blur:bp,clearContent:yp,clearNodes:Ep,command:Dp,createParagraphNear:Sp,deleteNode:kp,deleteRange:Cp,deleteSelection:xp,enter:Ap,exitCode:Mp,extendMarkRange:vp,first:Op,focus:Tp,forEach:Np,insertContent:Rp,insertContentAt:Bp,joinBackward:Fp,joinForward:Lp,keyboardShortcut:zp,lift:Hp,liftEmptyBlock:$p,liftListItem:Up,newlineInCode:Vp,resetAttributes:Kp,scrollIntoView:Wp,selectAll:jp,selectNodeBackward:Gp,selectNodeForward:qp,selectParentNode:Jp,selectTextblockEnd:Yp,selectTextblockStart:Xp,setContent:Zp,setMark:fm,setMeta:hm,setNode:pm,setNodeSelection:mm,setTextSelection:gm,sinkListItem:bm,splitBlock:ym,splitListItem:Em,toggleList:Dm,toggleMark:Sm,toggleNode:km,toggleWrap:Cm,undoInputRule:xm,unsetAllMarks:Am,unsetMark:Mm,updateAttributes:wm,wrapIn:vm,wrapInList:Om});const Nm=xe.create({name:"commands",addCommands(){return{...Tm}}}),Rm=xe.create({name:"editable",addProseMirrorPlugins(){return[new Oe({key:new je("editable"),props:{editable:()=>this.editor.options.editable}})]}}),_m=xe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Oe({key:new je("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}}}})]}}),Im=xe.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:h}=d,p=U.atStart(c).from===f;return!u||!p||!h.type.isTextblock||h.textContent.length?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.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},s={...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 qs()||Cc()?s:i},addProseMirrorPlugins(){return[new Oe({key:new je("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(p=>p.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:s,to:o}=e.selection,a=U.atStart(e.doc).from,l=U.atEnd(e.doc).to,c=s===a&&o===l,u=t.doc.textBetween(0,t.doc.content.size," "," ").length===0;if(i||!c||!u)return;const d=t.tr,f=ki({state:t,transaction:d}),{commands:h}=new Ci({editor:this.editor,state:f});if(h.clearNodes(),!!d.steps.length)return d}})]}}),Bm=xe.create({name:"tabindex",addProseMirrorPlugins(){return[new Oe({key:new je("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Fm=Object.freeze({__proto__:null,ClipboardTextSerializer:gp,Commands:Nm,Editable:Rm,FocusEvents:_m,Keymap:Im,Tabindex:Bm});const Lm=`.ProseMirror { 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: 1px !important; height: 1px !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s 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; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`;function Pm(n,e){const t=document.querySelector("style[data-tiptap-style]");if(t!==null)return t;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r),r}class zm extends np{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>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.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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},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=Pm(Lm,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){this.setOptions({editable:e}),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=yc(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const t=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(t))});this.view.updateState(r)}createExtensionManager(){const t=[...this.options.enableCoreExtensions?Object.values(Fm):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r==null?void 0:r.type));this.extensionManager=new pn(t,this)}createCommandManager(){this.commandManager=new Ci({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=xc(this.options.content,this.schema,this.options.parseOptions),t=kc(e,this.options.autofocus);this.view=new xh(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:dn.create({doc:e,selection:t||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Ac(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return cm(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return rm(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=` `,textSerializers:r={}}=e||{};return im(this.state.doc,{blockSeparator:t,textSerializers:{...r,...Dc(this.schema)}})}get isEmpty(){return um(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(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}}function Nn(n){return new Ai({find:n.find,handler:({state:e,range:t,match:r})=>{const i=$(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];let l=t.to;if(o){const c=a.search(/\S/),u=t.from+a.indexOf(o),d=u+o.length;if(Kr(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>u).length)return null;dt.from&&s.delete(t.from+c,u),l=t.from+c+o.length,s.addMark(t.from+c,l,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function Mc(n){return new Ai({find:n.find,handler:({state:e,range:t,match:r})=>{const i=$(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);let c=o+l;c>a?c=a:a=c+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(c,a,n.type.create(i))}else r[0]&&s.replaceWith(o,a,n.type.create(i))}})}function vs(n){return new Ai({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=$(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 Xs(n){return new Ai({find:n.find,handler:({state:e,range:t,match:r})=>{const i=$(n.getAttributes,void 0,r)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),l=a&&Is(a,n.type,i);if(!l)return null;s.wrap(a,l);const c=s.doc.resolve(t.from-1).nodeBefore;c&&c.type===n.type&&In(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,c))&&s.join(t.from-1)}})}class He{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&&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=$(N(this,"addOptions",{name:this.name}))),this.storage=$(N(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new He(e)}configure(e={}){const t=this.extend();return t.options=Mi(this.options,e),t.storage=$(N(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new He(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=$(N(t,"addOptions",{name:t.name})),t.storage=$(N(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 o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===t.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}class Ae{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&&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=$(N(this,"addOptions",{name:this.name}))),this.storage=$(N(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ae(e)}configure(e={}){const t=this.extend();return t.options=Mi(this.options,e),t.storage=$(N(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Ae(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=$(N(t,"addOptions",{name:t.name})),t.storage=$(N(t,"addStorage",{name:t.name,options:t.options})),t}}function en(n){return new up({find:n.find,handler:({state:e,range:t,match:r})=>{const i=$(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];let l=t.to;if(o){const c=a.search(/\S/),u=t.from+a.indexOf(o),d=u+o.length;if(Kr(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>u).length)return null;dt.from&&s.delete(t.from+c,u),l=t.from+c+o.length,s.addMark(t.from+c,l,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}class Hm extends zm{constructor(){super(...arguments),this.contentComponent=null}}const $m=({renderers:n})=>g(dr,{children:Object.entries(n).map(([e,t])=>uu.createPortal(t.reactElement,t.element,e))});class Um extends vr.Component{constructor(e){super(e),this.editorContentRef=vr.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(...e.options.element.childNodes),e.setOptions({element:t}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?cu.exports.flushSync(e):e()}setRenderer(e,t){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:t}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:t})=>{const r={...t};return delete r[e],{renderers:r}})})}componentWillUnmount(){const{editor:e}=this.props;if(!e||(e.isDestroyed||e.view.setProps({nodeViews:{}}),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,...t}=this.props;return K(dr,{children:[g("div",{ref:this.editorContentRef,...t}),g($m,{renderers:this.state.renderers})]})}}const Vm=vr.memo(Um),Km=ue.exports.createContext({onDragStart:void 0}),Wm=()=>ue.exports.useContext(Km);vr.forwardRef((n,e)=>{const{onDragStart:t}=Wm(),r=n.as||"div";return g(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function jm(){const[,n]=ue.exports.useState(0);return()=>n(e=>e+1)}const Gm=(n={},e=[])=>{const[t,r]=ue.exports.useState(null),i=jm();return ue.exports.useEffect(()=>{let s=!0;const o=new Hm(n);return r(o),o.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{s&&i()})})}),()=>{o.destroy(),s=!1}},e),t},qm=/^\s*>\s$/,Jm=Ae.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",re(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[Xs({find:qm,type:this.type})]}}),Ym=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,Xm=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,Zm=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,Qm=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,eg=He.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",re(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[Nn({find:Ym,type:this.type}),Nn({find:Zm,type:this.type})]},addPasteRules(){return[en({find:Xm,type:this.type}),en({find:Qm,type:this.type})]}}),tg=/^\s*([-+*])\s$/,ng=Ae.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",re(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){return[Xs({find:tg,type:this.type})]}}),rg=/(?:^|\s)((?:`)((?:[^`]+))(?:`))$/,ig=/(?:^|\s)((?:`)((?:[^`]+))(?:`))/g,sg=He.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",re(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[Nn({find:rg,type:this.type})]},addPasteRules(){return[en({find:ig,type:this.type})]}}),og=/^```([a-z]+)?[\s\n]$/,ag=/^~~~([a-z]+)?[\s\n]$/,wc=Ae.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",re(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 s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` `);return!s||!o?!1:n.chain().command(({tr:a})=>(a.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 a=i.after();return a===void 0||r.nodeAt(a)?!1:n.commands.exitCode()}}},addInputRules(){return[vs({find:og,type:this.type,getAttributes:n=>({language:n[1]})}),vs({find:ag,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Oe({key:new je("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==null?void 0:i.mode;if(!t||!s)return!1;const{tr:o}=n.state;return o.replaceSelectionWith(this.type.create({language:s})),o.setSelection(V.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(t.replace(/\r\n?/g,` `)),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),lg=Ae.create({name:"doc",topNode:!0,content:"block+"});function cg(n={}){return new Oe({view(e){return new ug(e,n)}})}class ug{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width||1,this.color=t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t;if(!e.parent.inlineContent){let o=e.nodeBefore,a=e.nodeAfter;if(o||a){let l=this.editorView.nodeDOM(this.cursorPos-(o?o.nodeSize:0)).getBoundingClientRect(),c=o?l.bottom:l.top;o&&a&&(c=(c+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:l.left,right:l.right,top:c-this.width/2,bottom:c+this.width/2}}}if(!t){let o=this.editorView.coordsAtPos(this.cursorPos);t={left:o.left-this.width/2,right:o.left+this.width/2,top:o.top,bottom:o.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none; background-color: "+this.color);let i,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")i=-pageXOffset,s=-pageYOffset;else{let o=r.getBoundingClientRect();i=o.left-r.scrollLeft,s=o.top-r.scrollTop}this.element.style.left=t.left-i+"px",this.element.style.top=t.top-s+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.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,s=typeof i=="function"?i(this.editorView,t):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&(o=Ml(this.editorView.state.doc,o,this.editorView.dragging.slice),o==null))return this.setCursor(null);this.setCursor(o),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 dg=xe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[cg(this.options)]}});class se extends U{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return se.valid(r)?new se(r):U.near(r)}content(){return T.empty}eq(e){return e instanceof se&&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 se(e.resolve(t.pos))}getBookmark(){return new Zs(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!fg(e)||!hg(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&&se.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(t>0?e.indexAfter(o)0){s=a.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let l=e.doc.resolve(i);if(se.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!z.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let a=e.doc.resolve(i);if(se.valid(a))return a}return null}}}se.prototype.visible=!1;se.findFrom=se.findGapCursorFrom;U.jsonID("gapcursor",se);class Zs{constructor(e){this.pos=e}map(e){return new Zs(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return se.valid(t)?new se(t):U.near(t)}}function fg(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 hg(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 pg(){return new Oe({props:{decorations:yg,createSelectionBetween(n,e,t){return e.pos==t.pos&&se.valid(t)?new se(t):null},handleClick:gg,handleKeyDown:mg,handleDOMEvents:{beforeinput:bg}}})}const mg=dc({ArrowLeft:br("horiz",-1),ArrowRight:br("horiz",1),ArrowUp:br("vert",-1),ArrowDown:br("vert",1)});function br(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof V){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=se.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new se(c))),!0):!1}}function gg(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!se.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 se(r))),!0)}function bg(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof se))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=x.empty;for(let o=r.length-1;o>=0;o--)i=x.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new T(i,0,0));return s.setSelection(V.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function yg(n){if(!(n.selection instanceof se))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ce.create(n.doc,[ze.widget(n.selection.head,e,{key:"gapcursor"})])}const Eg=xe.create({name:"gapCursor",addProseMirrorPlugins(){return[pg()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=$(N(n,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Dg=Ae.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",re(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:a}=r.extensionManager,l=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Sg=Ae.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]}`,re(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=>vs({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var Wr=200,Ce=function(){};Ce.prototype.append=function(e){return e.length?(e=Ce.from(e),!this.length&&e||e.length=t?Ce.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Ce.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ce.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)};Ce.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};Ce.from=function(e){return e instanceof Ce?e:e&&e.length?new vc(e):Ce.empty};var vc=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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Wr)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Wr)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}(Ce);Ce.empty=new vc([]);var kg=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 ra&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},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}(Ce),Oc=Ce;const Cg=500;class Je{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,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new tt(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new tt(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Je(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,t,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let u=0;uAg&&(a=xg(a,c),o-=c),new Je(a.append(s),o)}remapping(e,t){let r=new Dn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new Je(this.items.append(e.map(t=>new tt(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=t;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(l+1,h));y&&a++,r.push(new tt(p,m,y))}else r.push(new tt(p))},i);let c=[];for(let f=t;fCg&&(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=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(t.slice(r)),c=l&&l.getMap();if(r--,c&&t.appendMap(c,r),l){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let d=new tt(c.invert(),l,u),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new Je(Oc.from(i.reverse()),s)}}Je.empty=new Je(Oc.empty,0);function xg(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class tt{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 tt(t.getMap().invert(),t,this.selection)}}}class Dt{constructor(e,t,r,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i}}const Ag=20;function Mg(n,e,t,r){let i=t.getMeta(Tt),s;if(i)return i.historyState;t.getMeta(vg)&&(n=new Dt(n.done,n.undone,null,0));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Tt))return o.getMeta(Tt).redo?new Dt(n.done.addTransform(t,void 0,r,Ar(e)),n.undone,Ca(t.mapping.maps[t.steps.length-1]),n.prevTime):new Dt(n.done,n.undone.addTransform(t,void 0,r,Ar(e)),null,n.prevTime);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.prevTime==0||!o&&(n.prevTime<(t.time||0)-r.newGroupDelay||!wg(t,n.prevRanges)),l=o?is(n.prevRanges,t.mapping):Ca(t.mapping.maps[t.steps.length-1]);return new Dt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,Ar(e)),Je.empty,l,t.time)}else return(s=t.getMeta("rebased"))?new Dt(n.done.rebased(t,s),n.undone.rebased(t,s),is(n.prevRanges,t.mapping),n.prevTime):new Dt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),is(n.prevRanges,t.mapping),n.prevTime)}function wg(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s=e[s]&&(t=!0)}),t}function Ca(n){let e=[];return n.forEach((t,r,i,s)=>e.push(i,s)),e}function is(n,e){if(!n)return null;let t=[];for(let r=0;r{let t=Tt.getState(n);return!t||t.done.eventCount==0?!1:(e&&Tc(t,n,e,!1),!0)},Rc=(n,e)=>{let t=Tt.getState(n);return!t||t.undone.eventCount==0?!1:(e&&Tc(t,n,e,!0),!0)},Tg=xe.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Nc(n,e),redo:()=>({state:n,dispatch:e})=>Rc(n,e)}},addProseMirrorPlugins(){return[Og(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}}),Ng=Ae.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",re(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n})=>n().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{var r;if(t){const{$to:i}=e.selection,s=i.end();if(i.nodeAfter)e.setSelection(V.create(e.doc,i.pos));else{const o=(r=i.parent.type.contentMatch.defaultType)===null||r===void 0?void 0:r.create();o&&(e.insert(s,o),e.setSelection(V.create(e.doc,s)))}e.scrollIntoView()}return!0}).run()}},addInputRules(){return[Mc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Rg=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,_g=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,Ig=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,Bg=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,Fg=He.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",re(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[Nn({find:Rg,type:this.type}),Nn({find:Ig,type:this.type})]},addPasteRules(){return[en({find:_g,type:this.type}),en({find:Bg,type:this.type})]}}),Lg=Ae.create({name:"listItem",addOptions(){return{HTMLAttributes:{}}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",re(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)}}}),Pg=/^(\d+)\.\s$/,zg=Ae.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",re(this.options.HTMLAttributes,t),0]:["ol",re(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){return[Xs({find:Pg,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:(n,e)=>e.childCount+e.attrs.start===+n[1]})]}}),Hg=Ae.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",re(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),$g=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,Ug=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,Vg=He.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",re(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-x":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Nn({find:$g,type:this.type})]},addPasteRules(){return[en({find:Ug,type:this.type})]}}),Kg=Ae.create({name:"text",group:"inline"}),Wg=xe.create({name:"starterKit",addExtensions(){var n,e,t,r,i,s,o,a,l,c,u,d,f,h,p,m,y,D;const C=[];return this.options.blockquote!==!1&&C.push(Jm.configure((n=this.options)===null||n===void 0?void 0:n.blockquote)),this.options.bold!==!1&&C.push(eg.configure((e=this.options)===null||e===void 0?void 0:e.bold)),this.options.bulletList!==!1&&C.push(ng.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&C.push(sg.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&C.push(wc.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&C.push(lg.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&C.push(dg.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&C.push(Eg.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&C.push(Dg.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&C.push(Sg.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&C.push(Tg.configure((u=this.options)===null||u===void 0?void 0:u.history)),this.options.horizontalRule!==!1&&C.push(Ng.configure((d=this.options)===null||d===void 0?void 0:d.horizontalRule)),this.options.italic!==!1&&C.push(Fg.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&C.push(Lg.configure((h=this.options)===null||h===void 0?void 0:h.listItem)),this.options.orderedList!==!1&&C.push(zg.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&C.push(Hg.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&C.push(Vg.configure((y=this.options)===null||y===void 0?void 0:y.strike)),this.options.text!==!1&&C.push(Kg.configure((D=this.options)===null||D===void 0?void 0:D.text)),C}}),jg=He.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",re(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()}}});function Qs(n){this.j={},this.jr=[],this.jd=null,this.t=n}Qs.prototype={accepts:function(){return!!this.t},tt:function(e,t){if(t&&t.j)return this.j[e]=t,t;var r=t,i=this.j[e];if(i)return r&&(i.t=r),i;i=ee();var s=jr(this,e);return s?(Object.assign(i.j,s.j),i.jr.append(s.jr),i.jr=s.jd,i.t=r||s.t):i.t=r,this.j[e]=i,i}};var ee=function(){return new Qs},L=function(e){return new Qs(e)},w=function(e,t,r){e.j[t]||(e.j[t]=r)},he=function(e,t,r){e.jr.push([t,r])},jr=function(e,t){var r=e.j[t];if(r)return r;for(var i=0;i=o)return[];for(;s0&&arguments[0]!==void 0?arguments[0]:[],e=ee(),t=L(Ue),r=L(qe),i=ee(),s=L(_c),o=[[Vn,r],[Hn,r],[$n,r],[Un,r]],a=function(){var P=L(qe);return P.j={"-":i},P.jr=[].concat(o),P},l=function(P){var H=a();return H.t=P,H};Gg(e,[["'",L(qr)],["{",L(mn)],["[",L(Xn)],["<",L(Zn)],["(",L(Qn)],["}",L($t)],["]",L(gn)],[">",L(bn)],[")",L(yn)],["&",L(Gr)],["*",L(Jr)],["@",L(En)],["`",L(Xr)],["^",L(Zr)],[":",L(er)],[",",L(no)],["$",L(Qr)],[".",L(St)],["=",L(ei)],["!",L(ro)],["-",L(ti)],["%",L(ni)],["|",L(ri)],["+",L(ii)],["#",L(si)],["?",L(oi)],['"',L(io)],["/",L(pt)],[";",L(so)],["~",L(ai)],["_",L(li)],["\\",L(Yr)]]),w(e,` `,L(to)),he(e,Ma,s),w(s,` `,ee()),he(s,Ma,s);for(var c=0;c=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.substr(s-c,c),s:s-c,e:s})}return i}function Xg(n){for(var e=[],t=n.length,r=0;r56319||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 Mr(n){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mr=function(e){return typeof e}:Mr=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mr(n)}var Me={defaultProtocol:"http",events:null,format:wa,formatHref:wa,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:0,className:null,attributes:null,ignoreTags:[]};function Zg(n){n=n||{},this.defaultProtocol="defaultProtocol"in n?n.defaultProtocol:Me.defaultProtocol,this.events="events"in n?n.events:Me.events,this.format="format"in n?n.format:Me.format,this.formatHref="formatHref"in n?n.formatHref:Me.formatHref,this.nl2br="nl2br"in n?n.nl2br:Me.nl2br,this.tagName="tagName"in n?n.tagName:Me.tagName,this.target="target"in n?n.target:Me.target,this.rel="rel"in n?n.rel:Me.rel,this.validate="validate"in n?n.validate:Me.validate,this.truncate="truncate"in n?n.truncate:Me.truncate,this.className="className"in n?n.className:Me.className,this.attributes=n.attributes||Me.attributes,this.ignoreTags=[];for(var e=("ignoreTags"in n)?n.ignoreTags:Me.ignoreTags,t=0;t2&&arguments[2]!==void 0?arguments[2]:{},r=Object.create(n.prototype);for(var i in t)r[i]=t[i];return r.constructor=e,e.prototype=r,e}function ui(){}ui.prototype={t:"token",isLink:!1,toString:function(){return this.v},toHref:function(){return this.toString()},startIndex:function(){return this.tk[0].s},endIndex:function(){return this.tk[this.tk.length-1].e},toObject:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Me.defaultProtocol;return{type:this.t,value:this.v,isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}}};function tn(n,e){function t(r,i){this.t=n,this.v=r,this.tk=i}return Qg(ui,t,e),t}var Ic=tn("email",{isLink:!0}),Os=tn("email",{isLink:!0,toHref:function(){return"mailto:"+this.toString()}}),Ts=tn("text"),Bc=tn("nl"),Et=tn("url",{isLink:!0,toHref:function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Me.defaultProtocol,t=this.tk,r=!1,i=!1,s=[],o=0;t[o].t===Rn;)r=!0,s.push(t[o].v),o++;for(;t[o].t===pt;)i=!0,s.push(t[o].v),o++;for(;o=0&&f++,i++,u++;if(f<0)for(var h=i-u;h0&&(s.push(as(Ts,e,o)),o=[]),i-=f,u-=f;var p=d.t,m=t.slice(i-u,i);s.push(as(p,e,m))}}return o.length>0&&s.push(as(Ts,e,o)),s}function as(n,e,t){var r=t[0].s,i=t[t.length-1].e,s=e.substr(r,i-r);return new n(s,t)}var rb=typeof console<"u"&&console&&console.warn||function(){},pe={scanner:null,parser:null,pluginQueue:[],customProtocols:[],initialized:!1};function ib(){pe.scanner=null,pe.parser=null,pe.pluginQueue=[],pe.customProtocols=[],pe.initialized=!1}function sb(n){if(pe.initialized&&rb('linkifyjs: already initialized - will not register custom protocol "'.concat(n,'" until you manually call linkify.init(). To avoid this warning, please register all custom protocols before invoking linkify the first time.')),!/^[a-z-]+$/.test(n))throw Error("linkifyjs: protocols containing characters other than a-z or - (hyphen) are not supported");pe.customProtocols.push(n)}function ob(){pe.scanner={start:Jg(pe.customProtocols),tokens:qg},pe.parser={start:tb(),tokens:eb};for(var n={createTokenClass:tn},e=0;e1&&arguments[1]!==void 0?arguments[1]:null,t=Fc(n),r=[],i=0;i1&&arguments[1]!==void 0?arguments[1]:null,t=Fc(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}function ab(n){return new Oe({key:new je("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(u=>u.docChanged)&&!t.doc.eq(r.doc),s=e.some(u=>u.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=Qp(t.doc,[...e]),{mapping:l}=a;if(lm(a).forEach(({oldRange:u,newRange:d})=>{Kr(u.from,u.to,t.doc).filter(m=>m.mark.type===n.type).forEach(m=>{const y=l.map(m.from),D=l.map(m.to),C=Kr(y,D,r.doc).filter(I=>I.mark.type===n.type);if(!C.length)return;const _=C[0],P=t.doc.textBetween(m.from,m.to,void 0," "),H=r.doc.textBetween(_.from,_.to,void 0," "),J=va(P),Z=va(H);J&&!Z&&o.removeMark(_.from,_.to,n.type)});const f=tm(r.doc,d,m=>m.isTextblock);let h,p;if(f.length>1?(h=f[0],p=r.doc.textBetween(h.pos,h.pos+h.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(d.from,d.to," "," ").endsWith(" ")&&(h=f[0],p=r.doc.textBetween(h.pos,d.to,void 0," ")),h&&p){const m=p.split(" ").filter(C=>C!=="");if(m.length<=0)return!1;const y=m[m.length-1],D=h.pos+p.lastIndexOf(y);if(!y)return!1;oo(y).filter(C=>C.isLink).filter(C=>n.validate?n.validate(C.value):!0).map(C=>({...C,from:D+C.start+1,to:D+C.end+1})).forEach(C=>{o.addMark(C.from,C.to,n.type.create({href:C.href}))})}}),!!o.steps.length)return o}})}function lb(n){return new Oe({key:new je("handleClickLink"),props:{handleClick:(e,t,r)=>{var i;const s=Ac(e.state,n.type.name);return((i=r.target)===null||i===void 0?void 0:i.closest("a"))&&s.href?(window.open(s.href,s.target),!0):!1}}})}function cb(n){return new Oe({key:new je("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=oo(a).find(c=>c.isLink&&c.value===a);return!a||!l?!1:(n.editor.commands.setMark(n.type,{href:l.href}),!0)}}})}const ub=He.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(sb)},onDestroy(){ib()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){return["a",re(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[en({find:n=>oo(n).filter(e=>this.options.validate?this.options.validate(e.value):!0).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(ab({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(lb({type:this.type})),this.options.linkOnPaste&&n.push(cb({editor:this.editor,type:this.type})),n}}),db=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,fb=Ae.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",re(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Mc({find:db,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),hb=He.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",re(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()}}}),pb=He.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",re(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()}}}),mb=He.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",re(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Ys(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),gb=xe.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()}}}),bb=xe.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});var ao={exports:{}};function lo(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(function(e){var t=n[e];typeof t=="object"&&!Object.isFrozen(t)&&lo(t)}),n}ao.exports=lo;ao.exports.default=lo;class Oa{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Lc(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Mt(n,...e){const t=Object.create(null);for(const r in n)t[r]=n[r];return e.forEach(function(r){for(const i in r)t[i]=r[i]}),t}const yb="",Ta=n=>!!n.scope||n.sublanguage&&n.language,Eb=(n,{prefix:e})=>{if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};class Db{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Lc(e)}openNode(e){if(!Ta(e))return;let t="";e.sublanguage?t=`language-${e.language}`:t=Eb(e.scope,{prefix:this.classPrefix}),this.span(t)}closeNode(e){!Ta(e)||(this.buffer+=yb)}value(){return this.buffer}span(e){this.buffer+=``}}const Na=(n={})=>{const e={children:[]};return Object.assign(e,n),e};class co{constructor(){this.rootNode=Na(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=Na({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t=="string"?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(r=>this._walk(e,r)),e.closeNode(t)),e}static _collapse(e){typeof e!="string"&&(!e.children||(e.children.every(t=>typeof t=="string")?e.children=[e.children.join("")]:e.children.forEach(t=>{co._collapse(t)})))}}class Sb extends co{constructor(e){super(),this.options=e}addKeyword(e,t){e!==""&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){e!==""&&this.add(e)}addSublanguage(e,t){const r=e.root;r.sublanguage=!0,r.language=t,this.add(r)}toHTML(){return new Db(this,this.options).value()}finalize(){return!0}}function sr(n){return n?typeof n=="string"?n:n.source:null}function Pc(n){return nn("(?=",n,")")}function kb(n){return nn("(?:",n,")*")}function Cb(n){return nn("(?:",n,")?")}function nn(...n){return n.map(t=>sr(t)).join("")}function xb(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function uo(...n){return"("+(xb(n).capture?"":"?:")+n.map(r=>sr(r)).join("|")+")"}function zc(n){return new RegExp(n.toString()+"|").exec("").length-1}function Ab(n,e){const t=n&&n.exec(e);return t&&t.index===0}const Mb=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function fo(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const i=t;let s=sr(r),o="";for(;s.length>0;){const a=Mb.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&t++)}return o}).map(r=>`(${r})`).join(e)}const wb=/\b\B/,Hc="[a-zA-Z]\\w*",ho="[a-zA-Z_]\\w*",$c="\\b\\d+(\\.\\d+)?",Uc="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Vc="\\b(0b[01]+)",vb="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Ob=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=nn(e,/.*\b/,n.binary,/\b.*/)),Mt({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},or={begin:"\\\\[\\s\\S]",relevance:0},Tb={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[or]},Nb={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[or]},Rb={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},vi=function(n,e,t={}){const r=Mt({scope:"comment",begin:n,end:e,contains:[]},t);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=uo("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:nn(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},_b=vi("//","$"),Ib=vi("/\\*","\\*/"),Bb=vi("#","$"),Fb={scope:"number",begin:$c,relevance:0},Lb={scope:"number",begin:Uc,relevance:0},Pb={scope:"number",begin:Vc,relevance:0},zb={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[or,{begin:/\[/,end:/\]/,relevance:0,contains:[or]}]}]},Hb={scope:"title",begin:Hc,relevance:0},$b={scope:"title",begin:ho,relevance:0},Ub={begin:"\\.\\s*"+ho,relevance:0},Vb=function(n){return Object.assign(n,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})};var yr=Object.freeze({__proto__:null,MATCH_NOTHING_RE:wb,IDENT_RE:Hc,UNDERSCORE_IDENT_RE:ho,NUMBER_RE:$c,C_NUMBER_RE:Uc,BINARY_NUMBER_RE:Vc,RE_STARTERS_RE:vb,SHEBANG:Ob,BACKSLASH_ESCAPE:or,APOS_STRING_MODE:Tb,QUOTE_STRING_MODE:Nb,PHRASAL_WORDS_MODE:Rb,COMMENT:vi,C_LINE_COMMENT_MODE:_b,C_BLOCK_COMMENT_MODE:Ib,HASH_COMMENT_MODE:Bb,NUMBER_MODE:Fb,C_NUMBER_MODE:Lb,BINARY_NUMBER_MODE:Pb,REGEXP_MODE:zb,TITLE_MODE:Hb,UNDERSCORE_TITLE_MODE:$b,METHOD_GUARD:Ub,END_SAME_AS_BEGIN:Vb});function Kb(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function Wb(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function jb(n,e){!e||!n.beginKeywords||(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=Kb,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function Gb(n,e){!Array.isArray(n.illegal)||(n.illegal=uo(...n.illegal))}function qb(n,e){if(!!n.match){if(n.begin||n.end)throw new Error("begin & end are not supported with match");n.begin=n.match,delete n.match}}function Jb(n,e){n.relevance===void 0&&(n.relevance=1)}const Yb=(n,e)=>{if(!n.beforeMatch)return;if(n.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},n);Object.keys(n).forEach(r=>{delete n[r]}),n.keywords=t.keywords,n.begin=nn(t.beforeMatch,Pc(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},Xb=["of","and","for","in","not","or","if","then","parent","list","value"],Zb="keyword";function Kc(n,e,t=Zb){const r=Object.create(null);return typeof n=="string"?i(t,n.split(" ")):Array.isArray(n)?i(t,n):Object.keys(n).forEach(function(s){Object.assign(r,Kc(n[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,Qb(l[0],l[1])]})}}function Qb(n,e){return e?Number(e):e0(n)?0:1}function e0(n){return Xb.includes(n.toLowerCase())}const Ra={},qt=n=>{console.error(n)},_a=(n,...e)=>{console.log(`WARN: ${n}`,...e)},on=(n,e)=>{Ra[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),Ra[`${n}/${e}`]=!0)},di=new Error;function Wc(n,e,{key:t}){let r=0;const i=n[t],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=zc(e[a-1]);n[t]=o,n[t]._emit=s,n[t]._multi=!0}function t0(n){if(!!Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw qt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),di;if(typeof n.beginScope!="object"||n.beginScope===null)throw qt("beginScope must be object"),di;Wc(n,n.begin,{key:"beginScope"}),n.begin=fo(n.begin,{joinWith:""})}}function n0(n){if(!!Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw qt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),di;if(typeof n.endScope!="object"||n.endScope===null)throw qt("endScope must be object"),di;Wc(n,n.end,{key:"endScope"}),n.end=fo(n.end,{joinWith:""})}}function r0(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function i0(n){r0(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),t0(n),n0(n)}function s0(n){function e(o,a){return new RegExp(sr(o),"m"+(n.case_insensitive?"i":"")+(n.unicodeRegex?"u":"")+(a?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=zc(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(fo(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new t;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[Wb,qb,i0,Yb].forEach(u=>u(o,a)),n.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[jb,Gb,Jb].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=Kc(o.keywords,n.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=sr(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return o0(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(n.compilerExtensions||(n.compilerExtensions=[]),n.contains&&n.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return n.classNameAliases=Mt(n.classNameAliases||{}),s(n)}function jc(n){return n?n.endsWithParent||jc(n.starts):!1}function o0(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return Mt(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:jc(n)?Mt(n,{starts:n.starts?Mt(n.starts):null}):Object.isFrozen(n)?Mt(n):n}var a0="11.6.0";class l0 extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const ls=Lc,Ia=Mt,Ba=Symbol("nomatch"),c0=7,u0=function(n){const e=Object.create(null),t=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Sb};function l(b){return a.noHighlightRe.test(b)}function c(b){let S=b.className+" ";S+=b.parentNode?b.parentNode.className:"";const M=a.languageDetectRe.exec(S);if(M){const O=W(M[1]);return O||(_a(s.replace("{}",M[1])),_a("Falling back to no-highlight mode for this block.",b)),O?M[1]:"no-highlight"}return S.split(/\s+/).find(O=>l(O)||W(O))}function u(b,S,M){let O="",R="";typeof S=="object"?(O=b,M=S.ignoreIllegals,R=S.language):(on("10.7.0","highlight(lang, code, ...args) has been deprecated."),on("10.7.0",`Please use highlight(code, options) instead. https://github.com/highlightjs/highlight.js/issues/2277`),R=b,O=S),M===void 0&&(M=!0);const Y={code:O,language:R};ie("before:highlight",Y);const le=Y.result?Y.result:d(Y.language,Y.code,M);return le.code=Y.code,ie("after:highlight",le),le}function d(b,S,M,O){const R=Object.create(null);function Y(E,k){return E.keywords[k]}function le(){if(!A.keywords){j.addText(F);return}let E=0;A.keywordPatternRe.lastIndex=0;let k=A.keywordPatternRe.exec(F),v="";for(;k;){v+=F.substring(E,k.index);const B=De.case_insensitive?k[0].toLowerCase():k[0],X=Y(A,B);if(X){const[de,Bi]=X;if(j.addText(v),v="",R[B]=(R[B]||0)+1,R[B]<=c0&&(dt+=Bi),de.startsWith("_"))v+=k[0];else{const Fi=De.classNameAliases[de]||de;j.addKeyword(k[0],Fi)}}else v+=k[0];E=A.keywordPatternRe.lastIndex,k=A.keywordPatternRe.exec(F)}v+=F.substring(E),j.addText(v)}function ct(){if(F==="")return;let E=null;if(typeof A.subLanguage=="string"){if(!e[A.subLanguage]){j.addText(F);return}E=d(A.subLanguage,F,!0,Pn[A.subLanguage]),Pn[A.subLanguage]=E._top}else E=h(F,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(dt+=E.relevance),j.addSublanguage(E._emitter,E.language)}function ne(){A.subLanguage!=null?ct():le(),F=""}function Ee(E,k){let v=1;const B=k.length-1;for(;v<=B;){if(!E._emit[v]){v++;continue}const X=De.classNameAliases[E[v]]||E[v],de=k[v];X?j.addKeyword(de,X):(F=de,le(),F=""),v++}}function Bn(E,k){return E.scope&&typeof E.scope=="string"&&j.openNode(De.classNameAliases[E.scope]||E.scope),E.beginScope&&(E.beginScope._wrap?(j.addKeyword(F,De.classNameAliases[E.beginScope._wrap]||E.beginScope._wrap),F=""):E.beginScope._multi&&(Ee(E.beginScope,k),F="")),A=Object.create(E,{parent:{value:A}}),A}function Fn(E,k,v){let B=Ab(E.endRe,v);if(B){if(E["on:end"]){const X=new Oa(E);E["on:end"](k,X),X.isMatchIgnored&&(B=!1)}if(B){for(;E.endsParent&&E.parent;)E=E.parent;return E}}if(E.endsWithParent)return Fn(E.parent,k,v)}function Ti(E){return A.matcher.regexIndex===0?(F+=E[0],1):(Lt=!0,0)}function Ni(E){const k=E[0],v=E.rule,B=new Oa(v),X=[v.__beforeBegin,v["on:begin"]];for(const de of X)if(!!de&&(de(E,B),B.isMatchIgnored))return Ti(k);return v.skip?F+=k:(v.excludeBegin&&(F+=k),ne(),!v.returnBegin&&!v.excludeBegin&&(F=k)),Bn(v,E),v.returnBegin?0:k.length}function Ri(E){const k=E[0],v=S.substring(E.index),B=Fn(A,E,v);if(!B)return Ba;const X=A;A.endScope&&A.endScope._wrap?(ne(),j.addKeyword(k,A.endScope._wrap)):A.endScope&&A.endScope._multi?(ne(),Ee(A.endScope,E)):X.skip?F+=k:(X.returnEnd||X.excludeEnd||(F+=k),ne(),X.excludeEnd&&(F=k));do A.scope&&j.closeNode(),!A.skip&&!A.subLanguage&&(dt+=A.relevance),A=A.parent;while(A!==B.parent);return B.starts&&Bn(B.starts,E),X.returnEnd?0:k.length}function _i(){const E=[];for(let k=A;k!==De;k=k.parent)k.scope&&E.unshift(k.scope);E.forEach(k=>j.openNode(k))}let ut={};function Ln(E,k){const v=k&&k[0];if(F+=E,v==null)return ne(),0;if(ut.type==="begin"&&k.type==="end"&&ut.index===k.index&&v===""){if(F+=S.slice(k.index,k.index+1),!i){const B=new Error(`0 width match regex (${b})`);throw B.languageName=b,B.badRule=ut.rule,B}return 1}if(ut=k,k.type==="begin")return Ni(k);if(k.type==="illegal"&&!M){const B=new Error('Illegal lexeme "'+v+'" for mode "'+(A.scope||"")+'"');throw B.mode=A,B}else if(k.type==="end"){const B=Ri(k);if(B!==Ba)return B}if(k.type==="illegal"&&v==="")return 1;if(Ft>1e5&&Ft>k.index*3)throw new Error("potential infinite loop, way more iterations than matches");return F+=v,v.length}const De=W(b);if(!De)throw qt(s.replace("{}",b)),new Error('Unknown language: "'+b+'"');const Ii=s0(De);let Bt="",A=O||Ii;const Pn={},j=new a.__emitter(a);_i();let F="",dt=0,Ne=0,Ft=0,Lt=!1;try{for(A.matcher.considerAll();;){Ft++,Lt?Lt=!1:A.matcher.considerAll(),A.matcher.lastIndex=Ne;const E=A.matcher.exec(S);if(!E)break;const k=S.substring(Ne,E.index),v=Ln(k,E);Ne=E.index+v}return Ln(S.substring(Ne)),j.closeAllNodes(),j.finalize(),Bt=j.toHTML(),{language:b,value:Bt,relevance:dt,illegal:!1,_emitter:j,_top:A}}catch(E){if(E.message&&E.message.includes("Illegal"))return{language:b,value:ls(S),illegal:!0,relevance:0,_illegalBy:{message:E.message,index:Ne,context:S.slice(Ne-100,Ne+100),mode:E.mode,resultSoFar:Bt},_emitter:j};if(i)return{language:b,value:ls(S),illegal:!1,relevance:0,errorRaised:E,_emitter:j,_top:A};throw E}}function f(b){const S={value:ls(b),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return S._emitter.addText(b),S}function h(b,S){S=S||a.languages||Object.keys(e);const M=f(b),O=S.filter(W).filter($e).map(ne=>d(ne,b,!1));O.unshift(M);const R=O.sort((ne,Ee)=>{if(ne.relevance!==Ee.relevance)return Ee.relevance-ne.relevance;if(ne.language&&Ee.language){if(W(ne.language).supersetOf===Ee.language)return 1;if(W(Ee.language).supersetOf===ne.language)return-1}return 0}),[Y,le]=R,ct=Y;return ct.secondBest=le,ct}function p(b,S,M){const O=S&&t[S]||M;b.classList.add("hljs"),b.classList.add(`language-${O}`)}function m(b){let S=null;const M=c(b);if(l(M))return;if(ie("before:highlightElement",{el:b,language:M}),b.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(b)),a.throwUnescapedHTML))throw new l0("One of your code blocks includes unescaped HTML.",b.innerHTML);S=b;const O=S.textContent,R=M?u(O,{language:M,ignoreIllegals:!0}):h(O);b.innerHTML=R.value,p(b,M,R.language),b.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(b.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),ie("after:highlightElement",{el:b,result:R,text:O})}function y(b){a=Ia(a,b)}const D=()=>{P(),on("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function C(){P(),on("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _=!1;function P(){if(document.readyState==="loading"){_=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function H(){_&&P()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",H,!1);function J(b,S){let M=null;try{M=S(n)}catch(O){if(qt("Language definition for '{}' could not be registered.".replace("{}",b)),i)qt(O);else throw O;M=o}M.name||(M.name=b),e[b]=M,M.rawDefinition=S.bind(null,n),M.aliases&&oe(M.aliases,{languageName:b})}function Z(b){delete e[b];for(const S of Object.keys(t))t[S]===b&&delete t[S]}function I(){return Object.keys(e)}function W(b){return b=(b||"").toLowerCase(),e[b]||e[t[b]]}function oe(b,{languageName:S}){typeof b=="string"&&(b=[b]),b.forEach(M=>{t[M.toLowerCase()]=S})}function $e(b){const S=W(b);return S&&!S.disableAutodetect}function Ge(b){b["before:highlightBlock"]&&!b["before:highlightElement"]&&(b["before:highlightElement"]=S=>{b["before:highlightBlock"](Object.assign({block:S.el},S))}),b["after:highlightBlock"]&&!b["after:highlightElement"]&&(b["after:highlightElement"]=S=>{b["after:highlightBlock"](Object.assign({block:S.el},S))})}function ae(b){Ge(b),r.push(b)}function ie(b,S){const M=b;r.forEach(function(O){O[M]&&O[M](S)})}function Te(b){return on("10.7.0","highlightBlock will be removed entirely in v12.0"),on("10.7.0","Please use highlightElement now."),m(b)}Object.assign(n,{highlight:u,highlightAuto:h,highlightAll:P,highlightElement:m,highlightBlock:Te,configure:y,initHighlighting:D,initHighlightingOnLoad:C,registerLanguage:J,unregisterLanguage:Z,listLanguages:I,getLanguage:W,registerAliases:oe,autoDetection:$e,inherit:Ia,addPlugin:ae}),n.debugMode=function(){i=!1},n.safeMode=function(){i=!0},n.versionString=a0,n.regex={concat:nn,lookahead:Pc,either:uo,optional:Cb,anyNumberOfTimes:kb};for(const b in yr)typeof yr[b]=="object"&&ao.exports(yr[b]);return Object.assign(n,yr),n};var ar=u0({}),d0=ar;ar.HighlightJS=ar;ar.default=ar;var f0=d0;function Gc(n,e=[]){return n.map(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?Gc(t.children,r):{text:t.value,classes:r}}).flat()}function Fa(n){return n.value||n.children||[]}function h0(n){return Boolean(f0.getLanguage(n))}function La({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return Ms(n,s=>s.type.name===e).forEach(s=>{let o=s.pos+1;const a=s.node.attrs.language||r,l=t.listLanguages(),c=a&&(l.includes(a)||h0(a))?Fa(t.highlight(a,s.node.textContent)):Fa(t.highlightAuto(s.node.textContent));Gc(c).forEach(u=>{const d=o+u.text.length;if(u.classes.length){const f=ze.inline(o,d,{class:u.classes.join(" ")});i.push(f)}o=d})}),ce.create(n,i)}function p0(n){return typeof n=="function"}function m0({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>p0(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Oe({key:new je("lowlight"),state:{init:(i,{doc:s})=>La({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=Ms(o.doc,f=>f.type.name===n),d=Ms(a.doc,f=>f.type.name===n);return i.docChanged&&([l,c].includes(n)||d.length!==u.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?La({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}const g0=wc.extend({addOptions(){var n;return{...(n=this.parent)===null||n===void 0?void 0:n.call(this),lowlight:{},defaultLanguage:null}},addProseMirrorPlugins(){var n;return[...((n=this.parent)===null||n===void 0?void 0:n.call(this))||[],m0({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),b0=xe.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>n.style.backgroundColor.replace(/['"]+/g,""),renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),y0=xe.create({name:"indent",addOptions:()=>({types:["listItem","paragraph"],minLevel:0,maxLevel:6}),addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{renderHTML:n=>(n==null?void 0:n.indent)>this.options.minLevel?{"data-indent":n.indent}:null,parseHTML:n=>{const e=Number(n.getAttribute("data-indent"));return e&&e>this.options.minLevel?e:null}}}}]},addCommands(){const n=(r,i,s)=>{var a;const o=(a=r==null?void 0:r.doc)==null?void 0:a.nodeAt(i);if(o){const l=(o.attrs.indent||0)+s,{minLevel:c,maxLevel:u}=this.options,d=lu?u:l;if(d!==o.attrs.indent){const{indent:f,...h}=o.attrs,p=d>c?{...h,indent:d}:h;return r.setNodeMarkup(i,o.type,p,o.marks)}}return r},e=(r,i)=>{const{doc:s,selection:o}=r;if(s&&o&&(o instanceof V||o instanceof We)){const{from:a,to:l}=o;s.nodesBetween(a,l,(c,u)=>this.options.types.includes(c.type.name)?(r=n(r,u,i),!1):!0)}return r},t=r=>()=>({tr:i,state:s,dispatch:o})=>{const{selection:a}=s;return i=i.setSelection(a),i=e(i,r),i.docChanged?(o==null||o(i),!0):!1};return{indent:t(1),outdent:t(-1)}},addKeyboardShortcuts(){return{Tab:({editor:n})=>n.state.selection.to>n.state.selection.from?this.editor.commands.indent():!1,"Shift-Tab":({editor:n})=>n.state.selection.to>n.state.selection.from?this.editor.commands.outdent():!1}}}),E0=Ae.create({name:"embed",group:"block",atom:!0,addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",re(this.options.HTMLAttributes,n)]},addCommands(){return{setEmbed:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}}});function D0(n){const e=n.regex,t={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[n.BACKSLASH_ESCAPE]},s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,i]};i.contains.push(o);const a={className:"",begin:/\\"/},l={className:"string",begin:/'/,end:/'/},c={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},u=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],d=n.SHEBANG({binary:`(${u.join("|")})`,relevance:10}),f={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},h=["if","then","else","elif","fi","for","while","in","do","done","case","esac","function"],p=["true","false"],m={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],D=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias"],C=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],_=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:h,literal:p,built_in:[...y,...D,"set","shopt",...C,..._]},contains:[d,n.SHEBANG(),f,c,n.HASH_COMMENT_MODE,s,m,o,a,l,t]}}function S0(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",s="<[^<>]+>",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional(s)+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},l="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+l+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,n.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+n.IDENT_RE,relevance:0},h=e.optional(i)+n.IDENT_RE+"\\s*\\(",y={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},D=[d,a,t,n.C_BLOCK_COMMENT_MODE,u,c],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:y,contains:D.concat([{begin:/\(/,end:/\)/,keywords:y,contains:D.concat(["self"]),relevance:0}]),relevance:0},_={begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:y,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:y,relevance:0},{begin:h,returnBegin:!0,contains:[n.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:y,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},n.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:y}}}const k0=n=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:n.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:n.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/}}),C0=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],x0=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],A0=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],M0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],w0=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function v0(n){const e=n.regex,t=k0(n),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[t.BLOCK_COMMENT,r,t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+A0.join("|")+")"},{begin:":(:)?("+M0.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+w0.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:x0.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+C0.join("|")+")\\b"}]}}var un="[0-9](_*[0-9])*",Er=`\\.(${un})`,Dr="[0-9a-fA-F](_*[0-9a-fA-F])*",Pa={className:"number",variants:[{begin:`(\\b(${un})((${Er})|\\.)?|(${Er}))[eE][+-]?(${un})[fFdD]?\\b`},{begin:`\\b(${un})((${Er})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Er})[fFdD]?\\b`},{begin:`\\b(${un})[fFdD]\\b`},{begin:`\\b0[xX]((${Dr})\\.?|(${Dr})?\\.(${Dr}))[pP][+-]?(${un})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Dr})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function qc(n,e,t){return t===-1?"":n.replace(e,r=>qc(n,e,t-1))}function O0(n){const e=n.regex,t="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=t+qc("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+t,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[n.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[n.BACKSLASH_ESCAPE]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",3:"title.class"},contains:[u,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",n.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,Pa,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},Pa,c]}}const za="[A-Za-z$_][0-9A-Za-z$_]*",T0=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],N0=["true","false","null","undefined","NaN","Infinity"],Jc=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Yc=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Xc=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],R0=["arguments","this","super","console","window","document","localStorage","module","global"],_0=[].concat(Xc,Jc,Yc);function I0(n){const e=n.regex,t=(S,{after:M})=>{const O="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,M)=>{const O=S[0].length+S.index,R=S.input[O];if(R==="<"||R===","){M.ignoreMatch();return}R===">"&&(t(S,{after:O})||M.ignoreMatch());let Y;const le=S.input.substring(O);if(Y=le.match(/^\s*=/)){M.ignoreMatch();return}if((Y=le.match(/^\s+extends\s+/))&&Y.index===0){M.ignoreMatch();return}}},a={$pattern:za,keyword:T0,literal:N0,built_in:_0,"variable.language":R0},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},p={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,f]},D={className:"comment",variants:[n.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),n.C_BLOCK_COMMENT_MODE,n.C_LINE_COMMENT_MODE]},C=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,h,p,m,{match:/\$\d+/},d];f.contains=C.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(C)});const _=[].concat(D,f.contains),P=_.concat([{begin:/\(/,end:/\)/,keywords:a,contains:["self"].concat(_)}]),H={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:P},J={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},Z={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Jc,...Yc]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},W={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[H],illegal:/%/},oe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function $e(S){return e.concat("(?!",S.join("|"),")")}const Ge={match:e.concat(/\b/,$e([...Xc,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},ae={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},ie={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},H]},Te="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",b={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(Te)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[H]};return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:P,CLASS_REFERENCE:Z},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,h,p,m,D,{match:/\$\d+/},d,Z,{className:"attr",begin:r+e.lookahead(":"),relevance:0},b,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[D,n.REGEXP_MODE,{className:"function",begin:Te,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:P}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},W,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[H,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},ae,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[H]},Ge,oe,J,ie,{match:/\$[(.]/}]}}function B0(n){const e=n.regex,t=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),s={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},a={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=n.inherit(n.APOS_STRING_MODE,{illegal:null}),c=n.inherit(n.QUOTE_STRING_MODE,{illegal:null,contains:n.QUOTE_STRING_MODE.contains.concat(a)}),u=n.END_SAME_AS_BEGIN({begin:/<<<[ \t]*(\w+)\n/,end:/[ \t]*(\w+)\b/,contains:n.QUOTE_STRING_MODE.contains.concat(a)}),d=`[ ]`,f={scope:"string",variants:[c,l,u]},h={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},p=["false","null","true"],m=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],C={keyword:m,literal:(Ge=>{const ae=[];return Ge.forEach(ie=>{ae.push(ie),ie.toLowerCase()===ie?ae.push(ie.toUpperCase()):ae.push(ie.toLowerCase())}),ae})(p),built_in:y},_=Ge=>Ge.map(ae=>ae.replace(/\|\d+$/,"")),P={variants:[{match:[/new/,e.concat(d,"+"),e.concat("(?!",_(y).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},H=e.concat(r,"\\b(?!\\()"),J={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),H],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),H],scope:{1:"title.class",3:"variable.constant"}},{match:[i,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},Z={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},I={relevance:0,begin:/\(/,end:/\)/,keywords:C,contains:[Z,s,J,n.C_BLOCK_COMMENT_MODE,f,h,P]},W={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",_(m).join("\\b|"),"|",_(y).join("\\b|"),"\\b)"),r,e.concat(d,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[I]};I.contains.push(W);const oe=[Z,J,n.C_BLOCK_COMMENT_MODE,f,h,P],$e={begin:e.concat(/#\[\s*/,i),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:p,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:p,keyword:["new","array"]},contains:["self",...oe]},...oe,{scope:"meta",match:i}]};return{case_insensitive:!1,keywords:C,contains:[$e,n.HASH_COMMENT_MODE,n.COMMENT("//","$"),n.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:n.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},o,{scope:"variable.language",match:/\$this\b/},s,W,J,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},P,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},n.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:C,contains:["self",s,J,n.C_BLOCK_COMMENT_MODE,f,h]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},n.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[n.inherit(n.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},n.UNDERSCORE_TITLE_MODE]},f,h]}}function F0(n){const e=n.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[n.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[n.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,u,c]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${h}))[eE][+-]?(${f})[jJ]?(?=${p})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${f})[jJ](?=${p})`}]},y={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},D={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,d,n.HASH_COMMENT_MODE]}]};return c.contains=[d,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|->|\?)|=>/,contains:[l,m,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},d,y,n.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[D]},{variants:[{match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,D,d]}]}}function L0(n){const e=n.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[n.COMMENT("#","$",{contains:[a]}),n.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),n.COMMENT("^__END__",n.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[n.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[n.BACKSLASH_ESCAPE,u]})]}]},f="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},m={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},J=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[m]},{begin:n.IDENT_RE+"::"},{className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:t}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+n.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[n.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=J,m.contains=J;const Z="[>?]>",I="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",W="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",oe=[{begin:/^\s*=>/,starts:{end:"$",contains:J}},{className:"meta.prompt",begin:"^("+Z+"|"+I+"|"+W+")(?=[ ])",starts:{end:"$",keywords:o,contains:J}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[n.SHEBANG({binary:"ruby"})].concat(oe).concat(c).concat(J)}}function P0(n){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function z0(n){const e=n.regex,t=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=n.inherit(s,{begin:/\(/,end:/\)/}),a=n.inherit(n.APOS_STRING_MODE,{className:"string"}),l=n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,o,l,a]}]}]},n.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(t,/>/))),contains:[{className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}var po={exports:{}};function mo(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(function(e){var t=n[e];typeof t=="object"&&!Object.isFrozen(t)&&mo(t)}),n}po.exports=mo;po.exports.default=mo;class Ha{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Zc(n){return n.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function wt(n,...e){const t=Object.create(null);for(const r in n)t[r]=n[r];return e.forEach(function(r){for(const i in r)t[i]=r[i]}),t}const H0="",$a=n=>!!n.scope||n.sublanguage&&n.language,$0=(n,{prefix:e})=>{if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};class U0{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Zc(e)}openNode(e){if(!$a(e))return;let t="";e.sublanguage?t=`language-${e.language}`:t=$0(e.scope,{prefix:this.classPrefix}),this.span(t)}closeNode(e){!$a(e)||(this.buffer+=H0)}value(){return this.buffer}span(e){this.buffer+=``}}const Ua=(n={})=>{const e={children:[]};return Object.assign(e,n),e};class go{constructor(){this.rootNode=Ua(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=Ua({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t=="string"?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(r=>this._walk(e,r)),e.closeNode(t)),e}static _collapse(e){typeof e!="string"&&(!e.children||(e.children.every(t=>typeof t=="string")?e.children=[e.children.join("")]:e.children.forEach(t=>{go._collapse(t)})))}}class V0 extends go{constructor(e){super(),this.options=e}addKeyword(e,t){e!==""&&(this.openNode(t),this.addText(e),this.closeNode())}addText(e){e!==""&&this.add(e)}addSublanguage(e,t){const r=e.root;r.sublanguage=!0,r.language=t,this.add(r)}toHTML(){return new U0(this,this.options).value()}finalize(){return!0}}function lr(n){return n?typeof n=="string"?n:n.source:null}function Qc(n){return rn("(?=",n,")")}function K0(n){return rn("(?:",n,")*")}function W0(n){return rn("(?:",n,")?")}function rn(...n){return n.map(t=>lr(t)).join("")}function j0(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function bo(...n){return"("+(j0(n).capture?"":"?:")+n.map(r=>lr(r)).join("|")+")"}function eu(n){return new RegExp(n.toString()+"|").exec("").length-1}function G0(n,e){const t=n&&n.exec(e);return t&&t.index===0}const q0=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function yo(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const i=t;let s=lr(r),o="";for(;s.length>0;){const a=q0.exec(s);if(!a){o+=s;break}o+=s.substring(0,a.index),s=s.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+i):(o+=a[0],a[0]==="("&&t++)}return o}).map(r=>`(${r})`).join(e)}const J0=/\b\B/,tu="[a-zA-Z]\\w*",Eo="[a-zA-Z_]\\w*",nu="\\b\\d+(\\.\\d+)?",ru="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",iu="\\b(0b[01]+)",Y0="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",X0=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=rn(e,/.*\b/,n.binary,/\b.*/)),wt({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},cr={begin:"\\\\[\\s\\S]",relevance:0},Z0={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[cr]},Q0={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[cr]},ey={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Oi=function(n,e,t={}){const r=wt({scope:"comment",begin:n,end:e,contains:[]},t);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const i=bo("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:rn(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},ty=Oi("//","$"),ny=Oi("/\\*","\\*/"),ry=Oi("#","$"),iy={scope:"number",begin:nu,relevance:0},sy={scope:"number",begin:ru,relevance:0},oy={scope:"number",begin:iu,relevance:0},ay={begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[cr,{begin:/\[/,end:/\]/,relevance:0,contains:[cr]}]}]},ly={scope:"title",begin:tu,relevance:0},cy={scope:"title",begin:Eo,relevance:0},uy={begin:"\\.\\s*"+Eo,relevance:0},dy=function(n){return Object.assign(n,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})};var Sr=Object.freeze({__proto__:null,MATCH_NOTHING_RE:J0,IDENT_RE:tu,UNDERSCORE_IDENT_RE:Eo,NUMBER_RE:nu,C_NUMBER_RE:ru,BINARY_NUMBER_RE:iu,RE_STARTERS_RE:Y0,SHEBANG:X0,BACKSLASH_ESCAPE:cr,APOS_STRING_MODE:Z0,QUOTE_STRING_MODE:Q0,PHRASAL_WORDS_MODE:ey,COMMENT:Oi,C_LINE_COMMENT_MODE:ty,C_BLOCK_COMMENT_MODE:ny,HASH_COMMENT_MODE:ry,NUMBER_MODE:iy,C_NUMBER_MODE:sy,BINARY_NUMBER_MODE:oy,REGEXP_MODE:ay,TITLE_MODE:ly,UNDERSCORE_TITLE_MODE:cy,METHOD_GUARD:uy,END_SAME_AS_BEGIN:dy});function fy(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function hy(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function py(n,e){!e||!n.beginKeywords||(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=fy,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function my(n,e){!Array.isArray(n.illegal)||(n.illegal=bo(...n.illegal))}function gy(n,e){if(!!n.match){if(n.begin||n.end)throw new Error("begin & end are not supported with match");n.begin=n.match,delete n.match}}function by(n,e){n.relevance===void 0&&(n.relevance=1)}const yy=(n,e)=>{if(!n.beforeMatch)return;if(n.starts)throw new Error("beforeMatch cannot be used with starts");const t=Object.assign({},n);Object.keys(n).forEach(r=>{delete n[r]}),n.keywords=t.keywords,n.begin=rn(t.beforeMatch,Qc(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},Ey=["of","and","for","in","not","or","if","then","parent","list","value"],Dy="keyword";function su(n,e,t=Dy){const r=Object.create(null);return typeof n=="string"?i(t,n.split(" ")):Array.isArray(n)?i(t,n):Object.keys(n).forEach(function(s){Object.assign(r,su(n[s],e,s))}),r;function i(s,o){e&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[s,Sy(l[0],l[1])]})}}function Sy(n,e){return e?Number(e):ky(n)?0:1}function ky(n){return Ey.includes(n.toLowerCase())}const Va={},Jt=n=>{console.error(n)},Ka=(n,...e)=>{console.log(`WARN: ${n}`,...e)},an=(n,e)=>{Va[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),Va[`${n}/${e}`]=!0)},fi=new Error;function ou(n,e,{key:t}){let r=0;const i=n[t],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=eu(e[a-1]);n[t]=o,n[t]._emit=s,n[t]._multi=!0}function Cy(n){if(!!Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw Jt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),fi;if(typeof n.beginScope!="object"||n.beginScope===null)throw Jt("beginScope must be object"),fi;ou(n,n.begin,{key:"beginScope"}),n.begin=yo(n.begin,{joinWith:""})}}function xy(n){if(!!Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw Jt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),fi;if(typeof n.endScope!="object"||n.endScope===null)throw Jt("endScope must be object"),fi;ou(n,n.end,{key:"endScope"}),n.end=yo(n.end,{joinWith:""})}}function Ay(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function My(n){Ay(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),Cy(n),xy(n)}function wy(n){function e(o,a){return new RegExp(lr(o),"m"+(n.case_insensitive?"i":"")+(n.unicodeRegex?"u":"")+(a?"g":""))}class t{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=eu(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(yo(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new t;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function i(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function s(o,a){const l=o;if(o.isCompiled)return l;[hy,gy,My,yy].forEach(u=>u(o,a)),n.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[py,my,by].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=su(o.keywords,n.case_insensitive)),l.keywordPatternRe=e(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=e(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=e(l.end)),l.terminatorEnd=lr(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=e(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return vy(u==="self"?o:u)})),o.contains.forEach(function(u){s(u,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(n.compilerExtensions||(n.compilerExtensions=[]),n.contains&&n.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return n.classNameAliases=wt(n.classNameAliases||{}),s(n)}function au(n){return n?n.endsWithParent||au(n.starts):!1}function vy(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return wt(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:au(n)?wt(n,{starts:n.starts?wt(n.starts):null}):Object.isFrozen(n)?wt(n):n}var Oy="11.7.0";class Ty extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const cs=Zc,Wa=wt,ja=Symbol("nomatch"),Ny=7,Ry=function(n){const e=Object.create(null),t=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:V0};function l(b){return a.noHighlightRe.test(b)}function c(b){let S=b.className+" ";S+=b.parentNode?b.parentNode.className:"";const M=a.languageDetectRe.exec(S);if(M){const O=W(M[1]);return O||(Ka(s.replace("{}",M[1])),Ka("Falling back to no-highlight mode for this block.",b)),O?M[1]:"no-highlight"}return S.split(/\s+/).find(O=>l(O)||W(O))}function u(b,S,M){let O="",R="";typeof S=="object"?(O=b,M=S.ignoreIllegals,R=S.language):(an("10.7.0","highlight(lang, code, ...args) has been deprecated."),an("10.7.0",`Please use highlight(code, options) instead. https://github.com/highlightjs/highlight.js/issues/2277`),R=b,O=S),M===void 0&&(M=!0);const Y={code:O,language:R};ie("before:highlight",Y);const le=Y.result?Y.result:d(Y.language,Y.code,M);return le.code=Y.code,ie("after:highlight",le),le}function d(b,S,M,O){const R=Object.create(null);function Y(E,k){return E.keywords[k]}function le(){if(!A.keywords){j.addText(F);return}let E=0;A.keywordPatternRe.lastIndex=0;let k=A.keywordPatternRe.exec(F),v="";for(;k;){v+=F.substring(E,k.index);const B=De.case_insensitive?k[0].toLowerCase():k[0],X=Y(A,B);if(X){const[de,Bi]=X;if(j.addText(v),v="",R[B]=(R[B]||0)+1,R[B]<=Ny&&(dt+=Bi),de.startsWith("_"))v+=k[0];else{const Fi=De.classNameAliases[de]||de;j.addKeyword(k[0],Fi)}}else v+=k[0];E=A.keywordPatternRe.lastIndex,k=A.keywordPatternRe.exec(F)}v+=F.substring(E),j.addText(v)}function ct(){if(F==="")return;let E=null;if(typeof A.subLanguage=="string"){if(!e[A.subLanguage]){j.addText(F);return}E=d(A.subLanguage,F,!0,Pn[A.subLanguage]),Pn[A.subLanguage]=E._top}else E=h(F,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(dt+=E.relevance),j.addSublanguage(E._emitter,E.language)}function ne(){A.subLanguage!=null?ct():le(),F=""}function Ee(E,k){let v=1;const B=k.length-1;for(;v<=B;){if(!E._emit[v]){v++;continue}const X=De.classNameAliases[E[v]]||E[v],de=k[v];X?j.addKeyword(de,X):(F=de,le(),F=""),v++}}function Bn(E,k){return E.scope&&typeof E.scope=="string"&&j.openNode(De.classNameAliases[E.scope]||E.scope),E.beginScope&&(E.beginScope._wrap?(j.addKeyword(F,De.classNameAliases[E.beginScope._wrap]||E.beginScope._wrap),F=""):E.beginScope._multi&&(Ee(E.beginScope,k),F="")),A=Object.create(E,{parent:{value:A}}),A}function Fn(E,k,v){let B=G0(E.endRe,v);if(B){if(E["on:end"]){const X=new Ha(E);E["on:end"](k,X),X.isMatchIgnored&&(B=!1)}if(B){for(;E.endsParent&&E.parent;)E=E.parent;return E}}if(E.endsWithParent)return Fn(E.parent,k,v)}function Ti(E){return A.matcher.regexIndex===0?(F+=E[0],1):(Lt=!0,0)}function Ni(E){const k=E[0],v=E.rule,B=new Ha(v),X=[v.__beforeBegin,v["on:begin"]];for(const de of X)if(!!de&&(de(E,B),B.isMatchIgnored))return Ti(k);return v.skip?F+=k:(v.excludeBegin&&(F+=k),ne(),!v.returnBegin&&!v.excludeBegin&&(F=k)),Bn(v,E),v.returnBegin?0:k.length}function Ri(E){const k=E[0],v=S.substring(E.index),B=Fn(A,E,v);if(!B)return ja;const X=A;A.endScope&&A.endScope._wrap?(ne(),j.addKeyword(k,A.endScope._wrap)):A.endScope&&A.endScope._multi?(ne(),Ee(A.endScope,E)):X.skip?F+=k:(X.returnEnd||X.excludeEnd||(F+=k),ne(),X.excludeEnd&&(F=k));do A.scope&&j.closeNode(),!A.skip&&!A.subLanguage&&(dt+=A.relevance),A=A.parent;while(A!==B.parent);return B.starts&&Bn(B.starts,E),X.returnEnd?0:k.length}function _i(){const E=[];for(let k=A;k!==De;k=k.parent)k.scope&&E.unshift(k.scope);E.forEach(k=>j.openNode(k))}let ut={};function Ln(E,k){const v=k&&k[0];if(F+=E,v==null)return ne(),0;if(ut.type==="begin"&&k.type==="end"&&ut.index===k.index&&v===""){if(F+=S.slice(k.index,k.index+1),!i){const B=new Error(`0 width match regex (${b})`);throw B.languageName=b,B.badRule=ut.rule,B}return 1}if(ut=k,k.type==="begin")return Ni(k);if(k.type==="illegal"&&!M){const B=new Error('Illegal lexeme "'+v+'" for mode "'+(A.scope||"")+'"');throw B.mode=A,B}else if(k.type==="end"){const B=Ri(k);if(B!==ja)return B}if(k.type==="illegal"&&v==="")return 1;if(Ft>1e5&&Ft>k.index*3)throw new Error("potential infinite loop, way more iterations than matches");return F+=v,v.length}const De=W(b);if(!De)throw Jt(s.replace("{}",b)),new Error('Unknown language: "'+b+'"');const Ii=wy(De);let Bt="",A=O||Ii;const Pn={},j=new a.__emitter(a);_i();let F="",dt=0,Ne=0,Ft=0,Lt=!1;try{for(A.matcher.considerAll();;){Ft++,Lt?Lt=!1:A.matcher.considerAll(),A.matcher.lastIndex=Ne;const E=A.matcher.exec(S);if(!E)break;const k=S.substring(Ne,E.index),v=Ln(k,E);Ne=E.index+v}return Ln(S.substring(Ne)),j.closeAllNodes(),j.finalize(),Bt=j.toHTML(),{language:b,value:Bt,relevance:dt,illegal:!1,_emitter:j,_top:A}}catch(E){if(E.message&&E.message.includes("Illegal"))return{language:b,value:cs(S),illegal:!0,relevance:0,_illegalBy:{message:E.message,index:Ne,context:S.slice(Ne-100,Ne+100),mode:E.mode,resultSoFar:Bt},_emitter:j};if(i)return{language:b,value:cs(S),illegal:!1,relevance:0,errorRaised:E,_emitter:j,_top:A};throw E}}function f(b){const S={value:cs(b),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return S._emitter.addText(b),S}function h(b,S){S=S||a.languages||Object.keys(e);const M=f(b),O=S.filter(W).filter($e).map(ne=>d(ne,b,!1));O.unshift(M);const R=O.sort((ne,Ee)=>{if(ne.relevance!==Ee.relevance)return Ee.relevance-ne.relevance;if(ne.language&&Ee.language){if(W(ne.language).supersetOf===Ee.language)return 1;if(W(Ee.language).supersetOf===ne.language)return-1}return 0}),[Y,le]=R,ct=Y;return ct.secondBest=le,ct}function p(b,S,M){const O=S&&t[S]||M;b.classList.add("hljs"),b.classList.add(`language-${O}`)}function m(b){let S=null;const M=c(b);if(l(M))return;if(ie("before:highlightElement",{el:b,language:M}),b.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(b)),a.throwUnescapedHTML))throw new Ty("One of your code blocks includes unescaped HTML.",b.innerHTML);S=b;const O=S.textContent,R=M?u(O,{language:M,ignoreIllegals:!0}):h(O);b.innerHTML=R.value,p(b,M,R.language),b.result={language:R.language,re:R.relevance,relevance:R.relevance},R.secondBest&&(b.secondBest={language:R.secondBest.language,relevance:R.secondBest.relevance}),ie("after:highlightElement",{el:b,result:R,text:O})}function y(b){a=Wa(a,b)}const D=()=>{P(),an("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function C(){P(),an("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let _=!1;function P(){if(document.readyState==="loading"){_=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function H(){_&&P()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",H,!1);function J(b,S){let M=null;try{M=S(n)}catch(O){if(Jt("Language definition for '{}' could not be registered.".replace("{}",b)),i)Jt(O);else throw O;M=o}M.name||(M.name=b),e[b]=M,M.rawDefinition=S.bind(null,n),M.aliases&&oe(M.aliases,{languageName:b})}function Z(b){delete e[b];for(const S of Object.keys(t))t[S]===b&&delete t[S]}function I(){return Object.keys(e)}function W(b){return b=(b||"").toLowerCase(),e[b]||e[t[b]]}function oe(b,{languageName:S}){typeof b=="string"&&(b=[b]),b.forEach(M=>{t[M.toLowerCase()]=S})}function $e(b){const S=W(b);return S&&!S.disableAutodetect}function Ge(b){b["before:highlightBlock"]&&!b["before:highlightElement"]&&(b["before:highlightElement"]=S=>{b["before:highlightBlock"](Object.assign({block:S.el},S))}),b["after:highlightBlock"]&&!b["after:highlightElement"]&&(b["after:highlightElement"]=S=>{b["after:highlightBlock"](Object.assign({block:S.el},S))})}function ae(b){Ge(b),r.push(b)}function ie(b,S){const M=b;r.forEach(function(O){O[M]&&O[M](S)})}function Te(b){return an("10.7.0","highlightBlock will be removed entirely in v12.0"),an("10.7.0","Please use highlightElement now."),m(b)}Object.assign(n,{highlight:u,highlightAuto:h,highlightAll:P,highlightElement:m,highlightBlock:Te,configure:y,initHighlighting:D,initHighlightingOnLoad:C,registerLanguage:J,unregisterLanguage:Z,listLanguages:I,getLanguage:W,registerAliases:oe,autoDetection:$e,inherit:Wa,addPlugin:ae}),n.debugMode=function(){i=!1},n.safeMode=function(){i=!0},n.versionString=Oy,n.regex={concat:rn,lookahead:Qc,either:bo,optional:W0,anyNumberOfTimes:K0};for(const b in Sr)typeof Sr[b]=="object"&&po.exports(Sr[b]);return Object.assign(n,Sr),n};var ur=Ry({}),_y=ur;ur.HighlightJS=ur;ur.default=ur;const Ye=_y,wr=Object.assign(zt(Error),{eval:zt(EvalError),range:zt(RangeError),reference:zt(ReferenceError),syntax:zt(SyntaxError),type:zt(TypeError),uri:zt(URIError)});function zt(n){return e.displayName=n.displayName||n.name,e;function e(t,...r){const i=t&&wu(t,...r);return new n(i)}}const Iy={}.hasOwnProperty,By="hljs-";function lu(n,e,t={}){let r=t.prefix;if(typeof n!="string")throw wr("Expected `string` for name, got `%s`",n);if(!Ye.getLanguage(n))throw wr("Unknown language: `%s` is not registered",n);if(typeof e!="string")throw wr("Expected `string` for value, got `%s`",e);r==null&&(r=By),Ye.configure({__emitter:$y,classPrefix:r});const i=Ye.highlight(e,{language:n,ignoreIllegals:!0});if(Ye.configure({}),i.errorRaised)throw i.errorRaised;return i._emitter.root.data.language=i.language,i._emitter.root.data.relevance=i.relevance,i._emitter.root}function Fy(n,e={}){const t=e.subset||Ye.listLanguages();e.prefix;let r=-1,i={type:"root",data:{language:null,relevance:0},children:[]};if(typeof n!="string")throw wr("Expected `string` for value, got `%s`",n);for(;++ri.data.relevance&&(i=o)}return i}function Ly(n,e){Ye.registerLanguage(n,e)}const Py=function(n,e){if(typeof n=="string")Ye.registerAliases(e,{languageName:n});else{let t;for(t in n)Iy.call(n,t)&&Ye.registerAliases(n[t],{languageName:t})}};function zy(n){return Boolean(Ye.getLanguage(n))}function Hy(){return Ye.listLanguages()}class $y{constructor(e){this.options=e,this.root={type:"root",data:{language:null,relevance:0},children:[]},this.stack=[this.root]}addText(e){if(e==="")return;const t=this.stack[this.stack.length-1],r=t.children[t.children.length-1];r&&r.type==="text"?r.value+=e:t.children.push({type:"text",value:e})}addKeyword(e,t){this.openNode(t),this.addText(e),this.closeNode()}addSublanguage(e,t){const r=this.stack[this.stack.length-1],i=e.root.children;t?r.children.push({type:"element",tagName:"span",properties:{className:[t]},children:i}):r.children.push(...i)}openNode(e){const t=e.split(".").map((s,o)=>o?s+"_".repeat(o):this.options.classPrefix+s),r=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:t},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}closeAllNodes(){}finalize(){}toHTML(){return""}}const Qe={highlight:lu,highlightAuto:Fy,registerLanguage:Ly,registered:zy,listLanguages:Hy,registerAlias:Py};Qe.registerLanguage("javascript",I0);Qe.registerLanguage("html",z0);Qe.registerLanguage("css",v0);Qe.registerLanguage("php",B0);Qe.registerLanguage("shell",P0);Qe.registerLanguage("bash",D0);Qe.registerLanguage("ruby",L0);Qe.registerLanguage("python",F0);Qe.registerLanguage("java",O0);Qe.registerLanguage("c",S0);const Uy=Ae.create({name:"be-info-block",group:"block",content:"inline*",defining:!0,addAttributes(){return{type:{default:"success",renderHTML:n=>({class:n.type})}}},parseHTML(){return[{tag:"div",getAttrs:n=>n.classList.contains("info-block")&&null}]},renderHTML({HTMLAttributes:n}){return["div",re(n,{class:"info-block"}),["div",{class:"title"},"Important:"],["p",0]]},addCommands(){return{addInfo:n=>({commands:e})=>e.setNode(this.name,n)}}});function Vy({suffix:n,host:e,value:t,onChange:r,className:i,inputRef:s,onInputBlur:o,showLinkIcon:a=!0,pattern:l,minLength:c,maxLength:u,hideButton:d}){const{base_url:f}=du(),h=n?`/${n}`:"",[p,m]=ue.exports.useState(!1),[y,D]=ue.exports.useState(t);e=e||f,ue.exports.useEffect(()=>{D(t)},[t]);const C=()=>{p?(m(!1),y&&(r==null||r(y))):m(!0)};return K("div",{className:me("flex items-center",i),children:[a&&g(il,{className:"icon-md text-muted"}),K("div",{className:"text-primary ml-6 mr-14",children:[e,h,!p&&y&&K(ue.exports.Fragment,{children:[g("span",{children:"/"}),g("span",{className:"font-medium",children:y})]})]}),p&&g(fu,{pattern:l,minLength:c,maxLength:u,onKeyDown:_=>{_.key==="Enter"&&C()},ref:s,"aria-label":"slug",autoFocus:!0,className:"mr-14",size:"2xs",value:y,onBlur:o,onChange:_=>{D(_.target.value)}}),!d&&g(gt,{type:"button",color:"chip",variant:"outline",size:"2xs",onClick:()=>{C()},children:p?g(q,{message:"Save"}):g(q,{message:"Edit"})})]})}function Ky(n){const e=n||"custom-pages";return hu(t=>Wy(t,e),{onError:t=>pu(t),onSuccess:()=>{Ja.invalidateQueries(Ru(e))}})}function Wy({pageId:n,payload:e},t){return n?Do.put(`${t}/${n}`,e).then(r=>r.data):Do.post(`${t}`,e).then(r=>r.data)}function jy({editor:n}){return K("span",{children:[g(ge,{size:"md",radius:"rounded",disabled:!n.can().undo(),onClick:()=>{n.commands.focus(),n.commands.undo()},children:g(zu,{})}),g(ge,{size:"md",radius:"rounded",disabled:!n.can().redo(),onClick:()=>{n.commands.focus(),n.commands.redo()},children:g(Hu,{})})]})}function Gy({editor:n}){return K(hi,{type:"modal",onClose:e=>{e!=null&&(n==null||n.commands.setContent(e))},children:[g(gt,{variant:"text",startIcon:g(sl,{}),children:g(q,{message:"Source code"})}),g(_u,{title:g(q,{message:"Source code"}),defaultValue:n.getHTML()})]})}function xn(){return g("div",{className:"self-stretch mx-4 w-1 bg-divider flex-shrink-0"})}function qy({editor:n,size:e}){return K("span",{className:me("flex-shrink-0 whitespace-nowrap"),children:[g(ge,{size:e,radius:"rounded",color:n.isActive("bold")?"primary":null,onClick:()=>{n.commands.focus(),n.commands.toggleBold()},children:g($u,{})}),g(ge,{size:e,radius:"rounded",color:n.isActive("italic")?"primary":null,onClick:()=>{n.commands.focus(),n.commands.toggleItalic()},children:g(Uu,{})}),g(ge,{size:e,radius:"rounded",color:n.isActive("underline")?"primary":null,onClick:()=>{n.commands.focus(),n.commands.toggleUnderline()},children:g(Vu,{})})]})}function Jy({editor:n,size:e}){const t=n.isActive("bulletList"),r=n.isActive("orderedList");return K("span",{className:me("flex-shrink-0","whitespace-nowrap"),children:[g(ge,{size:e,radius:"rounded",color:t?"primary":null,onClick:()=>{n.commands.focus(),n.commands.toggleBulletList()},children:g(Ku,{})}),g(ge,{size:e,radius:"rounded",color:r?"primary":null,onClick:()=>{n.commands.focus(),n.commands.toggleOrderedList()},children:g(Wu,{})})]})}function Yy({editor:n,size:e}){return K(hi,{type:"modal",children:[g(ge,{size:e,radius:"rounded",className:me("flex-shrink-0"),children:g(il,{})}),g(Xy,{editor:n})]})}function Xy({editor:n}){const e=n.getAttributes("link").href,t=n.state.doc.textBetween(n.state.selection.from,n.state.selection.to,""),r=Ns({defaultValues:{href:e,text:t}}),{formId:i,close:s}=Ya();return K(Xa,{children:[g(Za,{children:g(q,{message:"Insert link"})}),g(Qa,{children:K(el,{form:r,id:i,onSubmit:o=>{n.state.selection.empty&&o.text?n.commands.insertContent(`${o.text}`):n.state.selection.empty||(o.href?n.chain().focus().extendMarkRange("link").setLink({href:o.href,target:o.target}).run():n.chain().focus().extendMarkRange("link").unsetLink().run()),s()},children:[g(Or,{name:"href",label:g(q,{message:"URL"}),autoFocus:!0,type:"url",className:"mb-20"}),g(Or,{name:"text",label:g(q,{message:"Text to display"}),className:"mb-20"}),K(mu,{selectionMode:"single",name:"target",label:g(q,{message:"Open link in..."}),children:[g(te,{value:"_self",children:g(q,{message:"Current window"})}),g(te,{value:"_blank",children:g(q,{message:"New window"})})]})]})}),K(tl,{children:[g(gt,{onClick:s,variant:"text",children:g(q,{message:"Cancel"})}),g(gt,{type:"submit",form:i,variant:"flat",color:"primary",children:g(q,{message:"Save"})})]})]})}const Zy=2097152;function Qy({editor:n,size:e}){const{selectAndUploadFile:t}=Iu();return g(ge,{size:e,radius:"rounded",onClick:()=>{t({showToastOnRestrictionFail:!0,restrictions:{allowedFileTypes:[gu.image],maxFileSize:Zy},metadata:{diskPrefix:"page_media",disk:Ou.public},onSuccess:i=>{n.commands.focus(),n.commands.setImage({src:i.url})}})},className:me("flex-shrink-0"),children:g(ju,{})})}function eE({editor:n,size:e}){return g(ge,{className:me("flex-shrink-0"),size:e,radius:"rounded",onClick:()=>{n.chain().focus().clearNodes().unsetAllMarks().run()},children:g(Gu,{})})}function tE({editor:n,size:e}){const[t,r]=ue.exports.useState(!1);return K(dr,{children:[K(pi,{onItemSelected:i=>{i==="hr"?(n.commands.focus(),n.commands.setHorizontalRule()):i==="embed"?r("embed"):(n.commands.focus(),n.commands.addInfo({type:i}))},children:[g(ge,{variant:"text",size:e,radius:"rounded",className:me("flex-shrink-0"),children:g(Tu,{})}),K(mi,{children:[g(te,{value:"hr",startIcon:g(qu,{}),children:g(q,{message:"Horizontal rule"})}),g(te,{value:"embed",startIcon:g(Ju,{}),children:g(q,{message:"Embed"})}),g(te,{value:"important",startIcon:g(Yu,{}),children:g(q,{message:"Important"})}),g(te,{value:"warning",startIcon:g(bu,{}),children:g(q,{message:"Warning"})}),g(te,{value:"success",startIcon:g(Xu,{}),children:g(q,{message:"Note"})})]})]}),g(hi,{type:"modal",isOpen:!!t,onClose:()=>{r(!1)},children:g(nE,{editor:n})})]})}function nE({editor:n}){const e=n.getAttributes("embed").src,t=Ns({defaultValues:{src:e}}),{formId:r,close:i}=Ya();return K(Xa,{children:[g(Za,{children:g(q,{message:"Insert link"})}),g(Qa,{children:g(el,{form:t,id:r,onSubmit:s=>{n.commands.setEmbed(s),i()},children:g(Or,{name:"src",label:g(q,{message:"Embed URL"}),autoFocus:!0,type:"url",required:!0})})}),K(tl,{children:[g(gt,{onClick:i,variant:"text",children:g(q,{message:"Cancel"})}),g(gt,{type:"submit",form:r,disabled:!t.formState.isValid,variant:"flat",color:"primary",children:g(q,{message:"Add"})})]})]})}function et({children:n,modifier:e,separator:t="+"}){const r=yu()?g("span",{className:"text-base align-middle",children:"\u2318"}):"Ctrl";return K("kbd",{className:"text-xs text-muted",children:[e&&K(dr,{children:[r,t]}),n]})}function rE({editor:n,size:e}){return K(pi,{floatingMinWidth:"w-256",onItemSelected:t=>{n.commands.focus(),typeof t=="string"&&t.startsWith("h")?n.commands.toggleHeading({level:parseInt(t.replace("h",""))}):t==="code"?n.commands.toggleCode():t==="strike"?n.commands.toggleStrike():t==="super"?n.commands.toggleSuperscript():t==="sub"?n.commands.toggleSubscript():t==="blockquote"?n.commands.toggleBlockquote():t==="paragraph"&&n.commands.setParagraph()},children:[g(gt,{className:me("flex-shrink-0"),variant:"text",size:e,endIcon:g(Eu,{}),children:g(q,{message:"Format"})}),K(mi,{children:[g(te,{value:"h1",endSection:g(et,{modifier:!0,children:"Alt+1"}),children:g(q,{message:"Heading :number",values:{number:1}})}),g(te,{value:"h2",endSection:g(et,{modifier:!0,children:"Alt+2"}),children:g(q,{message:"Heading :number",values:{number:2}})}),g(te,{value:"h3",endSection:g(et,{modifier:!0,children:"Alt+3"}),children:g(q,{message:"Heading :number",values:{number:3}})}),g(te,{value:"h4",endSection:g(et,{modifier:!0,children:"Alt+4"}),children:g(q,{message:"Heading :number",values:{number:4}})}),g(te,{value:"code",endSection:g(et,{modifier:!0,children:"E"}),children:g(q,{message:"Code"})}),g(te,{value:"strike",endSection:g(et,{modifier:!0,children:"Shift+X"}),children:g(q,{message:"Strikethrough"})}),g(te,{value:"super",endSection:g(et,{modifier:!0,separator:" ",children:"."}),children:g(q,{message:"Superscript"})}),g(te,{value:"sub",endSection:g(et,{modifier:!0,separator:" ",children:","}),children:g(q,{message:"Subscript"})}),g(te,{value:"blockquote",endSection:g(et,{modifier:!0,children:"Shift+B"}),children:g(q,{message:"Blockquote"})}),g(te,{value:"paragraph",endSection:g(et,{modifier:!0,children:"Alt+0"}),children:g(q,{message:"Paragraph"})})]})]})}function iE({editor:n,size:e}){const[t,r]=ue.exports.useState(!1),i=n.getAttributes("textStyle").color,s=n.getAttributes("textStyle").backgroundColor;return K(ue.exports.Fragment,{children:[K("span",{className:me("flex-shrink-0 whitespace-nowrap"),children:[g(ge,{size:e,radius:"rounded",color:i?"primary":null,onClick:()=>{r("text")},children:g(Zu,{})}),g(ge,{size:e,radius:"rounded",color:s?"primary":null,onClick:()=>{r("bg")},children:g(Qu,{})})]}),g(hi,{currentValue:t==="text"?"#000000":"#FFFFFF",type:"modal",isOpen:!!t,onClose:o=>{o&&(t==="text"?n.commands.setColor(o):n.commands.setBackgroundColor(o)),r(!1)},children:g(Bu,{defaultValue:t==="text"?"#000000":"#FFFFFF"})})]})}const kr={left:{icon:ed,label:hr("Align left")},center:{icon:td,label:hr("Align center")},right:{icon:nd,label:hr("Align right")},justify:{icon:rd,label:hr("Justify")}};function sE({editor:n,size:e}){const t=Object.keys(kr).find(i=>n.isActive({textAlign:i}))||"left",r=t?kr[t].icon:kr.left.icon;return K(pi,{floatingWidth:"auto",selectionMode:"single",selectedValue:t,onSelectionChange:i=>{n.commands.focus(),n.commands.setTextAlign(i)},children:[g(ge,{size:e,color:t?"primary":null,radius:"rounded",className:me("flex-shrink-0"),children:g(r,{})}),g(mi,{children:Object.entries(kr).map(([i,s])=>{const o=s.icon;return g(te,{value:i,startIcon:g(o,{size:"md"}),capitalizeFirst:!0,children:g(q,{message:s.label.message})},i)})})]})}function oE({editor:n,size:e}){return K("span",{className:me("flex-shrink-0","whitespace-nowrap"),children:[g(ge,{size:e,radius:"rounded",onClick:()=>{n.commands.focus(),n.commands.outdent()},children:g(id,{})}),g(ge,{size:e,radius:"rounded",onClick:()=>{n.commands.focus(),n.commands.indent()},children:g(sd,{})})]})}function aE({editor:n,size:e}){const t=n.getAttributes("codeBlock").language||"";return K(pi,{selectionMode:"single",selectedValue:t,onSelectionChange:r=>{n.commands.toggleCodeBlock({language:r})},children:[g(ge,{className:me("flex-shrink-0"),size:e,color:t?"primary":null,radius:"rounded",children:g(sl,{})}),K(mi,{children:[g(te,{value:"html",children:"HTML"}),g(te,{value:"javascript",children:"JavaScript"}),g(te,{value:"css",children:"CSS"}),g(te,{value:"php",children:"PHP"}),g(te,{value:"shell",children:"Shell"}),g(te,{value:"bash",children:"Bash"}),g(te,{value:"ruby",children:"Ruby"}),g(te,{value:"python",children:"Python"}),g(te,{value:"java",children:"Java"}),g(te,{value:"c++",children:"C++"})]})]})}const Ga="flex items-center justify-center px-4 h-42 text-muted border-b rounded overflow-hidden";function lE({editor:n,size:e="md"}){const t=nl(),[r,i]=ue.exports.useState(!1);return K("div",{className:me(r?"h-84":"h-42"),children:[K("div",{className:me(Ga,"relative z-20"),children:[g(rE,{editor:n,size:e}),g(xn,{}),g(qy,{editor:n,size:e}),g(xn,{}),g(sE,{editor:n,size:e}),g(oE,{editor:n,size:e}),g(xn,{}),t?g(ge,{className:"flex-shrink-0",color:r?"primary":null,size:e,radius:"rounded",onClick:()=>{i(!r)},children:r?g(od,{}):g(Lu,{})}):g(qa,{editor:n,size:e})]}),g(Du,{children:r&&g(Su.div,{className:me(Ga,"absolute w-full h-full flex"),initial:{y:"-100%"},animate:{y:0},exit:{y:"-100%"},children:g(qa,{editor:n,size:e})})})]})}function qa({editor:n,size:e="md"}){return K(dr,{children:[g(Jy,{editor:n,size:e}),g(xn,{}),g(Yy,{editor:n,size:e}),g(Qy,{editor:n,size:e}),g(tE,{editor:n,size:e}),g(xn,{}),g(iE,{editor:n,size:e}),g(xn,{}),g(aE,{editor:n,size:e}),g(eE,{editor:n,size:e})]})}function cE({editor:n,page:e,allowSlugEditing:t=!0,endpoint:r}){const{isSticky:i,sentinelRef:s}=Fu(),o=nl();return K(ue.exports.Fragment,{children:[g("div",{ref:s}),K("div",{className:me("sticky top-0 relative z-10 mb-20 bg-paper",i&&"shadow"),children:[K("div",{className:"px-20 py-10 flex items-center justify-between sm:justify-start gap-20 border-b text-muted",children:[!o&&K(ue.exports.Fragment,{children:[g(gt,{variant:"text",size:"sm",elementType:ku,to:e?"../..":"..",relative:"path",startIcon:g(Pu,{}),"data-testid":"text-editor-back-button",children:g(q,{message:"Back"})}),g(dE,{name:"slug",showLinkIcon:!1,suffix:"pages",hideButton:!t})]}),n&&g(jy,{editor:n}),!o&&g(Gy,{editor:n}),g(uE,{page:e,editor:n,endpoint:r})]}),g(lE,{editor:n,size:"sm"})]})]})}function uE({page:n,editor:e,endpoint:t}){const r=Ky(t),i=Cu(),{trans:s}=rl(),o=Rs(),a=o.watch("title");return g(gt,{variant:"flat",size:"sm",color:"primary",className:"min-w-90",disabled:r.isLoading||!a,"data-testid":"text-editor-save-button",onClick:()=>{r.mutate({pageId:n==null?void 0:n.id,payload:{...o.getValues(),body:e==null?void 0:e.getHTML()}},{onSuccess:()=>{const l=n!=null&&n.id?s({message:"Updated page"}):s({message:"Created page"});xu(l),Ja.invalidateQueries(["custom-pages"]),i(n?"../..":"..",{relative:"path"})}})},children:g(q,{message:"Save"})})}function dE({name:n,...e}){const{field:{onChange:t,onBlur:r,value:i="",ref:s}}=Au({name:n}),o=ue.exports.useRef(!1),{watch:a,setValue:l}=Rs();return ue.exports.useEffect(()=>{const c=a((u,{name:d})=>{d==="title"&&!o.current&&l("slug",u.title)});return()=>c.unsubscribe()},[a,l]),g(Vy,{className:me("mr-auto",!i&&"invisible"),onChange:c=>{o.current=!0,t(c)},onInputBlur:r,value:i,inputRef:s,...e})}function kE({page:n,allowSlugEditing:e=!0,endpoint:t}){const r=Ns(),i=Gm({extensions:[Wg.configure({codeBlock:!1}),jg,ub,fb,hb,pb,mb,gb,b0,y0,g0.configure({lowlight:Qe}),bb.configure({types:["heading","paragraph"]}),Uy,E0],onFocus:()=>{},content:n==null?void 0:n.body});return ue.exports.useEffect(()=>{if(i)return()=>{i.destroy()}},[i]),ue.exports.useEffect(()=>{r.reset(n)},[n,r]),i?g(Nu,{children:K(Mu,{...r,children:[g(cE,{editor:i,page:n,allowSlugEditing:e,endpoint:t}),g("div",{className:"mx-20","data-testid":"text-editor",children:K("div",{className:"prose dark:prose-invert mx-auto flex-auto",children:[g(fE,{}),g(Vm,{editor:i})]})})]})}):null}function fE(){const[n,e]=ue.exports.useState(!1),{trans:t}=rl(),i=Rs().watch("title"),s=t({message:"Title"});return n?g(Or,{placeholder:s,autoFocus:!0,className:"mb-30",onBlur:()=>{e(!1)},name:"title",required:!0}):K("h1",{tabIndex:0,onClick:()=>{e(!0)},onFocus:()=>{e(!0)},className:me("hover:bg-primary/focus rounded cursor-pointer",!i&&"text-muted"),children:[i||s,g(vu,{className:"icon-sm mx-8 mt-8 align-top text-muted"})]})}export{kE as default}; //# sourceMappingURL=text-editor.ccac43e8.js.map