Files
claudia-docs-web/dist/assets/DocumentView-DZfZNu6O.js

148 lines
540 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{k as Yl,D as mo,d as $i,E as cf,G as df,r as ye,H as uf,I as ff,J as pf,K as hf,l as j,L as mf,n as Kr,c as J,a as v,q as Pe,b as Ae,f as je,o as H,M as gf,g as He,F as En,m as kn,t as Me,z as Vr,s as Bs,w as bf,e as Wr,v as Gr,i as yf,h as ve,N as Ef,y as kf,j as _f}from"./index-Bwmlaq-e.js";import{u as vf,H as Sf}from"./Header-D3hVVxoP.js";import{B as gt,_ as jl}from"./Button-BCQM6xXJ.js";import{M as oa}from"./Modal-DyPCz1pc.js";function Se(n){this.content=n}Se.prototype={constructor:Se,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new Se(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Se(t)},addToStart:function(n,e){return new Se([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Se(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new Se(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Se.from(n),n.size?new Se(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Se.from(n),n.size?new Se(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Se.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};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 Zl(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=Zl(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Xl(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,d=Math.min(o.text.length,a.text.length);for(;c<d&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=Xl(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}class x{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,t-d),r,i+d)}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)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new x(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(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;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Zl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Xl(this,e,t,r)}findIndex(e){if(e==0)return _r(0,e);if(e==this.size)return _r(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?_r(t+1,s):_r(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return 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;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new x(t||e,r)}static from(e){if(!e)return x.empty;if(e instanceof x)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new x([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}x.empty=new x([],0);const ls={index:0,offset:0};function _r(n,e){return ls.index=n,ls.offset=e,ls}function qr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!qr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!qr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let te=class $s{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&qr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return $s.none;if(e instanceof $s)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};te.none=[];class Jr extends Error{}class D{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=ec(this.content,e+this.openStart,t);return r&&new D(r,this.openStart,this.openEnd)}removeBetween(e,t){return new D(Ql(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 D.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 D(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 D(e,r,i)}}D.empty=new D(x.empty,0,0);function Ql(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(Ql(s.content,e-i-1,t-i-1)))}function ec(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=ec(o.content,e-s-1,t,o);return a&&n.replaceChild(i,o.copy(a))}function wf(n,e,t){if(t.openStart>n.depth)throw new Jr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Jr("Inconsistent open depths");return tc(n,e,t,0)}function tc(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=tc(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Yt(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Tf(t,n);return Yt(s,rc(n,o,a,e,r))}else return Yt(s,Yr(n,e,r))}function nc(n,e){if(!e.type.compatibleContent(n.type))throw new Jr("Cannot join "+e.type.name+" onto "+n.type.name)}function zs(n,e,t){let r=n.node(t);return nc(r,e.node(t)),r}function Jt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Kn(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&&(Jt(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Jt(i.child(a),r);e&&e.depth==t&&e.textOffset&&Jt(e.nodeBefore,r)}function Yt(n,e){return n.type.checkContent(e),n.copy(e)}function rc(n,e,t,r,i){let s=n.depth>i&&zs(n,e,i+1),o=r.depth>i&&zs(t,r,i+1),a=[];return Kn(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(nc(s,o),Jt(Yt(s,rc(n,e,t,r,i+1)),a)):(s&&Jt(Yt(s,Yr(n,e,i+1)),a),Kn(e,t,i,a),o&&Jt(Yt(o,Yr(t,r,i+1)),a)),Kn(r,null,i,a),new x(a)}function Yr(n,e,t){let r=[];if(Kn(null,n,t,r),n.depth>t){let i=zs(n,e,t+1);Jt(Yt(i,Yr(n,e,t+1)),r)}return Kn(e,null,t,r),new x(r)}function Tf(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 er{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return te.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new jr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index: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 er(t,r,s)}static resolveCached(e,t){let r=aa.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else aa.set(e,r=new xf);let i=r.elts[r.i]=er.resolve(e,t);return r.i=(r.i+1)%Nf,i}}class xf{constructor(){this.elts=[],this.i=0}}const Nf=12,aa=new WeakMap;class jr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Cf=Object.create(null);class rt{constructor(e,t,r,i=te.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||x.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&qr(this.attrs,t||e.defaultAttrs||Cf)&&te.sameSet(this.marks,r||te.none)}copy(e=null){return e==this.content?this:new rt(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new rt(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return D.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new D(c,i.depth-o,s.depth-o)}replace(e,t,r){return wf(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return er.resolveCached(this,e)}resolveNoCache(e){return er.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ic(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;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=te.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!te.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=x.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}rt.prototype.text=void 0;class Zr extends rt{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):ic(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 Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(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 ic(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class en{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Mf(e,t);if(r.next==null)return en.empty;let i=sc(r);r.next&&r.err("Unexpected trailing text");let s=Pf(Lf(i));return Bf(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return x.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:d,next:u}=o.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let f=s(u,a.concat(d));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
`)}}en.empty=new en(!0);class Mf{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 sc(n){let e=[];do e.push(Af(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Af(n){let e=[];do e.push(Of(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Of(n){let e=Df(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=Rf(n,e);else break;return e}function la(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Rf(n,e){let t=la(n),r=t;return n.eat(",")&&(n.next!="}"?r=la(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function If(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Df(n){if(n.eat("(")){let e=sc(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=If(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 Lf(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<o.min;c++){let d=t();i(s(o.expr,l),d),l=d}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let d=t();r(l,d),i(s(o.expr,l),d),l=d}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function oc(n,e){return e-n}function ca(n,e){let t=[];return r(e),t.sort(oc);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function Pf(n){let e=Object.create(null);return t(ca(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);ca(n,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let s=e[r.join(",")]=new en(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(oc);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Bf(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ac(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function lc(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function cc(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}function dc(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new zf(n,r,e[r]);return t}let da=class uc{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=dc(e,r.attrs),this.defaultAttrs=ac(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==en.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:lc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new rt(this,this.computeAttrs(e),x.from(t),te.setFrom(r))}createChecked(e=null,t,r){return t=x.from(t),this.checkContent(t),new rt(this,this.computeAttrs(e),t,te.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=x.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(x.empty,!0);return s?new rt(this,e,t.append(s),te.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){cc(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:te.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new uc(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}};function $f(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class zf{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?$f(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class zi{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=dc(e,i.attrs),this.excluded=null;let s=ac(this.attrs);this.instance=s?new te(this,s):null}create(e=null){return!e&&this.instance?this.instance:new te(this,lc(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new zi(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){cc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class fc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Se.from(e.nodes),t.marks=Se.from(e.marks||{}),this.nodes=da.compile(this.spec.nodes,this),this.marks=zi.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;if(s.contentMatch=r[o]||(r[o]=en.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?ua(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==""?[]:ua(this,o.split(" "))}this.nodeFromJSON=i=>rt.fromJSON(this,i),this.markFromJSON=i=>te.fromJSON(this,i),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 da){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 Zr(r,r.defaultAttrs,e,te.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ua(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Ff(n){return n.tag!=null}function Uf(n){return n.style!=null}class It{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Ff(i))this.tags.push(i);else if(Uf(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new pa(this,t,!1);return r.addAll(e,te.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new pa(this,t,!0);return r.addAll(e,te.none,t.from,t.to),D.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Vf(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.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<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ha(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=ha(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new It(e,It.schemaRules(e)))}}const pc={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Hf={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hc={ol:!0,ul:!0},tr=1,Fs=2,Vn=4;function fa(n,e,t){return e!=null?(e?tr:0)|(e==="full"?Fs:0):n&&n.whitespace=="pre"?tr|Fs:t&~Vn}class vr{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=te.none,this.match=s||(o&Vn?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&tr)){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}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!pc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class pa{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=fa(null,t.preserveWhitespace,0)|(r?Vn:0);i?s=new vr(i.type,i.attrs,te.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new vr(null,null,te.none,!0,null,o):s=new vr(e.schema.topNodeType,null,te.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&Fs?"full":this.localPreserveWS||(i.options&tr)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;hc.hasOwnProperty(o)&&this.parser.normalizeLists&&Kf(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Hf.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(pc.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=l&&l.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=d}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));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,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=te.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):ma(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=fa(e,s,o.options);o.options&Vn&&o.content.length==0&&(a|=Vn);let l=te.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):ma(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new vr(e,t,l,i,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=tr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(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 d=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!d||d.name!=c&&!d.isInGroup(c))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}}}function Kf(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&hc.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Vf(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ha(n){let e={};for(let t in n)e[t]=n[t];return e}function ma(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<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==e||s.indexOf(d)<0&&o(d))return!0}};if(o(i.contentMatch))return!0}}class on{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=cs(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],d=this.serializeMark(c,o.isInline,t);d&&(s.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=$r(cs(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let 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&&$r(cs(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return $r(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new on(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ga(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ga(e.marks)}}function ga(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function cs(n){return n.document||window.document}const ba=new WeakMap;function Wf(n){let e=ba.get(n);return e===void 0&&ba.set(n,e=Gf(n)),e}function Gf(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function $r(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=Wf(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?l.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:h}=$r(n,f,t,r);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const mc=65535,gc=Math.pow(2,16);function qf(n,e){return n+e*gc}function ya(n){return n&mc}function Jf(n){return(n-(n&mc))/gc}const bc=1,yc=2,zr=4,Ec=8;class Us{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ec)>0}get deletedBefore(){return(this.delInfo&(bc|zr))>0}get deletedAfter(){return(this.delInfo&(yc|zr))>0}get deletedAcross(){return(this.delInfo&zr)>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=ya(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+Jf(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],d=this.ranges[a+o],u=l+c;if(e<=u){let f=c?e==l?-1:e==u?1:t:t,p=l+i+(f<0?0:d);if(r)return p;let h=e==(t<0?l:u)?null:qf(a/3,e-l),m=e==l?yc:e==u?bc:zr;return(t<0?e!=l:e!=u)&&(m|=Ec),new Us(p,m,h)}i+=d-c}return r?e+i:new Us(e+i,0,null)}touches(e,t){let r=0,i=ya(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],d=l+c;if(e<=d&&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<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],d=this.ranges[i+r];e(a,a+c,l,l+d),s+=d-c}}invert(){return new Ke(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ke.empty:new Ke(e<0?[0,-e,0]:[0,0,e])}}Ke.empty=new Ke([]);class nr{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new nr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new nr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Us(e,i,null)}}const ds=Object.create(null);class Ie{getMap(){return Ke.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ds[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in ds)throw new RangeError("Duplicate use of step JSON ID "+e);return ds[e]=t,t.prototype.jsonID=e,t}}class he{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new he(e,null)}static fail(e){return new he(null,e)}static fromReplace(e,t,r,i){try{return he.ok(e.replace(t,r,i))}catch(s){if(s instanceof Jr)return he.fail(s.message);throw s}}}function go(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(go(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return x.fromArray(r)}class Mt extends Ie{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new D(go(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return he.fromReplace(e,this.from,this.to,s)}invert(){return new nt(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 Mt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mt(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 Mt(t.from,t.to,e.markFromJSON(t.mark))}}Ie.jsonID("addMark",Mt);class nt extends Ie{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 D(go(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return he.fromReplace(e,this.from,this.to,r)}invert(){return new Mt(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 nt(t.pos,r.pos,this.mark)}merge(e){return e instanceof nt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nt(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 nt(t.from,t.to,e.markFromJSON(t.mark))}}Ie.jsonID("removeMark",nt);class At extends Ie{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return he.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return he.fromReplace(e,this.pos,this.pos+1,new D(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;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new At(this.pos,t.marks[i]);return new At(this.pos,this.mark)}}return new tn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new At(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new At(t.pos,e.markFromJSON(t.mark))}}Ie.jsonID("addNodeMark",At);class tn extends Ie{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return he.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return he.fromReplace(e,this.pos,this.pos+1,new D(x.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new At(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new tn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new tn(t.pos,e.markFromJSON(t.mark))}}Ie.jsonID("removeNodeMark",tn);class pe extends Ie{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Hs(e,this.from,this.to)?he.fail("Structure replace would overwrite content"):he.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ke([this.from,this.to-this.from,this.slice.size])}invert(e){return new pe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&pe.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new pe(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?D.empty:new D(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?D.empty:new D(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pe(t.from,t.to,D.fromJSON(e,t.slice),!!t.structure)}}pe.MAP_BIAS=1;Ie.jsonID("replace",pe);class Ee extends Ie{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Hs(e,this.from,this.gapFrom)||Hs(e,this.gapTo,this.to)))return he.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return he.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?he.fromReplace(e,this.from,this.to,r):he.fail("Content does not fit in gap")}getMap(){return new Ke([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ee(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Ee(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 Ee(t.from,t.to,t.gapFrom,t.gapTo,D.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ie.jsonID("replaceAround",Ee);function Hs(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 Yf(n,e,t,r){let i=[],s=[],o,a;n.doc.nodesBetween(e,t,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,t),h=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(h)||(o&&o.to==f&&o.mark.eq(u[m])?o.to=p:i.push(o=new nt(f,p,u[m])));a&&a.to==f?a.to=p:s.push(a=new Mt(f,p,r))}}),i.forEach(l=>n.step(l)),s.forEach(l=>n.step(l))}function jf(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 zi){let c=o.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.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 d=0;d<l.length;d++){let u=l[d],f;for(let p=0;p<i.length;p++){let h=i[p];h.step==s-1&&u.eq(i[p].style)&&(f=h)}f?(f.to=c,f.step=s):i.push({style:u,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>n.step(new nt(o.from,o.to,o.style)))}function bo(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new pe(a,d,D.empty));else{r=u;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new nt(a,d,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new D(x.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new pe(a+f.index,a+f.index+f[0].length,h))}}a=d}if(!r.validEnd){let l=r.fillBefore(x.empty,!0);n.replace(a,a,new D(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function Zf(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Rn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-s;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!Zf(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function Xf(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,d=x.empty,u=0;for(let h=s,m=!1;h>t;h--)m||r.index(h)>0?(m=!0,d=x.from(r.node(h).copy(d)),u++):l--;let f=x.empty,p=0;for(let h=s,m=!1;h>t;h--)m||i.after(h+1)<i.end(h)?(m=!0,f=x.from(i.node(h).copy(f)),p++):c++;n.step(new Ee(l,c,o,a,new D(d.append(f),u,p),d.size-u,!0))}function yo(n,e,t=null,r=n){let i=Qf(n,e),s=i&&ep(r,e);return s?i.map(Ea).concat({type:e,attrs:t}).concat(s.map(Ea)):null}function Ea(n){return{type:n,attrs:null}}function Qf(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function ep(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function tp(n,e,t){let r=x.empty;for(let o=t.length-1;o>=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 Ee(i,s,i,s,new D(r,0,0),t.length,!0))}function np(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)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&rp(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&_c(n,o,a,s),bo(n,n.mapping.slice(s).map(a,1),r,void 0,c===null);let d=n.mapping.slice(s),u=d.map(a,1),f=d.map(a+o.nodeSize,1);return n.step(new Ee(u,f,u+1,f-1,new D(x.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&kc(n,o,a,s),!1}})}function kc(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function _c(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
`))}})}function rp(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function ip(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 Ee(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new D(x.from(o),0,0),1,!0))}function yt(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,d=t-2;c>s;c--,d--){let u=i.node(c),f=i.index(c);if(u.type.spec.isolating)return!1;let p=u.content.cutByIndex(f,u.childCount),h=r&&r[d+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!m.type.validContent(p))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 sp(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 d=r&&r[c];o=x.from(d?d.type.create(d.attrs,o):i.node(a).copy(o))}n.step(new pe(e,e,new D(s.append(o),t,t),!0))}function zt(n,e){let t=n.resolve(e),r=t.index();return vc(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function op(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function vc(n,e){return!!(n&&e&&!n.isLeaf&&op(n,e))}function Fi(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&vc(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function ap(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let d=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(e+t);_c(n,d.node(),d.before(),a)}o.inlineContent&&bo(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let l=n.mapping.slice(a),c=l.map(e-t);if(n.step(new pe(c,l.map(e+t,-1),D.empty,!0)),r===!0){let d=n.doc.resolve(c);kc(n,d.node(),d.before(),n.steps.length)}return n}function lp(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Sc(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let 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),d=!1;if(s==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Ui(n,e,t=e,r=D.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return wc(i,s,r)?new pe(e,t,r):new cp(i,s,r).fit()}function wc(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class cp{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 D(s,o,a);return e>-1?new Ee(r.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||r.pos!=this.$to.pos?new pe(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=us(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(x.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=us(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new D(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=us(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new D($n(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new D($n(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;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,d=[],{match:u,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)d.push(i.child(m));u=u.matchFragment(i)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let m=a.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||l==0||m.content.size)&&(u=g,d.push(Tc(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=zn(this.placed,t,x.from(d)),this.frontier[t].match=u,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<p;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=h?e==0?D.empty:new D($n(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new D($n(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!fs(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=fs(e,t,i,r,s);if(o){for(let a=t-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=fs(e,a,c,l,!0);if(!d||d.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=zn(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=zn(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=zn(this.placed,this.frontier.length,t))}}function $n(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy($n(n.firstChild.content,e-1,t)))}function zn(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(zn(n.lastChild.content,e-1,t)))}function us(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Tc(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Tc(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 fs(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&&!dp(t,s.content,o)?a:null}function dp(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function up(n){return n.spec.defining||n.spec.definingForContent}function fp(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(wc(i,s,r))return n.step(new pe(e,t,r));let o=Nc(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,p=i.pos-1;f>0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==p&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],d=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=d-1;f>=0;f--){let p=c[f],h=up(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(a)-1)))d=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+d+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<o.length;m++){let g=o[(m+l)%o.length],b=!0;g<0&&(b=!1,g=-g);let E=i.node(g-1),y=i.index(g-1);if(E.canReplaceWith(y,y,h.type,h.marks))return n.replace(i.before(g),b?s.after(g):t,new D(xc(r.content,0,r.openStart,p),p,r.openEnd))}}let u=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>u));f--){let p=o[f];p<0||(e=i.before(p),t=s.after(p))}}function xc(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(xc(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(x.empty,!0))}return n}function pp(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=lp(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new D(x.from(r),0,0))}function hp(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(t),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&t==i.start(l);l--)t=i.before(l);r=n.doc.resolve(e),i=n.doc.resolve(t)}}let s=Nc(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(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&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function Nc(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(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 vn extends Ie{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 he.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 he.fromReplace(e,this.pos,this.pos+1,new D(x.from(i),0,t.isLeaf?0:1))}getMap(){return Ke.empty}invert(e){return new vn(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 vn(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 vn(t.pos,t.attr,t.value)}}Ie.jsonID("attr",vn);class rr extends Ie{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return he.ok(r)}getMap(){return Ke.empty}invert(e){return new rr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rr(t.attr,t.value)}}Ie.jsonID("docAttr",rr);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 Cc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new nr}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}changedRange(){let e=1e9,t=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),t=Math.max(t,l)})}return e==1e9?null:{from:e,to:t}}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=D.empty){let i=Ui(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new D(x.from(r),0,0))}delete(e,t){return this.replace(e,t,D.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return fp(this,e,t,r),this}replaceRangeWith(e,t,r){return pp(this,e,t,r),this}deleteRange(e,t){return hp(this,e,t),this}lift(e,t){return Xf(this,e,t),this}join(e,t=1){return ap(this,e,t),this}wrap(e,t){return tp(this,e,t),this}setBlockType(e,t=e,r,i=null){return np(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return ip(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new vn(e,t,r)),this}setDocAttribute(e,t){return this.step(new rr(e,t)),this}addNodeMark(e,t){return this.step(new At(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof te)t.isInSet(r.marks)&&this.step(new tn(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new tn(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,t=1,r){return sp(this,e,t,r),this}addMark(e,t,r){return Yf(this,e,t,r),this}removeMark(e,t,r){return jf(this,e,t,r),this}clearIncompatible(e,t,r){return bo(this,e,t,r),this}}const ps=Object.create(null);class V{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new mp(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=D.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(l.pos),d.map(c.pos),a?D.empty:t),a==0&&va(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),c=l.map(o.pos),d=l.map(a.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),va(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new U(e):hn(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?hn(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):hn(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 Ve(e.node(0))}static atStart(e){return hn(e,e,0,0,1)||new Ve(e)}static atEnd(e){return hn(e,e,e.content.size,e.childCount,-1)||new Ve(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=ps[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 ps)throw new RangeError("Duplicate use of selection JSON ID "+e);return ps[e]=t,t.prototype.jsonID=e,t}getBookmark(){return U.between(this.$anchor,this.$head).getBookmark()}}V.prototype.visible=!0;class mp{constructor(e,t){this.$from=e,this.$to=t}}let ka=!1;function _a(n){!ka&&!n.parent.inlineContent&&(ka=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class U extends V{constructor(e,t=e){_a(e),_a(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return V.near(r);let i=e.resolve(t.map(this.anchor));return new U(i.parent.inlineContent?i:r,r)}replace(e,t=D.empty){if(super.replace(e,t),t==D.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof U&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Hi(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 U(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=V.findFrom(t,r,!0)||V.findFrom(t,-r,!0);if(s)t=s.$head;else return V.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(V.findFrom(e,-r,!0)||V.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new U(e,t)}}V.jsonID("text",U);class Hi{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Hi(e.map(this.anchor),e.map(this.head))}resolve(e){return U.between(e.resolve(this.anchor),e.resolve(this.head))}}class $ extends V{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?V.near(s):new $(s)}content(){return new D(x.from(this.node),0,0)}eq(e){return e instanceof $&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Eo(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new $(e.resolve(t.anchor))}static create(e,t){return new $(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}$.prototype.visible=!1;V.jsonID("node",$);class Eo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Hi(r,r):new Eo(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&$.isSelectable(r)?new $(t):V.near(t)}}class Ve extends V{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=D.empty){if(t==D.empty){e.delete(0,e.doc.content.size);let r=V.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ve(e)}map(e){return new Ve(e)}eq(e){return e instanceof Ve}getBookmark(){return gp}}V.jsonID("all",Ve);const gp={map(){return this},resolve(n){return new Ve(n)}};function hn(n,e,t,r,i,s=!1){if(e.inlineContent)return U.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&$.isSelectable(a))return $.create(n,t-(i<0?a.nodeSize:0))}else{let l=hn(n,a,t+i,i<0?a.childCount:0,i,s);if(l)return l}t+=a.nodeSize*i}return null}function va(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof pe||i instanceof Ee))return;let s=n.mapping.maps[r],o;s.forEach((a,l,c,d)=>{o==null&&(o=d)}),n.setSelection(V.near(n.doc.resolve(o),t))}const Sa=1,Sr=2,wa=4;class bp extends Cc{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Sa)&~Sr,this.storedMarks=null,this}get selectionSet(){return(this.updated&Sa)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Sr,this}ensureMarks(e){return te.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&Sr)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Sr,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)||te.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),!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.selection.to==t+e.length&&this.setSelection(V.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wa,this}get scrolledIntoView(){return(this.updated&wa)>0}}function Ta(n,e){return!e||!n?n:n.bind(e)}class Fn{constructor(e,t,r){this.name=e,this.init=Ta(t.init,r),this.apply=Ta(t.apply,r)}}const yp=[new Fn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Fn("selection",{init(n,e){return n.selection||V.atStart(e.doc)},apply(n){return n.selection}}),new Fn("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Fn("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class hs{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=yp.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 Fn(r.key,r.spec.state,r))})}}class _n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,c=i?i[o].state:this,d=l<t.length&&a.spec.appendTransaction.call(a,l?t.slice(l):t,c,r);if(d&&r.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<o?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new _n(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new bp(this)}static create(e){let t=new hs(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new _n(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new hs(this.schema,e.plugins),r=t.fields,i=new _n(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],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 hs(e.schema,e.plugins),s=new _n(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=rt.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=V.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 Mc(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Mc(i,e,{})),t[r]=i}return t}class le{constructor(e){this.spec=e,this.props={},e.props&&Mc(e.props,this,this.props),this.key=e.key?e.key.key:Ac("plugin")}getState(e){return e[this.key]}}const ms=Object.create(null);function Ac(n){return n in ms?n+"$"+ ++ms[n]:(ms[n]=0,n+"$")}class be{constructor(e="key"){this.key=Ac(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ko=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Oc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Rc=(n,e,t)=>{let r=Oc(n,t);if(!r)return!1;let i=_o(r);if(!i){let o=r.blockRange(),a=o&&Rn(o);return a==null?!1:(e&&e(n.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Uc(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Tn(s,"end")||$.isSelectable(s)))for(let o=r.depth;;o--){let a=Ui(n.doc,r.before(o),r.after(o),D.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=n.tr.step(a);l.setSelection(Tn(s,"end")?V.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):$.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Ep=(n,e,t)=>{let r=Oc(n,t);if(!r)return!1;let i=_o(r);return i?Ic(n,i,e):!1},kp=(n,e,t)=>{let r=Lc(n,t);if(!r)return!1;let i=vo(r);return i?Ic(n,i,e):!1};function Ic(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=Ui(n.doc,s,l,D.empty);if(!c||c.from!=s||c instanceof pe&&c.slice.size>=l-s)return!1;if(t){let d=n.tr.step(c);d.setSelection(U.create(d.doc,s)),t(d.scrollIntoView())}return!0}function Tn(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Dc=(n,e,t)=>{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=_o(r)}let o=s&&s.nodeBefore;return!o||!$.isSelectable(o)?!1:(e&&e(n.tr.setSelection($.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function _o(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Lc(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Pc=(n,e,t)=>{let r=Lc(n,t);if(!r)return!1;let i=vo(r);if(!i)return!1;let s=i.nodeAfter;if(Uc(n,i,e,1))return!0;if(r.parent.content.size==0&&(Tn(s,"start")||$.isSelectable(s))){let o=Ui(n.doc,r.before(),r.after(),D.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=n.tr.step(o);a.setSelection(Tn(s,"start")?V.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):$.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Bc=(n,e,t)=>{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<r.parent.content.size)return!1;s=vo(r)}let o=s&&s.nodeAfter;return!o||!$.isSelectable(o)?!1:(e&&e(n.tr.setSelection($.create(n.doc,s.pos)).scrollIntoView()),!0)};function vo(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const _p=(n,e)=>{let t=n.selection,r=t instanceof $,i;if(r){if(t.node.isTextblock||!zt(n.doc,t.from))return!1;i=t.from}else if(i=Fi(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection($.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},vp=(n,e)=>{let t=n.selection,r;if(t instanceof $){if(t.node.isTextblock||!zt(n.doc,t.to))return!1;r=t.to}else if(r=Fi(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},Sp=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Rn(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},$c=(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 So(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const wp=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=So(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(V.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},zc=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Ve||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=So(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(o,s.createAndFill());a.setSelection(U.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Fc=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(yt(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Rn(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Tp(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof $&&e.selection.node.isBlock)return!r.parentOffset||!yt(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=So(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),s.unshift(l&&a?{type:a}:null),o=p;break}else{if(p==1)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof U||e.selection instanceof Ve)&&d.deleteSelection();let u=d.mapping.map(r.pos),f=yt(d.doc,u,s.length,s);if(f||(s[0]=a?{type:a}:null,f=yt(d.doc,u,s.length,s)),!f)return!1;if(d.split(u,s.length,s),!l&&c&&r.node(o).type!=a){let p=d.mapping.map(r.before(o)),h=d.doc.resolve(p);a&&r.node(o-1).canReplaceWith(h.index(),h.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(o)),a)}return t&&t(d.scrollIntoView()),!0}}const xp=Tp(),Np=(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($.create(n.doc,i))),!0)};function Cp(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||zt(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Uc(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&Cp(n,e,t))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,h=x.empty;for(let b=o.length-1;b>=0;b--)h=x.from(o[b].create(null,h));h=x.from(i.copy(h));let m=n.tr.step(new Ee(e.pos-1,p,e.pos,p,new D(h,1,0),o.length,!0)),g=m.doc.resolve(p+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&zt(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let d=s.type.spec.isolating||r>0&&l?null:V.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&Rn(u);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(u,f).scrollIntoView()),!0;if(c&&Tn(s,"start",!0)&&Tn(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let b=x.empty;for(let y=h.length-1;y>=0;y--)b=x.from(h[y].copy(b));let E=n.tr.step(new Ee(e.pos-h.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new D(b,h.length,0),0,!0));t(E.scrollIntoView())}return!0}}return!1}function Hc(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(U.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Mp=Hc(-1),Ap=Hc(1);function Op(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),a=o&&yo(o,n,e);return a?(r&&r(t.tr.wrap(o,a).scrollIntoView()),!0):!1}}function xa(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(o,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,e)))if(l.type==n)i=!0;else{let d=t.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=t.selection.ranges[o];s.setBlockType(a,l,n,e)}r(s.scrollIntoView())}return!0}}function wo(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}wo(ko,Rc,Dc);wo(ko,Pc,Bc);wo($c,zc,Fc,xp);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Rp(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let a=r?t.tr:null;return Ip(a,o,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Ip(n,e,t,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new jr(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new jr(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=yo(s,t,r,e);return a?(n&&Dp(n,e,a,i,t),!0):!1}function Dp(n,e,t,r,i){let s=x.empty;for(let d=t.length-1;d>=0;d--)s=x.from(t[d].type.create(t[d].attrs,s));n.step(new Ee(e.start-(r?2:0),e.end,e.start,e.end,new D(s,0,0),t.length,!0));let o=0;for(let d=0;d<t.length;d++)t[d].type==i&&(o=d+1);let a=t.length-o,l=e.start+t.length-(r?2:0),c=e.parent;for(let d=e.startIndex,u=e.endIndex,f=!0;d<u;d++,f=!1)!f&&yt(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function Lp(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Pp(e,t,n,s):Bp(e,t,s):!0:!1}}function Pp(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Ee(s-1,o,s,o,new D(x.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new jr(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=Rn(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return zt(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function Bp(n,e,t){let r=n.tr,i=t.parent;for(let p=t.end,h=t.endIndex-1,m=t.startIndex;h>m;h--)p-=i.child(h).nodeSize,r.delete(p-1,p+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),d=s.index(-1);if(!c.canReplace(d+(a?0:1),d+1,o.content.append(l?x.empty:x.from(i))))return!1;let u=s.pos,f=u+o.nodeSize;return r.step(new Ee(u-(a?1:0),f+(l?1:0),u+1,f-1,new D((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 $p(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,d=x.from(c?n.create():null),u=new D(x.from(n.create(null,x.from(a.type.create(null,d)))),c?3:1,0),f=s.start,p=s.end;t(e.tr.step(new Ee(f-(c?3:1),p,f,p,u,1,!0)).scrollIntoView())}return!0}}const we=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},xn=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Ks=null;const mt=function(n,e,t){let r=Ks||(Ks=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},zp=function(){Ks=null},nn=function(n,e,t,r){return t&&(Na(n,e,t,r,-1)||Na(n,e,t,r,1))},Fp=/^(img|br|input|textarea|hr)$/i;function Na(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Xe(n))){let o=n.parentNode;if(!o||o.nodeType!=1||pr(n)||Fp.test(n.nodeName)||n.contentEditable=="false")return!1;e=we(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?Xe(n):0}else return!1}}function Xe(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Up(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Xe(n)}else if(n.parentNode&&!pr(n))e=we(n),n=n.parentNode;else return null}}function Hp(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!pr(n))e=we(n)+1,n=n.parentNode;else return null}}function Kp(n,e,t){for(let r=e==0,i=e==Xe(n);r||i;){if(n==t)return!0;let s=we(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Xe(n)}}function pr(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 Ki=function(n){return n.focusNode&&nn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Kt(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Vp(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Wp(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Xe(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Xe(r.startContainer),r.startOffset)}}}const lt=typeof navigator<"u"?navigator:null,Ca=typeof document<"u"?document:null,Ft=lt&&lt.userAgent||"",Vs=/Edge\/(\d+)/.exec(Ft),Kc=/MSIE \d/.exec(Ft),Ws=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ft),Fe=!!(Kc||Ws||Vs),Dt=Kc?document.documentMode:Ws?+Ws[1]:Vs?+Vs[1]:0,Qe=!Fe&&/gecko\/(\d+)/i.test(Ft);Qe&&+(/Firefox\/(\d+)/.exec(Ft)||[0,0])[1];const Gs=!Fe&&/Chrome\/(\d+)/.exec(Ft),xe=!!Gs,Vc=Gs?+Gs[1]:0,Re=!Fe&&!!lt&&/Apple Computer/.test(lt.vendor),Nn=Re&&(/Mobile\/\w+/.test(Ft)||!!lt&&lt.maxTouchPoints>2),Ze=Nn||(lt?/Mac/.test(lt.platform):!1),Wc=lt?/Win/.test(lt.platform):!1,bt=/Android \d/.test(Ft),hr=!!Ca&&"webkitFontSmoothing"in Ca.documentElement.style,Gp=hr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function qp(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ut(n,e){return typeof n=="number"?n:n[e]}function Jp(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 Ma(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;){if(o.nodeType!=1){o=xn(o);continue}let a=o,l=a==s.body,c=l?qp(s):Jp(a),d=0,u=0;if(e.top<c.top+ut(r,"top")?u=-(c.top-e.top+ut(i,"top")):e.bottom>c.bottom-ut(r,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+ut(i,"top")-c.top:e.bottom-c.bottom+ut(i,"bottom")),e.left<c.left+ut(r,"left")?d=-(c.left-e.left+ut(i,"left")):e.right>c.right-ut(r,"right")&&(d=e.right-c.right+ut(i,"right")),d||u)if(l)s.defaultView.scrollBy(d,u);else{let p=a.scrollLeft,h=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let m=a.scrollLeft-p,g=a.scrollTop-h;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:xn(o)}}function Yp(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<Math.min(innerHeight,e.bottom);o+=5){let a=n.root.elementFromPoint(s,o);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=t-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Gc(n.dom)}}function Gc(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=xn(r));return e}function jp({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;qc(t,r==0?0:r-e)}function qc(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let un=null;function Zp(n){if(n.setActive)return n.setActive();if(un)return n.focus(un);let e=Gc(n);n.focus(un==null?{get preventScroll(){return un={preventScroll:!0},!0}}:void 0),un||(un=!1,qc(e,0))}function Jc(n,e){let t,r=2e8,i,s=0,o=e.top,a=e.top,l,c;for(let d=n.firstChild,u=0;d;d=d.nextSibling,u++){let f;if(d.nodeType==1)f=d.getClientRects();else if(d.nodeType==3)f=mt(d).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=o&&h.bottom>=a){o=Math.max(h.bottom,o),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){t=d,r=m,i=m&&t.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,d.nodeType==1&&m&&(s=u+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=d,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=u+1)}}return!t&&l&&(t=l,i=c,r=0),t&&t.nodeType==3?Xp(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Jc(t,i)}function Xp(n,e){let t=n.nodeValue.length,r=document.createRange(),i;for(let s=0;s<t;s++){r.setEnd(n,s+1),r.setStart(n,s);let o=St(r,1);if(o.top!=o.bottom&&To(e,o)){i={node:n,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:n,offset:0}}function To(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Qp(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function eh(n,e,t){let{node:r,offset:i}=Jc(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function th(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function Yc(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(To(e,c))return Yc(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function nh(n,e){let t=n.dom.ownerDocument,r,i=0,s=Wp(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!To(e,c)||(o=Yc(n.dom,e,c),!o))return null}if(Re)for(let c=o;r&&c;c=xn(c))c.draggable&&(r=void 0);if(o=Qp(o,e),r){if(Qe&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&i++}let c;hr&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=th(n,r,i,e))}a==null&&(a=eh(n,o,e));let l=n.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Aa(n){return n.top<n.bottom||n.left<n.right}function St(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Aa(r))return r}return Array.prototype.find.call(t,Aa)||n.getBoundingClientRect()}const rh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function jc(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=hr||Qe;if(r.nodeType==3)if(o&&(rh.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let l=St(mt(r,i,i),t);if(Qe&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=St(mt(r,i-1,i-1),-1);if(c.top==l.top){let d=St(mt(r,i,i+1),-1);if(d.top!=l.top)return Dn(d,d.left<c.left)}}return l}else{let l=i,c=i,d=t<0?1:-1;return t<0&&!i?(c++,d=-1):t>=0&&i==r.nodeValue.length?(l--,d=1):t<0?l--:c++,Dn(St(mt(r,l,c),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==Xe(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return gs(l.getBoundingClientRect(),!1)}if(s==null&&i<Xe(r)){let l=r.childNodes[i];if(l.nodeType==1)return gs(l.getBoundingClientRect(),!0)}return gs(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==Xe(r))){let l=r.childNodes[i-1],c=l.nodeType==3?mt(l,Xe(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Dn(St(c,1),!1)}if(s==null&&i<Xe(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?mt(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Dn(St(c,-1),!0)}return Dn(St(r.nodeType==3?mt(r):r,-t),t>=0)}function Dn(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 gs(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 Zc(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 ih(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return Zc(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.contentDOM||a.dom;break}s=a.dom.parentNode}let o=jc(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=mt(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const sh=/[\u0590-\u08ac]/;function oh(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 a?!sh.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:o:Zc(n,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:h,focusOffset:m}=n.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),g}):r.pos==r.start()||r.pos==r.end()}let Oa=null,Ra=null,Ia=!1;function ah(n,e,t){return Oa==e&&Ra==t?Ia:(Oa=e,Ra=t,Ia=t=="up"||t=="down"?ih(n,e,t):oh(n,e,t))}const et=0,Da=1,Vt=2,ct=3;class mr{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=et,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>we(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??r>0?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;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Qc){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 Xc&&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?we(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?we(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(i==-1&&e<=c){let d=o+l.border;if(e>=d&&t<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,t,d);e=o;for(let u=a;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=we(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 d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){s=we(u.dom);break}t+=u.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let p=0,h=0;p<this.children.length;p++){let m=this.children[p],g=h+m.size;if(s>h&&o<g)return m.setSelection(e-h-m.border,t-h-m.border,r,i);h=g}let a=this.domFromPos(e,e?-1:1),l=t==e?a:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((Qe||Re)&&e==t){let{node:p,offset:h}=a;if(p.nodeType==3){if(u=!!(h&&p.nodeValue[h-1]==`
`),u&&h==p.nodeValue.length)for(let m=p,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=l={node:g.parentNode,offset:we(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=p.childNodes[h-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Qe&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let p=d.focusNode.childNodes[d.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||u&&Re)&&nn(a.node,a.offset,d.anchorNode,d.anchorOffset)&&nn(l.node,l.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(u&&Qe)){c.collapse(a.node,a.offset);try{e!=t&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>t){let h=a;a=l,l=h}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let a=r+s.border,l=o-s.border;if(e>=a&&t<=l){this.dirty=e==r||t==o?Vt:Da,e==a&&t==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ct:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Vt:ct}r=o}this.dirty=Vt}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Vt:Da;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Xc extends mr{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let 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==et&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class lh extends mr{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 rn extends mr{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=on.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new rn(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ct||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ct&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=et){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=et}}slice(e,t,r){let i=rn.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=Js(s,t,o,r)),e>0&&(s=Js(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Lt extends mr{constructor(e,t,r,i,s,o,a,l,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,t,r,i,s,o){let a=s.nodeViews[t.type.name],l,c=a&&a(t,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=on.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let f=d;return d=nd(d,r,t),c?l=new ch(e,t,r,i,d,u||null,f,c,s,o+1):t.isText?new Vi(e,t,r,i,d,f,s):new Lt(e,t,r,i,d,u||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==et&&e.eq(this.node)&&Xr(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 uh(this,o&&o.node,e);hh(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e,d):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?te.none:this.node.child(d).marks,r,e,d),l.placeWidget(c,e,i)},(c,d,u,f)=>{l.syncToMarks(c.marks,r,e,f);let p;l.findNodeMatch(c,d,u,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(c,d,u,p,e)||l.updateNextNode(c,d,u,e,f,i)||l.addNode(c,d,u,e,i),i+=c.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Vt)&&(o&&this.protectLocalComposition(e,o),ed(this.contentDOM,this.children,e),Nn&&mh(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof U)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=gh(this.node.content,o,r-t,i-t);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,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 lh(this,s,t,i);e.input.compositionNodes.push(o),this.children=Js(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==ct||!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=et}updateOuterDeco(e){if(Xr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=td(this.dom,this.nodeDOM,qs(this.outerDeco,this.node,t),qs(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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function La(n,e,t,r,i){nd(r,e,n);let s=new Lt(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Vi extends Lt{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==ct||this.dirty!=et&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=et||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=et,!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 Vi(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=ct)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Qc extends mr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==et&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ch extends Lt{constructor(e,t,r,i,s,o,a,l,c,d){super(e,t,r,i,s,o,a,c,d),this.spec=l}update(e,t,r,i){if(this.dirty==ct)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){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.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ed(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==n){for(;a!=r;)r=Pa(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(o instanceof rn){let l=r?r.previousSibling:n.lastChild;ed(o.contentDOM,o.children,t),r=l?l.nextSibling:n.firstChild}}for(;r;)r=Pa(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const Wn=function(n){n&&(this.nodeName=n)};Wn.prototype=Object.create(null);const Wt=[new Wn];function qs(n,e,t){if(n.length==0)return Wt;let r=t?Wt[0]:new Wn,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new Wn(o.nodeName));for(let a in o){let l=o[a];l!=null&&(t&&i.length==1&&i.push(r=new Wn(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function td(n,e,t,r){if(t==Wt&&r==Wt)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=t[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=Wt[0]),i=l}dh(i,a||Wt[0],o)}return i}function dh(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function nd(n,e,t){return td(n,n,Wt,qs(e,t,n.nodeType!=1))}function Xr(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Pa(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class uh{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=fh(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=et,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[o])&&!this.isLocked(u.dom)){l=d;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=rn.create(this.top,e[o],t,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}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);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==ct&&o.dom==o.contentDOM&&(o.dirty=Vt),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Lt){let c=this.preMatch.matched.get(l);if(c!=null&&c!=s)return!1;let d=l.dom,u,f=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=ct&&Xr(t,l.outerDeco));if(!f&&l.update(e,t,r,i))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(l,e,t,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Vt,u.updateChildren(i,o+1),u.dirty=et),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Xr(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Lt.create(this.top,t,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,t,r,i,s){let o=Lt.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Xc(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof rn;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Vi)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Re||xe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Qc(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function fh(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let c=t.children[r-1];if(c instanceof rn)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 ph(n,e){return n.type.side-e.type.side}function hh(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,i,e.forChild(s,d),c),s+=d.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let d,u;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(d?(u||(u=[d])).push(g):d=g)}if(d)if(u){u.sort(ph);for(let g=0;g<u.length;g++)t(u[g],c,!!l)}else t(d,c,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(c<n.childCount)p=c,f=n.child(c++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let h=s+f.nodeSize;if(f.isText){let g=h;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<h&&(l=f.cut(g-s),f=f.cut(0,g-s),h=g,p=-1)}else for(;o<i.length&&i[o].to<h;)o++;let m=f.isInline&&!f.isLeaf?a.filter(g=>!g.inline):a.slice();r(f,m,e.forChild(s,f),p),s=h}}function mh(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 gh(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;l+=c.text}if(s>=t){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=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 Js(n,e,t,r,i){let s=[];for(let o=0,a=0;o<n.length;o++){let l=n[o],c=a,d=a+=l.size;c>=t||d<=e?s.push(l):(c<e&&s.push(l.slice(0,e-c,r)),i&&(s.push(i),i=void 0),d>t&&s.push(l.slice(t-c,l.size,r)))}return s}function xo(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(Ki(t)){for(l=o;i&&!i.node;)i=i.parent;let u=i.node;if(i&&u.isAtom&&$.isSelectable(u)&&i.parent&&!(u.isInline&&Kp(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new $(o==f?a:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let u=o,f=o;for(let p=0;p<t.rangeCount;p++){let h=t.getRangeAt(p);u=Math.min(u,n.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(u<0)return null;[l,o]=f==n.state.selection.anchor?[f,u]:[u,f],a=r.resolve(o)}else l=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(l<0)return null}let d=r.resolve(l);if(!c){let u=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;c=No(n,d,a,u)}return c}function rd(n){return n.editable?n.hasFocus():sd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Et(n,e=!1){let t=n.state.selection;if(id(n,t),!!rd(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&xe){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&nn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)yh(n);else{let{anchor:r,head:i}=t,s,o;Ba&&!(t instanceof U)&&(t.$from.parent.inlineContent||(s=$a(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=$a(n,t.to))),n.docView.setSelection(r,i,n,e),Ba&&(s&&za(s),o&&za(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&bh(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Ba=Re||xe&&Vc<63;function $a(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Re&&i&&i.contentEditable=="false")return bs(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return bs(i);if(s)return bs(s)}}function bs(n){return n.contentEditable="true",Re&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function za(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function bh(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!rd(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function yh(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,we(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&Fe&&Dt<=11&&(t.disabled=!0,t.disabled=!1)}function id(n,e){if(e instanceof $){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Fa(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Fa(n)}function Fa(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function No(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||U.between(e,t,r)}function Ua(n){return n.editable&&!n.hasFocus()?!1:sd(n)}function sd(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 Eh(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return nn(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Ys(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&&V.findFrom(s,e)}function wt(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ha(n,e,t){let r=n.state.selection;if(r instanceof U)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return wt(n,new U(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Ys(n.state,e);return i&&i instanceof $?wt(n,i):!1}else if(!(Ze&&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?$.isSelectable(s)?wt(n,new $(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):hr?wt(n,new U(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof $&&r.node.isInline)return wt(n,new U(e>0?r.$to:r.$from));{let i=Ys(n.state,e);return i?wt(n,i):!1}}}function Qr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Gn(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function fn(n,e){return e<0?kh(n):_h(n)}function kh(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Qe&&t.nodeType==1&&r<Qr(t)&&Gn(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(Gn(a,-1))i=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(od(t))break;{let a=t.previousSibling;for(;a&&Gn(a,-1);)i=t.parentNode,s=we(a),a=a.previousSibling;if(a)t=a,r=Qr(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?js(n,t,r):i&&js(n,i,s)}function _h(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Qr(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let a=t.childNodes[r];if(Gn(a,1))s=t,o=++r;else break}else{if(od(t))break;{let a=t.nextSibling;for(;a&&Gn(a,1);)s=a.parentNode,o=we(a)+1,a=a.nextSibling;if(a)t=a,r=0,i=Qr(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&js(n,s,o)}function od(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function vh(n,e){for(;n&&e==n.childNodes.length&&!pr(n);)e=we(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Sh(n,e){for(;n&&!e&&!pr(n);)e=we(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function js(n,e,t){if(e.nodeType!=3){let s,o;(o=vh(e,t))?(e=o,t=0):(s=Sh(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Ki(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Et(n)},50)}function Ka(n,e){let t=n.state.doc.resolve(e);if(!(xe||Wc)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Va(n,e,t){let r=n.state.selection;if(r instanceof U&&!r.empty||t.indexOf("s")>-1||Ze&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Ys(n.state,e);if(o&&o instanceof $)return wt(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ve?V.near(o,e):V.findFrom(o,e);return a?wt(n,a):!1}return!1}function Wa(n,e){if(!(n.state.selection instanceof U))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 Ga(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function wh(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;Ga(n,r,"true"),setTimeout(()=>Ga(n,r,"false"),20)}return!1}function Th(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function xh(n,e){let t=e.keyCode,r=Th(e);if(t==8||Ze&&t==72&&r=="c")return Wa(n,-1)||fn(n,-1);if(t==46&&!e.shiftKey||Ze&&t==68&&r=="c")return Wa(n,1)||fn(n,1);if(t==13||t==27)return!0;if(t==37||Ze&&t==66&&r=="c"){let i=t==37?Ka(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ha(n,i,r)||fn(n,i)}else if(t==39||Ze&&t==70&&r=="c"){let i=t==39?Ka(n,n.state.selection.from)=="ltr"?1:-1:1;return Ha(n,i,r)||fn(n,i)}else{if(t==38||Ze&&t==80&&r=="c")return Va(n,-1,r)||fn(n,-1);if(t==40||Ze&&t==78&&r=="c")return wh(n)||Va(n,1,r)||fn(n,1);if(r==(Ze?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Co(n,e){n.someProp("transformCopied",p=>{e=p(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 p=r.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=n.someProp("clipboardSerializer")||on.fromSchema(n.state.schema),a=fd(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=ud[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let h=a.createElement(d[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",p=>p(e,n))||e.content.textBetween(0,e.content.size,`
`);return{dom:l,text:f,slice:e}}function ad(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 a=new D(x.from(n.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0),n.someProp("transformPasted",f=>{a=f(a,n,!0)}),a;let u=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(u)a=u;else{let f=i.marks(),{schema:p}=n.state,h=on.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,f)))})}}else n.someProp("transformPastedHTML",u=>{t=u(t,n)}),o=Ah(t),hr&&Oh(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){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")||It.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Nh.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Rh(qa(a,+d[1],+d[2]),d[4]);else if(a=D.maxOpen(Ch(a.content,i),!0),a.openStart||a.openEnd){let u=0,f=0;for(let p=a.content.firstChild;u<a.openStart&&!p.type.spec.isolating;u++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=qa(a,u,f)}return n.someProp("transformPasted",u=>{a=u(a,n,l)}),a}const Nh=/^(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 Ch(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&&cd(l,s,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=dd(o[o.length-1],s.length));let d=ld(a,l);o.push(d),i=i.matchType(d.type),s=l}}),o)return x.from(o)}return n}function ld(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,x.from(n));return n}function cd(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=cd(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(x.from(ld(t,n,i+1))))}}function dd(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,dd(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(x.empty,!0);return n.copy(t.append(r))}function Zs(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,a=o.content;return n.childCount>1&&(s=0),i<r-1&&(a=Zs(a,e,t,r,i+1,s)),i>=t&&(a=e<0?o.contentMatchAt(0).fillBefore(a,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 qa(n,e,t){return e<n.openStart&&(n=new D(Zs(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new D(Zs(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const ud={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Ja=null;function fd(){return Ja||(Ja=document.implementation.createHTMLDocument("title"))}let ys=null;function Mh(n){let e=window.trustedTypes;return e?(ys||(ys=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),ys.createHTML(n)):n}function Ah(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=fd().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&ud[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Mh(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Oh(n){let e=n.querySelectorAll(xe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Rh(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:o}=n;for(let a=r.length-2;a>=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 D(i,s,o)}const Be={},$e={},Ih={touchstart:!0,touchmove:!0};class Dh{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Lh(n){for(let e in Be){let t=Be[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Bh(n,r)&&!Mo(n,r)&&(n.editable||!(r.type in $e))&&t(n,r)},Ih[e]?{passive:!0}:void 0)}Re&&n.dom.addEventListener("input",()=>null),Xs(n)}function Ot(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Ph(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Xs(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Mo(n,r))})}function Mo(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Bh(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 $h(n,e){!Mo(n,e)&&Be[e.type]&&(n.editable||!(e.type in $e))&&Be[e.type](n,e)}$e.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!hd(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(bt&&xe&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Nn&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Kt(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||xh(n,t)?t.preventDefault():Ot(n,"key")};$e.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};$e.keypress=(n,e)=>{let t=e;if(hd(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Ze&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof U)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function Wi(n){return{left:n.clientX,top:n.clientY}}function zh(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Ao(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 Sn(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Fh(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&$.isSelectable(r)?(Sn(n,new $(t)),!0):!1}function Uh(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof $&&(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($.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?(Sn(n,$.create(n.state.doc,i)),!0):!1}function Hh(n,e,t,r,i){return Ao(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Uh(n,t):Fh(n,t))}function Kh(n,e,t,r){return Ao(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Vh(n,e,t,r){return Ao(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Wh(n,t,r)}function Wh(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Sn(n,U.create(r,0,r.content.size)),!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)Sn(n,U.create(r,a+1,a+1+o.content.size));else if($.isSelectable(o))Sn(n,$.create(r,a));else continue;return!0}}function Oo(n){return ei(n)}const pd=Ze?"metaKey":"ctrlKey";Be.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Oo(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&zh(t,n.input.lastClick)&&!t[pd]&&n.input.lastClick.button==t.button&&(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,button:t.button};let o=n.posAtCoords(Wi(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Gh(n,o,t,!!r)):(s=="doubleClick"?Kh:Vh)(n,o.pos,o.inside,t)?t.preventDefault():Ot(n,"pointer"))};class Gh{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[pd],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof $&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Qe&&!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)),Ot(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Et(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Wi(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ot(this.view,"pointer"):Hh(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Re&&this.mightDrag&&!this.mightDrag.node.isAtom||xe&&!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)?(Sn(this.view,V.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ot(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ot(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)}}Be.touchstart=n=>{n.input.lastTouch=Date.now(),Oo(n),Ot(n,"pointer")};Be.touchmove=n=>{n.input.lastTouch=Date.now(),Ot(n,"pointer")};Be.contextmenu=n=>Oo(n);function hd(n,e){return n.composing?!0:Re&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const qh=bt?5e3:-1;$e.compositionstart=$e.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof U&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||xe&&Wc&&Jh(n)))n.markCursor=n.state.storedMarks||t.marks(),ei(n,!0),n.markCursor=null;else if(ei(n,!e.selection.empty),Qe&&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){let a=n.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}md(n,qh)};function Jh(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let r=e.childNodes[t];return r.nodeType==1&&r.contentEditable=="false"}$e.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,md(n,20))};function md(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>ei(n),e))}function gd(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=jh());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Yh(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Up(e.focusNode,e.focusOffset),r=Hp(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function jh(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function ei(n,e=!1){if(!(bt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),gd(n),e||n.docView&&n.docView.dirty){let t=xo(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Zh(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 ir=Fe&&Dt<15||Nn&&Gp<604;Be.copy=$e.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=ir?null:t.clipboardData,o=r.content(),{dom:a,text:l}=Co(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):Zh(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Xh(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Qh(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?sr(n,r.value,null,i,e):sr(n,r.textContent,r.innerHTML,i,e)},50)}function sr(n,e,t,r,i){let s=ad(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",l=>l(n,i,s||D.empty)))return!0;if(!s)return!1;let o=Xh(s),a=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bd(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}$e.paste=(n,e)=>{let t=e;if(n.composing&&!bt)return;let r=ir?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&sr(n,bd(r),r.getData("text/html"),i,t)?t.preventDefault():Qh(n,t)};class yd{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const em=Ze?"altKey":"ctrlKey";function Ed(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[em]}Be.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(Wi(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof $?i.to-1:i.to))){if(r&&r.mightDrag)o=$.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=n.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=n.docView&&(o=$.create(n.state.doc,u.posBefore))}}let a=(o||n.state.selection).content(),{dom:l,text:c,slice:d}=Co(n,a);(!t.dataTransfer.files.length||!xe||Vc>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ir?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",ir||t.dataTransfer.setData("text/plain",c),n.dragging=new yd(d,Ed(n,t),o)};Be.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};$e.dragover=$e.dragenter=(n,e)=>e.preventDefault();$e.drop=(n,e)=>{try{tm(n,e,n.dragging)}finally{n.dragging=null}};function tm(n,e,t){if(!e.dataTransfer)return;let r=n.posAtCoords(Wi(e));if(!r)return;let i=n.state.doc.resolve(r.pos),s=t&&t.slice;s?n.someProp("transformPasted",p=>{s=p(s,n,!1)}):s=ad(n,bd(e.dataTransfer),ir?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(t&&Ed(n,e));if(n.someProp("handleDrop",p=>p(n,e,s||D.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?Sc(n.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=n.state.tr;if(o){let{node:p}=t;p?p.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,u=l.doc;if(d?l.replaceRangeWith(c,c,s.content.firstChild):l.replaceRange(c,c,s),l.doc.eq(u))return;let f=l.doc.resolve(c);if(d&&$.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new $(f));else{let p=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((h,m,g,b)=>p=b),l.setSelection(No(n,f,l.doc.resolve(p)))}n.focus(),n.dispatch(l.setMeta("uiEvent","drop"))}Be.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Et(n)},20))};Be.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)};Be.beforeinput=(n,e)=>{if(xe&&bt&&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,Kt(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in $e)Be[n]=$e[n];function or(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 ti{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 Oe(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof ti&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&or(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Pt{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 Oe(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Pt&&or(this.attrs,e.attrs)&&or(this.spec,e.spec)}static is(e){return e.type instanceof Pt}destroy(){}}class Ro{constructor(e,t){this.attrs=e,this.spec=t||jt}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new Oe(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Ro&&or(this.attrs,e.attrs)&&or(this.spec,e.spec)}destroy(){}}class Oe{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Oe(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Oe(e,e,new ti(t,r))}static inline(e,t,r,i){return new Oe(e,t,new Pt(r,i))}static node(e,t,r,i){return new Oe(e,t,new Ro(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Pt}get widget(){return this.type instanceof ti}}const mn=[],jt={};class ae{constructor(e,t){this.local=e.length?e:mn,this.children=t.length?t:mn}static create(e,t){return t.length?ni(t,e,0,jt):Ce}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){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==Ce||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<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(t,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?nm(this.children,o||[],e,t,r,i,s):o?new ae(o.sort(Zt),mn):Ce}add(e,t){return t.length?this==Ce?ae.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((a,l)=>{let c=l+r,d;if(d=_d(t,a,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,d,c+1):i.splice(s,0,l,l+a.nodeSize,ni(d,a,c+1,jt)),s+=3}});let o=kd(s?vd(t):t,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ae(o.length?this.local.concat(o).sort(Zt):this.local,i||this.children)}remove(e){return e.length==0||this==Ce?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+t,l=r[s+1]+t;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<l&&(e[d]=null,(o||(o=[])).push(u));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,a+1);c!=Ce?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ae(i,r):Ce}forChild(e,t){if(this==Ce)return this;if(t.isLeaf)return ae.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+t.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof Pt){let c=Math.max(s,l.from)-s,d=Math.min(o,l.to)-s;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new ae(i.sort(Zt),mn);return r?new Nt([a,r]):a}return r||Ce}eq(e){if(this==e)return!0;if(!(e instanceof ae)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Io(this.localsInner(e))}localsInner(e){if(this==Ce)return mn;if(e.inlineContent||!this.local.some(Pt.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Pt||t.push(this.local[r]);return t}forEachSet(e){e(this)}}ae.empty=new ae([],[]);ae.removeOverlap=Io;const Ce=ae.empty;class Nt{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,jt));return Nt.from(r)}forChild(e,t){if(t.isLeaf)return ae.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=Ce&&(s instanceof Nt?r=r.concat(s.members):r.push(s))}return Nt.from(r)}eq(e){if(!(e instanceof Nt)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?Io(r?t:t.sort(Zt)):mn}static from(e){switch(e.length){case 0:return Ce;case 1:return e[0];default:return new Nt(e.every(t=>t instanceof ae)?e:e.reduce((t,r)=>t.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function nm(n,e,t,r,i,s,o){let a=n.slice();for(let c=0,d=s;c<t.maps.length;c++){let u=0;t.maps[c].forEach((f,p,h,m)=>{let g=m-h-(p-f);for(let b=0;b<a.length;b+=3){let E=a[b+1];if(E<0||f>E+d-u)continue;let y=a[b]+d-u;p>=y?a[b+1]=f<=y?-2:-1:f>=d&&g&&(a[b]+=g,a[b+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=t.map(n[c]+s),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let f=t.map(n[c+1]+s,-1),p=f-i,{index:h,offset:m}=r.content.findIndex(u),g=r.maybeChild(h);if(g&&m==u&&m+g.nodeSize==p){let b=a[c+2].mapInner(t,g,d+1,n[c]+s+1,o);b!=Ce?(a[c]=u,a[c+1]=p,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=rm(a,n,e,t,i,s,o),d=ni(c,r,0,o);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,f=0;u<d.children.length;u+=3){let p=d.children[u];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ae(e.sort(Zt),a)}function kd(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new Oe(i.from+e,i.to+e,i.type))}return t}function rm(n,e,t,r,i,s,o){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?t.push(u):o.onRemove&&o.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],e[l]+s+1);return t}function _d(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function vd(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ni(n,e,t,r){let i=[],s=!1;e.forEach((a,l)=>{let c=_d(n,a,l+t);if(c){s=!0;let d=ni(c,a,t+l+1,r);d!=Ce&&i.push(l,l+a.nodeSize,d)}});let o=kd(s?vd(n):n,-t).sort(Zt);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ae(o,i):Ce}function Zt(n,e){return n.from-e.from||n.to-e.to}function Io(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),Ya(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Ya(e,i,r.copy(s.from,r.to)));break}}}return e}function Ya(n,e,t){for(;e<n.length&&Zt(t,n[e])>0;)e++;n.splice(e,0,t)}function Es(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=Ce&&e.push(r)}),n.cursorWrapper&&e.push(ae.create(n.state.doc,[n.cursorWrapper.deco])),Nt.from(e)}const im={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},sm=Fe&&Dt<=11;class om{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 am{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new om,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Fe&&Dt<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Re&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),sm&&(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,im)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ua(this.view)){if(this.suppressingSelectionUpdates)return Et(this.view);if(Fe&&Dt<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&nn(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=xn(s))t.add(s);for(let s=e.anchorNode;s;s=xn(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}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ua(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;d<t.length;d++){let u=this.registerMutation(t[d],l);u&&(s=s<0?u.from:Math.min(u.from,s),o=o<0?u.to:Math.max(u.to,o),u.typeOver&&(a=!0))}if(l.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;for(;u&&u.nodeType==1;){if(u.contentEditable=="false"){d.parentNode.removeChild(d);break}u=u.firstChild}}}else if(Qe&&l.length){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!u||dm(e,u)!=p)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ki(r)&&(c=xo(e))&&c.eq(V.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Et(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),lm(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,um(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Et(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];t.push(u),u.nodeType==3&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Fe&&Dt<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:f}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(i=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?we(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?we(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ja=new WeakMap,Za=!1;function lm(n){if(!ja.has(n)&&(ja.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Qe,Za)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Za=!0}}function Xa(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return nn(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function cm(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return Xa(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Xa(n,t):null}function dm(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function um(n,e){var t;let{focusNode:r,focusOffset:i}=n.domSelectionRange();for(let s of e)if(((t=s.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&n.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function fm(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=n.docView.parseRange(e,t),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Ki(l)||c.push({node:l.focusNode,offset:l.focusOffset})),xe&&n.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=r.childNodes[g-1],E=b.pmViewDesc;if(b.nodeName=="BR"&&!E){s=g;break}if(!E||E.size)break}let u=n.state.doc,f=n.someProp("domParser")||It.fromSchema(n.state.schema),p=u.resolve(o),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:pm,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),h={anchor:g+o,head:b+o}}return{doc:m,sel:h,from:o,to:a}}function pm(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}const hm=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function mm(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,R=xo(n,A);if(R&&!n.state.selection.eq(R)){if(xe&&bt&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",Y=>Y(n,Kt(13,"Enter"))))return;let L=n.state.tr.setSelection(R);A=="pointer"?L.setMeta("pointer",!0):A=="key"&&L.scrollIntoView(),s&&L.setMeta("composition",s),n.dispatch(L)}return}let o=n.state.doc.resolve(e),a=o.sharedDepth(t);e=o.before(a+1),t=n.state.doc.resolve(t).after(a+1);let l=n.state.selection,c=fm(n,e,t),d=n.state.doc,u=d.slice(c.from,c.to),f,p;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,p="end"):(f=n.state.selection.from,p="start"),n.input.lastKeyCode=null;let h=ym(u.content,c.doc.content,c.from,f,p);if(h&&n.input.domChangeCount++,(Nn&&n.input.lastIOSEnter>Date.now()-225||bt)&&i.some(A=>A.nodeType==1&&!hm.test(A.nodeName))&&(!h||h.endA>=h.endB)&&n.someProp("handleKeyDown",A=>A(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof U&&!l.empty&&l.$head.sameParent(l.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=Qa(n,n.state.doc,c.sel);if(A&&!A.eq(n.state.selection)){let R=n.state.tr.setSelection(A);s&&R.setMeta("composition",s),n.dispatch(R)}}return}n.state.selection.from<n.state.selection.to&&h.start==h.endB&&n.state.selection instanceof U&&(h.start>n.state.selection.from&&h.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?h.start=n.state.selection.from:h.endA<n.state.selection.to&&h.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(h.endB+=n.state.selection.to-h.endA,h.endA=n.state.selection.to)),Fe&&Dt<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),g=c.doc.resolveNoCache(h.endB-c.from),b=d.resolve(h.start),E=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=h.endA;if((Nn&&n.input.lastIOSEnter>Date.now()-225&&(!E||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!E&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"","")))&&n.someProp("handleKeyDown",A=>A(n,Kt(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>h.start&&bm(d,h.start,h.endA,m,g)&&n.someProp("handleKeyDown",A=>A(n,Kt(8,"Backspace")))){bt&&xe&&n.domObserver.suppressSelectionUpdates();return}xe&&h.endB==h.start&&(n.input.lastChromeDelete=Date.now()),bt&&!E&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(A){return A(n,Kt(13,"Enter"))})},20));let y=h.start,w=h.endA,T=A=>{let R=A||n.state.tr.replace(y,w,c.doc.slice(h.start-c.from,h.endB-c.from));if(c.sel){let L=Qa(n,R.doc,c.sel);L&&!(xe&&n.composing&&L.empty&&(h.start!=h.endB||n.input.lastChromeDelete<Date.now()-100)&&(L.head==y||L.head==R.mapping.map(w)-1)||Fe&&L.empty&&L.head==y)&&R.setSelection(L)}return s&&R.setMeta("composition",s),R.scrollIntoView()},M;if(E)if(m.pos==g.pos){Fe&&Dt<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Et(n),20));let A=T(n.state.tr.delete(y,w)),R=d.resolve(h.start).marksAcross(d.resolve(h.endA));R&&A.ensureMarks(R),n.dispatch(A)}else if(h.endA==h.endB&&(M=gm(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,h.endA-b.start())))){let A=T(n.state.tr);M.type=="add"?A.addMark(y,w,M.mark):A.removeMark(y,w,M.mark),n.dispatch(A)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let A=m.parent.textBetween(m.parentOffset,g.parentOffset),R=()=>T(n.state.tr.insertText(A,y,w));n.someProp("handleTextInput",L=>L(n,y,w,A,R))||n.dispatch(R())}else n.dispatch(T());else n.dispatch(T())}function Qa(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:No(n,e.resolve(t.anchor),e.resolve(t.head))}function gm(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<t.length;d++)s=t[d].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(x.from(c).eq(n))return{mark:a,type:o}}function bm(n,e,t,r,i){if(t-e<=i.pos-r.pos||ks(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(ks(s,!0,!0));return!o.parent.isTextblock||o.pos>t||ks(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function ks(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function ym(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<s&&n.size<e.size){let l=r<=s&&r>=o?s-r:0;s-=l,s&&s<e.size&&el(e.textBetween(s-1,s+1))&&(s+=l?1:-1),a=s+(a-o),o=s}else if(a<s){let l=r<=s&&r>=a?s-r:0;s-=l,s&&s<n.size&&el(n.textBetween(s-1,s+1))&&(s+=l?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function el(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Sd{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 Dh,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(sl),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=rl(this),nl(this),this.nodeViews=il(this),this.docView=La(this.state.doc,tl(this),Es(this),this.dom,this),this.domObserver=new am(this,(r,i,s,o)=>mm(this,r,i,s,o)),this.domObserver.start(),Lh(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&&Xs(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(sl),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(gd(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=il(this);km(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Xs(this),this.editable=rl(this),nl(this);let l=Es(this),c=tl(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,l);(u||!e.selection.eq(i.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Yp(this);if(o){this.domObserver.stop();let p=u&&(Fe||xe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Em(i.selection,e.selection);if(u){let h=xe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Yh(this)),(s||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=La(e.doc,c,l,this.dom,this)),h&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Eh(this))?Et(this,p):(id(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&jp(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof $){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Ma(this,t.getBoundingClientRect(),e)}else Ma(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new yd(e.slice,e.move,i<0?void 0:$.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=t?t(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=t?t(a):a))return i}}hasFocus(){if(Fe){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Zp(this.dom),Et(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return nh(this,e)}coordsAtPos(e,t=1){return jc(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 ah(this,t||this.state,e)}pasteHTML(e,t){return sr(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return sr(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Co(this,e)}destroy(){this.docView&&(Ph(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Es(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,zp())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $h(this,e)}domSelectionRange(){let e=this.domSelection();return e?Re&&this.root.nodeType===11&&Vp(this.dom.ownerDocument)==this.dom&&cm(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Sd.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function tl(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Oe.node(0,n.state.doc.content.size,e)]}function nl(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:Oe.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function rl(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Em(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 il(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 km(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 sl(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 Bt={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:"'"},ri={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_m=typeof navigator<"u"&&/Mac/.test(navigator.platform),vm=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Te=0;Te<10;Te++)Bt[48+Te]=Bt[96+Te]=String(Te);for(var Te=1;Te<=24;Te++)Bt[Te+111]="F"+Te;for(var Te=65;Te<=90;Te++)Bt[Te]=String.fromCharCode(Te+32),ri[Te]=String.fromCharCode(Te);for(var _s in Bt)ri.hasOwnProperty(_s)||(ri[_s]=Bt[_s]);function Sm(n){var e=_m&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||vm&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ri:Bt)[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 wm=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Tm=typeof navigator<"u"&&/Win/.test(navigator.platform);function xm(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))wm?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Nm(n){let e=Object.create(null);for(let t in n)e[xm(t)]=n[t];return e}function vs(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Cm(n){return new le({props:{handleKeyDown:wd(n)}})}function wd(n){let e=Nm(n);return function(t,r){let i=Sm(r),s,o=e[vs(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[vs(i,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Tm&&r.ctrlKey&&r.altKey)&&(s=Bt[r.keyCode])&&s!=i){let a=e[vs(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var Mm=Object.defineProperty,Do=(n,e)=>{for(var t in e)Mm(n,t,{get:e[t],enumerable:!0})};function Gi(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),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}}}var qi=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(n).map(([o,a])=>[o,(...c)=>{const d=a(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o=[],a=!!n,l=n||i.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(l),o.every(u=>u===!0)),d={...Object.fromEntries(Object.entries(t).map(([u,f])=>[u,(...h)=>{const m=this.buildProps(l,e),g=f(...h)(m);return o.push(g),d}])),run:c};return d}createCan(n){const{rawCommands:e,state:t}=this,r=!1,i=n||t.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:i}=this,{view:s}=r,o={tr:n,editor:r,view:s,state:Gi({state:i,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},Td={};Do(Td,{blur:()=>Am,clearContent:()=>Om,clearNodes:()=>Rm,command:()=>Im,createParagraphNear:()=>Dm,cut:()=>Lm,deleteCurrentNode:()=>Pm,deleteNode:()=>Bm,deleteRange:()=>$m,deleteSelection:()=>zm,enter:()=>Fm,exitCode:()=>Um,extendMarkRange:()=>Hm,first:()=>Km,focus:()=>Wm,forEach:()=>Gm,insertContent:()=>qm,insertContentAt:()=>jm,joinBackward:()=>Qm,joinDown:()=>Xm,joinForward:()=>eg,joinItemBackward:()=>tg,joinItemForward:()=>ng,joinTextblockBackward:()=>rg,joinTextblockForward:()=>ig,joinUp:()=>Zm,keyboardShortcut:()=>og,lift:()=>ag,liftEmptyBlock:()=>lg,liftListItem:()=>cg,newlineInCode:()=>dg,resetAttributes:()=>ug,scrollIntoView:()=>fg,selectAll:()=>pg,selectNodeBackward:()=>hg,selectNodeForward:()=>mg,selectParentNode:()=>gg,selectTextblockEnd:()=>bg,selectTextblockStart:()=>yg,setContent:()=>Eg,setMark:()=>Fg,setMeta:()=>Ug,setNode:()=>Hg,setNodeSelection:()=>Kg,setTextDirection:()=>Vg,setTextSelection:()=>Wg,sinkListItem:()=>Gg,splitBlock:()=>qg,splitListItem:()=>Jg,toggleList:()=>Yg,toggleMark:()=>jg,toggleNode:()=>Zg,toggleWrap:()=>Xg,undoInputRule:()=>Qg,unsetAllMarks:()=>eb,unsetMark:()=>tb,unsetTextDirection:()=>nb,updateAttributes:()=>rb,wrapIn:()=>ib,wrapInList:()=>sb});var Am=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),Om=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Rm=()=>({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:d}=e,u=c.resolve(d.map(l)),f=c.resolve(d.map(l+a.nodeSize)),p=u.blockRange(f);if(!p)return;const h=Rn(p);if(a.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},Im=n=>e=>n(e),Dm=()=>({state:n,dispatch:e})=>zc(n,e),Lm=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new U(r.doc.resolve(Math.max(o-1,0)))),!0},Pm=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),l=i.after(s);n.delete(a,l).scrollIntoView()}return!0}return!1};function me(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}var Bm=n=>({tr:e,state:t,dispatch:r})=>{const i=me(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},$m=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},zm=()=>({state:n,dispatch:e})=>ko(n,e),Fm=()=>({commands:n})=>n.keyboardShortcut("Enter"),Um=()=>({state:n,dispatch:e})=>wp(n,e);function Lo(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ii(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Lo(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function xd(n,e,t={}){return n.find(r=>r.type===e&&ii(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function ol(n,e,t={}){return!!xd(n,e,t)}function Po(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(d=>d.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(d=>d.type===e)||(t=t||((r=i.node.marks[0])==null?void 0:r.attrs),!xd([...i.node.marks],e,t)))return;let o=i.index,a=n.start()+i.offset,l=o+1,c=a+i.node.nodeSize;for(;o>0&&ol([...n.parent.child(o-1).marks],e,t);)o-=1,a-=n.parent.child(o).nodeSize;for(;l<n.parent.childCount&&ol([...n.parent.child(l).marks],e,t);)c+=n.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function kt(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var Hm=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=kt(n,r.schema),{doc:o,selection:a}=t,{$from:l,from:c,to:d}=a;if(i){const u=Po(l,s,e);if(u&&u.from<=c&&u.to>=d){const f=U.create(o,u.from,u.to);t.setSelection(f)}}return!0},Km=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Nd(n){return n instanceof U}function Gt(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Cd(n,e=null){if(!e)return null;const t=V.atStart(n),r=V.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?U.create(n,Gt(0,i,s),Gt(n.content.size,i,s)):U.create(n,Gt(e,i,s),Gt(e,i,s))}function al(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function si(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Vm(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Wm=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(si()||al())&&r.dom.focus(),Vm()&&!si()&&!al()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(r.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(s&&n===null&&!Nd(t.state.selection))return o(),!0;const a=Cd(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},Gm=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),qm=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Md=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Md(r)}return n};function wr(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Md(t)}function ar(n,e,t){if(n instanceof rt||n instanceof x)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return x.fromArray(n.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),ar("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,a="";const l=new fc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?It.fromSchema(l).parseSlice(wr(n),t.parseOptions):It.fromSchema(l).parse(wr(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=It.fromSchema(e);return t.slice?s.parseSlice(wr(n),t.parseOptions).content:s.parse(wr(n),t.parseOptions)}return ar("",e,t)}function Jm(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof pe||i instanceof Ee))return;const s=n.mapping.maps[r];let o=0;s.forEach((a,l,c,d)=>{o===0&&(o=d)}),n.setSelection(V.near(n.doc.resolve(o),t))}var Ym=n=>!("type"in n),jm=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const l=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{ar(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){l(g)}try{a=ar(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return l(g),!1}let{from:d,to:u}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,p=!0;if((Ym(a)?a:[a]).forEach(g=>{g.check(),f=f?g.isText&&g.marks.length===0:!1,p=p?g.isBlock:!1}),d===u&&p){const{parent:g}=r.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,u+=1)}let m;if(f){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof x){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,d,u)}else{m=a;const g=r.doc.resolve(d),b=g.node(),E=g.parentOffset===0,y=b.isText||b.isTextblock,w=b.content.size>0;E&&y&&w&&(d=Math.max(0,d-1)),r.replaceWith(d,u,m)}t.updateSelection&&Jm(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0},Zm=()=>({state:n,dispatch:e})=>_p(n,e),Xm=()=>({state:n,dispatch:e})=>vp(n,e),Qm=()=>({state:n,dispatch:e})=>Rc(n,e),eg=()=>({state:n,dispatch:e})=>Pc(n,e),tg=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Fi(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},ng=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Fi(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},rg=()=>({state:n,dispatch:e})=>Ep(n,e),ig=()=>({state:n,dispatch:e})=>kp(n,e);function Ad(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function sg(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))si()||Ad()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var og=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=sg(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 d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function $t(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,o=e?me(e,n.schema):null,a=[];n.doc.nodesBetween(r,i,(u,f)=>{if(u.isText)return;const p=Math.max(r,f),h=Math.min(i,f+u.nodeSize);a.push({node:u,from:p,to:h})});const l=i-r,c=a.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>ii(u.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=l}var ag=(n,e={})=>({state:t,dispatch:r})=>{const i=me(n,t.schema);return $t(t,i,e)?Sp(t,r):!1},lg=()=>({state:n,dispatch:e})=>Fc(n,e),cg=n=>({state:e,dispatch:t})=>{const r=me(n,e.schema);return Lp(r)(e,t)},dg=()=>({state:n,dispatch:e})=>$c(n,e);function Ji(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function ll(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var ug=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=Ji(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=me(n,r.schema)),a==="mark"&&(o=kt(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{s&&s===d.type&&(l=!0,i&&t.setNodeMarkup(u,void 0,ll(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(f=>{o===f.type&&(l=!0,i&&t.addMark(u,u+d.nodeSize,o.create(ll(f.attrs,e))))})})}),l},fg=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),pg=()=>({tr:n,dispatch:e})=>{if(e){const t=new Ve(n.doc);n.setSelection(t)}return!0},hg=()=>({state:n,dispatch:e})=>Dc(n,e),mg=()=>({state:n,dispatch:e})=>Bc(n,e),gg=()=>({state:n,dispatch:e})=>Np(n,e),bg=()=>({state:n,dispatch:e})=>Ap(n,e),yg=()=>({state:n,dispatch:e})=>Mp(n,e);function Qs(n,e,t={},r={}){return ar(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Eg=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const c=Qs(n,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:l.content.size},n,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Od(n,e){const t=kt(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 Rd(n,e){const t=new Cc(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function kg(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function eo(n,e){const t=[];return n.descendants((r,i)=>{e(r)&&t.push({node:r,pos:i})}),t}function _g(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function vg(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 Yi(n){return e=>vg(e.$from,n)}function B(n,e,t){return n.config[e]===void 0&&n.parent?B(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?B(n.parent,e,t):null}):n.config[e]}function Bo(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=B(e,"addExtensions",t);return r?[e,...Bo(r())]:e}).flat(10)}function $o(n,e){const t=on.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function Id(n){return typeof n=="function"}function X(n,e=void 0,...t){return Id(n)?e?n.bind(e)(...t):n(...t):n}function Sg(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Cn(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 Dd(n){const e=[],{nodeExtensions:t,markExtensions:r}=Cn(n),i=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=t.filter(c=>c.name!=="text").map(c=>c.name),a=r.map(c=>c.name),l=[...o,...a];return n.forEach(c=>{const d={name:c.name,options:c.options,storage:c.storage,extensions:i},u=B(c,"addGlobalAttributes",d);if(!u)return;u().forEach(p=>{let h;Array.isArray(p.types)?h=p.types:p.types==="*"?h=l:p.types==="nodes"?h=o:p.types==="marks"?h=a:h=[],h.forEach(m=>{Object.entries(p.attributes).forEach(([g,b])=>{e.push({type:m,name:g,attribute:{...s,...b}})})})})}),i.forEach(c=>{const d={name:c.name,options:c.options,storage:c.storage},u=B(c,"addAttributes",d);if(!u)return;const f=u();Object.entries(f).forEach(([p,h])=>{const m={...s,...h};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:c.name,name:p,attribute:m})})}),e}function wg(n){const e=[];let t="",r=!1,i=!1,s=0;const o=n.length;for(let a=0;a<o;a+=1){const l=n[a];if(l==="'"&&!i){r=!r,t+=l;continue}if(l==='"'&&!r){i=!i,t+=l;continue}if(!r&&!i){if(l==="("){s+=1,t+=l;continue}if(l===")"&&s>0){s-=1,t+=l;continue}if(l===";"&&s===0){e.push(t),t="";continue}}t+=l}return t&&e.push(t),e}function cl(n){const e=[],t=wg(n||""),r=t.length;for(let i=0;i<r;i+=1){const s=t[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),l=s.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function ge(...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}if(i==="class"){const a=s?String(s).split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ")}else if(i==="style"){const a=new Map([...cl(r[i]),...cl(s)]);r[i]=Array.from(a.entries()).map(([l,c])=>`${l}: ${c}`).join("; ")}else r[i]=s}),r},{})}function lr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>ge(t,r),{})}function Tg(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function dl(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(t):Tg(t.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function ul(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Sg(t)?!1:t!=null))}function fl(n){var e,t;const r={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(r.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(r.validate=n.attribute.validate),[n.name,r]}function xg(n,e){var t;const r=Dd(n),{nodeExtensions:i,markExtensions:s}=Cn(n),o=(t=i.find(c=>B(c,"topNode")))==null?void 0:t.name,a=Object.fromEntries(i.map(c=>{const d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((b,E)=>{const y=B(E,"extendNodeSchema",u);return{...b,...y?y(c):{}}},{}),p=ul({...f,content:X(B(c,"content",u)),marks:X(B(c,"marks",u)),group:X(B(c,"group",u)),inline:X(B(c,"inline",u)),atom:X(B(c,"atom",u)),selectable:X(B(c,"selectable",u)),draggable:X(B(c,"draggable",u)),code:X(B(c,"code",u)),whitespace:X(B(c,"whitespace",u)),linebreakReplacement:X(B(c,"linebreakReplacement",u)),defining:X(B(c,"defining",u)),isolating:X(B(c,"isolating",u)),attrs:Object.fromEntries(d.map(fl))}),h=X(B(c,"parseHTML",u));h&&(p.parseDOM=h.map(b=>dl(b,d)));const m=B(c,"renderHTML",u);m&&(p.toDOM=b=>m({node:b,HTMLAttributes:lr(b,d)}));const g=B(c,"renderText",u);return g&&(p.toText=g),[c.name,p]})),l=Object.fromEntries(s.map(c=>{const d=r.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=n.reduce((g,b)=>{const E=B(b,"extendMarkSchema",u);return{...g,...E?E(c):{}}},{}),p=ul({...f,inclusive:X(B(c,"inclusive",u)),excludes:X(B(c,"excludes",u)),group:X(B(c,"group",u)),spanning:X(B(c,"spanning",u)),code:X(B(c,"code",u)),attrs:Object.fromEntries(d.map(fl))}),h=X(B(c,"parseHTML",u));h&&(p.parseDOM=h.map(g=>dl(g,d)));const m=B(c,"renderHTML",u);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:lr(g,d)})),[c.name,p]}));return new fc({topNode:o,nodes:a,marks:l})}function Ng(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function qn(n){return n.sort((t,r)=>{const i=B(t,"priority")||100,s=B(r,"priority")||100;return i>s?-1:i<s?1:0})}function Ld(n){const e=qn(Bo(n)),t=Ng(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Pd(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
`,textSerializers:o={}}=t||{};let a="";return n.nodesBetween(r,i,(l,c,d,u)=>{var f;l.isBlock&&c>r&&(a+=s);const p=o==null?void 0:o[l.type.name];if(p)return d&&(a+=p({node:l,pos:c,parent:d,index:u,range:e})),!1;l.isText&&(a+=(f=l==null?void 0:l.text)==null?void 0:f.slice(Math.max(r,c)-c,i-c))}),a}function Cg(n,e){const t={from:0,to:n.content.size};return Pd(n,t,e)}function Bd(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Mg(n,e){const t=me(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 $d(n,e){const t=Ji(typeof e=="string"?e:e.name,n.schema);return t==="node"?Mg(n,e):t==="mark"?Od(n,e):{}}function Ag(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 Og(n){const e=Ag(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 zd(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),d=e.slice(s).map(l),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),Og(r)}function zo(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),o=Po(s,i.type);o&&r.push({mark:i,...o})}):t.nodesBetween(n,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var Rg=(n,e,t,r=20)=>{const i=n.doc.resolve(t);let s=r,o=null;for(;s>0&&o===null;){const a=i.node(s);(a==null?void 0:a.type.name)===e?o=a:s-=1}return[o,s]};function Ln(n,e){return e.nodes[n]||e.marks[n]||null}function Fr(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}var Ig=(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 d=((c=(l=i.type.spec).toText)==null?void 0:c.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-s))}),t};function to(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?kt(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>ii(u.attrs,t,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:u,$to:f})=>{const p=u.pos,h=f.pos;n.doc.nodesBetween(p,h,(m,g)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;const b=Math.max(p,g),E=Math.min(h,g+m.nodeSize),y=E-b;o+=y,a.push(...m.marks.map(w=>({mark:w,from:b,to:E})))})}),o===0)return!1;const l=a.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>ii(u.mark.attrs,t,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=a.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,f)=>u+f.to-f.from,0);return(l>0?l+c:l)>=o}function Dg(n,e,t={}){if(!e)return $t(n,null,t)||to(n,null,t);const r=Ji(e,n.schema);return r==="node"?$t(n,e,t):r==="mark"?to(n,e,t):!1}var Lg=(n,e)=>{const{$from:t,$to:r,$anchor:i}=n.selection;if(e){const s=Yi(a=>a.type.name===e)(n.selection);if(!s)return!1;const o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Pg=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function pl(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function hl(n,e){const{nodeExtensions:t}=Cn(e),r=t.find(o=>o.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=X(B(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function ji(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return!/\S/.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(ji(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Fd(n){return n instanceof $}var Ud=class Hd{constructor(e){this.position=e}static fromJSON(e){return new Hd(e.position)}toJSON(){return{position:this.position}}};function Bg(n,e){const t=e.mapping.mapResult(n.position);return{position:new Ud(t.pos),mapResult:t}}function $g(n){return new Ud(n)}function zg(n,e,t){var r;const{selection:i}=e;let s=null;if(Nd(i)&&(s=i.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(c=>c.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,(d,u,f)=>{if(c)return!1;if(d.isInline){const p=!f||f.type.allowsMarkType(t),h=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=p&&h}return!c}),c})}var Fg=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:a}=s,l=kt(n,r.schema);if(i)if(o){const c=Od(r,l);t.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(f,p)=>{const h=Math.max(p,d),m=Math.min(p+f.nodeSize,u);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&t.addMark(h,m,l.create({...b.attrs,...e}))}):t.addMark(h,m,l.create(e))})});return zg(r,t,l)},Ug=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Hg=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=me(n,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>xa(s,{...o,...e})(t)?!0:a.clearNodes()).command(({state:a})=>xa(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Kg=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Gt(n,0,r.content.size),s=$.create(r,i);e.setSelection(s)}return!0},Vg=(n,e)=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&t.doc.nodesBetween(o,a,(l,c)=>{l.isText||t.setNodeMarkup(c,void 0,{...l.attrs,dir:n})}),!0},Wg=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=U.atStart(r).from,a=U.atEnd(r).to,l=Gt(i,o,a),c=Gt(s,o,a),d=U.create(r,l,c);e.setSelection(d)}return!0},Gg=n=>({state:e,dispatch:t})=>{const r=me(n,e.schema);return $p(r)(e,t)};function ml(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)}}var qg=({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,d=Fr(c,a.node().type.name,a.node().attrs);if(s instanceof $&&s.node.isBlock)return!a.parentOffset||!yt(o,a.pos)?!1:(r&&(n&&ml(t,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:kg(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=u&&f?[{type:f,attrs:d}]:void 0,h=yt(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!h&&yt(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:d}]:void 0),r){if(h&&(s instanceof U&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),f&&!u&&!a.parentOffset&&a.parent.type!==f)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}n&&ml(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},Jg=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;const a=me(n,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const f=s.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=x.empty;const E=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-E;R>=l.depth-3;R-=1)b=x.from(l.node(R).copy(b));const y=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,w={...Fr(f,l.node().type.name,l.node().attrs),...e},T=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(w))||void 0;b=b.append(x.from(a.createAndFill(null,T)||void 0));const M=l.before(l.depth-(E-1));t.replace(M,l.after(-y),new D(b,4-E,0));let A=-1;t.doc.nodesBetween(M,t.doc.content.size,(R,L)=>{if(A>-1)return!1;R.isTextblock&&R.content.size===0&&(A=L+1)}),A>-1&&t.setSelection(U.near(t.doc.resolve(A))),t.scrollIntoView()}return!0}const p=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,h={...Fr(f,u.type.name,u.attrs),...e},m={...Fr(f,l.node().type.name,l.node().attrs),...e};t.delete(l.pos,c.pos);const g=p?[{type:a,attrs:h},{type:p,attrs:m}]:[{type:a,attrs:h}];if(!yt(t.doc,l.pos,2))return!1;if(i){const{selection:b,storedMarks:E}=r,{splittableMarks:y}=s.extensionManager,w=E||b.$to.parentOffset&&b.$from.marks();if(t.split(l.pos,2,g).scrollIntoView(),!w||!i)return!0;const T=w.filter(M=>y.includes(M.type.name));t.ensureMarks(T)}return!0},Ss=(n,e)=>{const t=Yi(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)&&zt(n.doc,t.pos)&&n.join(t.pos),!0},ws=(n,e)=>{const t=Yi(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)&&zt(n.doc,r)&&n.join(r),!0},Yg=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:f}=i.extensionManager,p=me(n,o.schema),h=me(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:E}=m,y=b.blockRange(E),w=g||m.$to.parentOffset&&m.$from.marks();if(!y)return!1;const T=Yi(M=>hl(M.type.name,u))(m);if(y.depth>=1&&T&&y.depth-T.depth<=1){if(T.node.type===p)return c.liftListItem(h);if(hl(T.node.type.name,u)&&p.validContent(T.node.content)&&a)return l().command(()=>(s.setNodeMarkup(T.pos,p),!0)).command(()=>Ss(s,p)).command(()=>ws(s,p)).run()}return!t||!w||!a?l().command(()=>d().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Ss(s,p)).command(()=>ws(s,p)).run():l().command(()=>{const M=d().wrapInList(p,r),A=w.filter(R=>f.includes(R.type.name));return s.ensureMarks(A),M?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Ss(s,p)).command(()=>ws(s,p)).run()},jg=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=kt(n,r.schema);return to(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Zg=(n,e,t={})=>({state:r,commands:i})=>{const s=me(n,r.schema),o=me(e,r.schema),a=$t(r,s,t);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...t})},Xg=(n,e={})=>({state:t,commands:r})=>{const i=me(n,t.schema);return $t(t,i,e)?r.lift(i):r.wrapIn(i,e)},Qg=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const o=n.tr,a=s.transform;for(let l=a.steps.length-1;l>=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},eb=()=>({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},tb=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=t,l=kt(n,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&o){let{from:f,to:p}=a;const h=(s=c.marks().find(g=>g.type===l))==null?void 0:s.attrs,m=Po(c,l,h);m&&(f=m.from,p=m.to),t.removeMark(f,p,l)}else u.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,l)});return t.removeStoredMark(l),!0},nb=n=>({tr:e,state:t,dispatch:r})=>{const{selection:i}=t;let s,o;return typeof n=="number"?(s=n,o=n):n&&"from"in n&&"to"in n?(s=n.from,o=n.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const c={...a.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},rb=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null;const a=Ji(typeof n=="string"?n:n.name,r.schema);if(!a)return!1;a==="node"&&(s=me(n,r.schema)),a==="mark"&&(o=kt(n,r.schema));let l=!1;return t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let f,p,h,m;t.selection.empty?r.doc.nodesBetween(d,u,(g,b)=>{s&&s===g.type&&(l=!0,h=Math.max(b,d),m=Math.min(b+g.nodeSize,u),f=b,p=g)}):r.doc.nodesBetween(d,u,(g,b)=>{b<d&&s&&s===g.type&&(l=!0,h=Math.max(b,d),m=Math.min(b+g.nodeSize,u),f=b,p=g),b>=d&&b<=u&&(s&&s===g.type&&(l=!0,i&&t.setNodeMarkup(b,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(E=>{if(o===E.type&&(l=!0,i)){const y=Math.max(b,d),w=Math.min(b+g.nodeSize,u);t.addMark(y,w,o.create({...E.attrs,...e}))}}))}),p&&(f!==void 0&&i&&t.setNodeMarkup(f,void 0,{...p.attrs,...e}),o&&p.marks.length&&p.marks.forEach(g=>{o===g.type&&i&&t.addMark(h,m,o.create({...g.attrs,...e}))}))}),l},ib=(n,e={})=>({state:t,dispatch:r})=>{const i=me(n,t.schema);return Op(i,e)(t,r)},sb=(n,e={})=>({state:t,dispatch:r})=>{const i=me(n,t.schema);return Rp(i,e)(t,r)},ob=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Zi=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},ab=(n,e)=>{if(Lo(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function Tr(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.marks.find(f=>f.type.spec.code))return!1;let d=!1;const u=Ig(c)+s;return o.forEach(f=>{if(d)return;const p=ab(u,f.find);if(!p)return;const h=l.state.tr,m=Gi({state:l.state,transaction:h}),g={from:r-(p[0].length-s.length),to:i},{commands:b,chain:E,can:y}=new qi({editor:t,state:m});f.handler({state:m,range:g,match:p,commands:b,chain:E,can:y})===null||!h.steps.length||(f.undoable&&h.setMeta(a,{transform:h,from:r,to:i,text:s}),l.dispatch(h),d=!0)}),d}function lb(n){const{editor:e,rules:t}=n,r=new le({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=$o(x.from(d),o.schema);const{from:u}=l,f=u+d.length;Tr({editor:e,from:u,to:f,text:d,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Tr({editor:e,from:s,to:o,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Tr({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?Tr({editor:e,from:o.pos,to:o.pos,text:`
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function cb(n){return Object.prototype.toString.call(n).slice(8,-1)}function xr(n){return cb(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Kd(n,e){const t={...n};return xr(n)&&xr(e)&&Object.keys(e).forEach(r=>{xr(e[r])&&xr(n[r])?t[r]=Kd(n[r],e[r]):t[r]=e[r]}),t}var Fo=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...X(B(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...X(B(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>Kd(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},an=class Vd extends Fo{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Vd(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}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function db(n){return typeof n=="number"}var ub=class{constructor(n){this.find=n.find,this.handler=n.handler}},fb=(n,e,t)=>{if(Lo(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function pb(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=n,{commands:l,chain:c,can:d}=new qi({editor:e,state:t}),u=[];return t.doc.nodesBetween(r,i,(p,h)=>{var m,g,b,E,y;if((g=(m=p.type)==null?void 0:m.spec)!=null&&g.code||!(p.isText||p.isTextblock||p.isInline))return;const w=(y=(E=(b=p.content)==null?void 0:b.size)!=null?E:p.nodeSize)!=null?y:0,T=Math.max(r,h),M=Math.min(i,h+w);if(T>=M)return;const A=p.isText?p.text||"":p.textBetween(T-h,M-h,void 0,"");fb(A,s.find,o).forEach(L=>{if(L.index===void 0)return;const Y=T+L.index+1,ce=Y+L[0].length,ne={from:t.tr.mapping.map(Y),to:t.tr.mapping.map(ce)},se=s.handler({state:t,range:ne,match:L,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:a});u.push(se)})}),u.every(p=>p!==null)}var Nr=null,hb=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function mb(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:d,from:u,to:f,rule:p,pasteEvt:h})=>{const m=d.tr,g=Gi({state:d,transaction:m});if(!(!pb({editor:e,state:g,from:Math.max(u-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new le({view(u){const f=h=>{var m;r=(m=u.dom.parentElement)!=null&&m.contains(h.target)?u.dom.parentElement:null,r&&(Nr=e)},p=()=>{Nr&&(Nr=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(u,f)=>{if(s=r===u.dom.parentElement,a=f,!s){const p=Nr;p!=null&&p.isEditable&&setTimeout(()=>{const h=p.state.selection;h&&p.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,f)=>{var p;const h=(p=f.clipboardData)==null?void 0:p.getData("text/html");return o=f,i=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(u,f,p)=>{const h=u[0],m=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!s,b=h.getMeta("applyPasteRules"),E=!!b;if(!m&&!g&&!E)return;if(E){let{text:T}=b;typeof T=="string"?T=T:T=$o(x.from(T),p.schema);const{from:M}=b,A=M+T.length,R=hb(T);return l({rule:d,state:p,from:M,to:{b:A},pasteEvt:R})}const y=f.doc.content.findDiffStart(p.doc.content),w=f.doc.content.findDiffEnd(p.doc.content);if(!(!db(y)||!w||y===w.b))return l({rule:d,state:p,from:y,to:w,pasteEvt:o})}}))}var Xi=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Ld(n),this.schema=xg(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ln(e.name,this.schema)},r=B(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return qn([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Ln(r.name,this.schema)},s=[],o=B(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&B(r,"exitable",i)&&(a.ArrowRight=()=>an.handleExit({editor:n,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([p,h])=>[p,()=>h({editor:n})]));a={...a,...f}}const l=Cm(a);s.push(l);const c=B(r,"addInputRules",i);if(pl(r,n.options.enableInputRules)&&c){const f=c();if(f&&f.length){const p=lb({editor:n,rules:f}),h=Array.isArray(p)?p:[p];s.push(...h)}}const d=B(r,"addPasteRules",i);if(pl(r,n.options.enablePasteRules)&&d){const f=d();if(f&&f.length){const p=mb({editor:n,rules:f});s.push(...p)}}const u=B(r,"addProseMirrorPlugins",i);if(u){const f=u();s.push(...f)}return s})}get attributes(){return Dd(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Cn(this.extensions);return Object.fromEntries(e.filter(t=>!!B(t,"addNodeView")).map(t=>{const r=this.attributes.filter(l=>l.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:me(t.name,this.schema)},s=B(t,"addNodeView",i);if(!s)return[];const o=s();if(!o)return[];const a=(l,c,d,u,f)=>{const p=lr(l,r);return o({node:l,view:c,getPos:d,decorations:u,innerDecorations:f,editor:n,extension:t,HTMLAttributes:p})};return[t.name,a]}))}dispatchTransaction(n){const{editor:e}=this;return qn([...this.extensions].reverse()).reduceRight((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Ln(i.name,this.schema)},o=B(i,"dispatchTransaction",s);return o?a=>{o.call(s,{transaction:a,next:r})}:r},n)}transformPastedHTML(n){const{editor:e}=this;return qn([...this.extensions]).reduce((r,i)=>{const s={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Ln(i.name,this.schema)},o=B(i,"transformPastedHTML",s);return o?(a,l)=>{const c=r(a,l);return o.call(s,c)}:r},n||(r=>r))}get markViews(){const{editor:n}=this,{markExtensions:e}=Cn(this.extensions);return Object.fromEntries(e.filter(t=>!!B(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:kt(t.name,this.schema)},s=B(t,"addMarkView",i);if(!s)return[];const o=(a,l,c)=>{const d=lr(a,r);return s()({mark:a,view:l,inline:c,editor:n,extension:t,HTMLAttributes:d,updateAttributes:u=>{Mb(a,n,u)}})};return[t.name,o]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Ln(e.name,this.schema)};e.type==="mark"&&((t=X(B(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const i=B(e,"onBeforeCreate",r),s=B(e,"onCreate",r),o=B(e,"onUpdate",r),a=B(e,"onSelectionUpdate",r),l=B(e,"onTransaction",r),c=B(e,"onFocus",r),d=B(e,"onBlur",r),u=B(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}};Xi.resolve=Ld;Xi.sort=qn;Xi.flatten=Bo;var gb={};Do(gb,{ClipboardTextSerializer:()=>Gd,Commands:()=>qd,Delete:()=>Jd,Drop:()=>Yd,Editable:()=>jd,FocusEvents:()=>Xd,Keymap:()=>Qd,Paste:()=>eu,Tabindex:()=>tu,TextDirection:()=>nu,focusEventsPluginKey:()=>Zd});var fe=class Wd extends Fo{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Wd(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Gd=fe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new le({key:new be("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(d=>d.$from.pos)),a=Math.max(...s.map(d=>d.$to.pos)),l=Bd(t);return Pd(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),qd=fe.create({name:"commands",addCommands(){return{...Td}}}),Jd=fe.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,i;const s=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,n))!=null?c:n.getMeta("y-sync$"))return;const d=Rd(n.before,[n,...e]);zd(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{const g=m+h.nodeSize-2,b=p.oldRange.from<=m&&g<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:p.oldRange,newRange:p.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((p,h)=>{var m,g;if(p instanceof nt){const b=f.slice(h).map(p.from,-1),E=f.slice(h).map(p.to),y=f.invert().map(b,-1),w=f.invert().map(E),T=(m=d.doc.nodeAt(b-1))==null?void 0:m.marks.some(A=>A.eq(p.mark)),M=(g=d.doc.nodeAt(E))==null?void 0:g.marks.some(A=>A.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:y,to:w},newRange:{from:b,to:E},partial:!!(M||T),editor:this.editor,transaction:n,combinedTransform:d})}})};(i=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||i?setTimeout(s,0):s()}}),Yd=fe.create({name:"drop",addProseMirrorPlugins(){return[new le({key:new be("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),jd=fe.create({name:"editable",addProseMirrorPlugins(){return[new le({key:new be("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Zd=new be("focusEvents"),Xd=fe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new le({key:Zd,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}}}})]}}),Qd=fe.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:d,$anchor:u}=l,{pos:f,parent:p}=u,h=u.parent.isTextblock&&f>0?a.doc.resolve(f-1):u,m=h.parent.type.spec.isolating,g=u.pos-u.parentOffset,b=m&&h.parent.childCount===1?g===u.pos:V.atStart(c).from===f;return!d||!p.type.isTextblock||p.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>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 si()||Ad()?s:i},addProseMirrorPlugins(){return[new le({key:new be("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(m=>m.getMeta("composition")))return;const r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=V.atStart(e.doc).from,c=V.atEnd(e.doc).to;if(s||!(o===l&&a===c)||!ji(t.doc))return;const f=t.tr,p=Gi({state:t,transaction:f}),{commands:h}=new qi({editor:this.editor,state:p});if(h.clearNodes(),!!f.steps.length)return f}})]}}),eu=fe.create({name:"paste",addProseMirrorPlugins(){return[new le({key:new be("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),tu=fe.create({name:"tabindex",addProseMirrorPlugins(){return[new le({key:new be("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),nu=fe.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Cn(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new le({key:new be("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),bb=class Un{constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You cant set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Un(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Un(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Un(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=t.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;const c=new Un(l,this.editor,i,i||o?t:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==t[l])break}}else r=i;i=i.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(t);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(l=>t[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},yb=`.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: 0 !important;
height: 0 !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -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;
}`;function Eb(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var kb=class extends ob{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Bg,createMappablePosition:$g},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:i,slice:s,moved:o})=>this.options.onDrop(i,s,o)),this.on("paste",({event:i,slice:s})=>this.options.onPaste(i,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=Cd(t,this.options.autofocus);this.editorState=_n.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Eb(yb,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=Id(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(a=>!a.key.startsWith(o))}),t.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[jd,Gd.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),qd,Xd,Qd,tu,Yd,eu,Jd,nu.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new Xi(i,this)}createCommandManager(){this.commandManager=new qi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Qs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Qs(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:r}=this.options,i=t.dispatchTransaction||this.dispatchTransaction.bind(this),s=r?this.extensionManager.dispatchTransaction(i):i,o=t.transformPastedHTML,a=this.extensionManager.transformPastedHTML(o);this.editorView=new Sd(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:s,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();const c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(d)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),i=!this.state.selection.eq(t.selection),s=r.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),l=a==null?void 0:a.getMeta("focus"),c=a==null?void 0:a.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:a}),c&&this.emit("blur",{editor:this,event:c.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(d=>d.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return $d(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Dg(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $o(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
`,textSerializers:r={}}=e||{};return Cg(this.state.doc,{blockSeparator:t,textSerializers:{...Bd(this.schema),...r}})}get isEmpty(){return ji(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new bb(t,this)}get $doc(){return this.$pos(0)}};function Mn(n){return new Zi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=X(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=t.from+a.indexOf(o),d=c+o.length;if(zo(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===n.type&&m!==p.mark.type)).filter(p=>p.to>c).length)return null;d<t.to&&s.delete(d,t.to),c>t.from&&s.delete(t.from+l,c);const f=t.from+l+o.length;s.addMark(t.from+l,f,n.type.create(i||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function _b(n){return new Zi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=X(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let a=t.to;const l=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let d=o+c;d>a?d=a:a=d+r[1].length;const u=r[0][r[0].length-1];s.insertText(u,o+r[0].length-1),s.replaceWith(d,a,l)}else if(r[0]){const c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function no(n){return new Zi({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=X(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)},undoable:n.undoable})}function An(n){return new Zi({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=X(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),l=o.doc.resolve(t.from).blockRange(),c=l&&yo(l,n.type,s);if(!c)return null;if(o.wrap(l,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,h=f||u.$to.parentOffset&&u.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&zt(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&o.join(t.from-1)},undoable:n.undoable})}function vb(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof $){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}var Sb={};Do(Sb,{createAtomBlockMarkdownSpec:()=>wb,createBlockMarkdownSpec:()=>Tb,createInlineMarkdownSpec:()=>Cb,parseAttributes:()=>Uo,parseIndentedBlocks:()=>ro,renderNestedMarkdownContent:()=>Ko,serializeAttributes:()=>Ho});function Uo(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(d=>d.trim().slice(1));e.class=c.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,d])=>{var u;const f=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),p=t[f];p&&(e[c]=p.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Ho(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function wb(n){const{nodeName:e,name:t,parseAttributes:r=Uo,serializeAttributes:i=Ho,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:a}=n,l=t||e,c=d=>{if(!a)return d;const u={};return a.forEach(f=>{f in d&&(u[f]=d[f])}),u};return{parseMarkdown:(d,u)=>{const f={...s,...d.attributes};return u.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(d){var u;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),p=(u=d.match(f))==null?void 0:u.index;return p!==void 0?p:-1},tokenize(d,u,f){const p=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),h=d.match(p);if(!h)return;const m=h[1]||"",g=r(m);if(!o.find(E=>!(E in g)))return{type:e,raw:h[0],attributes:g}}},renderMarkdown:d=>{const u=c(d.attrs||{}),f=i(u),p=f?` {${f}}`:"";return`:::${l}${p} :::`}}}function Tb(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=Uo,serializeAttributes:s=Ho,defaultAttributes:o={},content:a="block",allowedAttributes:l}=n,c=t||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{let p;if(r){const m=r(u);p=typeof m=="string"?[{type:"text",text:m}]:m}else a==="block"?p=f.parseChildren(u.tokens||[]):p=f.parseInline(u.tokens||[]);const h={...o,...u.attributes};return f.createNode(e,h,p)},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){var h;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(m);if(!g)return;const[b,E=""]=g,y=i(E);let w=1;const T=b.length;let M="";const A=/^:::([\w-]*)(\s.*)?/gm,R=u.slice(T);for(A.lastIndex=0;;){const L=A.exec(R);if(L===null)break;const Y=L.index,ce=L[1];if(!((h=L[2])!=null&&h.endsWith(":::"))){if(ce)w+=1;else if(w-=1,w===0){const ne=R.slice(0,Y);M=ne.trim();const se=u.slice(0,T+Y+L[0].length);let q=[];if(M)if(a==="block")for(q=p.blockTokens(ne),q.forEach(W=>{W.text&&(!W.tokens||W.tokens.length===0)&&(W.tokens=p.inlineTokens(W.text))});q.length>0;){const W=q[q.length-1];if(W.type==="paragraph"&&(!W.text||W.text.trim()===""))q.pop();else break}else q=p.inlineTokens(M);return{type:e,raw:se,attributes:y,content:M,tokens:q}}}}}},renderMarkdown:(u,f)=>{const p=d(u.attrs||{}),h=s(p),m=h?` {${h}}`:"",g=f.renderChildren(u.content||[],`
`);return`:::${c}${m}
${g}
:::`}}}function xb(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,i,s,o]=r;e[i]=s||o,r=t.exec(n)}return e}function Nb(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Cb(n){const{nodeName:e,name:t,getContent:r,parseAttributes:i=xb,serializeAttributes:s=Nb,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=n,c=t||e,d=f=>{if(!l)return f;const p={};return l.forEach(h=>{const m=typeof h=="string"?h:h.name,g=typeof h=="string"?void 0:h.skipIfDefault;if(m in f){const b=f[m];if(g!==void 0&&b===g)return;p[m]=b}}),p},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const h={...o,...f.attributes};if(a)return p.createNode(e,h);const m=r?r(f):f.content||"";return m?p.createNode(e,h,[p.createTextNode(m)]):p.createNode(e,h,[])},markdownTokenizer:{name:e,level:"inline",start(f){const p=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),h=f.match(p),m=h==null?void 0:h.index;return m!==void 0?m:-1},tokenize(f,p,h){const m=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=f.match(m);if(!g)return;let b="",E="";if(a){const[,w]=g;E=w}else{const[,w,T]=g;E=w,b=T||""}const y=i(E.trim());return{type:e,raw:g[0],content:b.trim(),attributes:y}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const h=d(f.attrs||{}),m=s(h),g=m?` ${m}`:"";return a?`[${c}${g}]`:`[${c}${g}]${p}[/${c}]`}}}function ro(n,e,t){var r,i,s,o;const a=n.split(`
`),l=[];let c="",d=0;const u=e.baseIndentSize||2;for(;d<a.length;){const f=a[d],p=f.match(e.itemPattern);if(!p){if(l.length>0)break;if(f.trim()===""){d+=1,c=`${c}${f}
`;continue}else return}const h=e.extractItemData(p),{indentLevel:m,mainContent:g}=h;c=`${c}${f}
`;const b=[g];for(d+=1;d<a.length;){const T=a[d];if(T.trim()===""){const A=a.slice(d+1).findIndex(Y=>Y.trim()!=="");if(A===-1)break;if((((i=(r=a[d+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>m){b.push(T),c=`${c}${T}
`,d+=1;continue}else break}if((((o=(s=T.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)b.push(T),c=`${c}${T}
`,d+=1;else break}let E;const y=b.slice(1);if(y.length>0){const T=y.map(M=>M.slice(m+u)).join(`
`);T.trim()&&(e.customNestedParser?E=e.customNestedParser(T):E=t.blockTokens(T))}const w=e.createToken(h,E);l.push(w)}if(l.length!==0)return{items:l,raw:c}}function Ko(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const i=typeof t=="function"?t(r):t,[s,...o]=n.content,a=e.renderChildren([s]);let l=`${i}${a}`;return o&&o.length>0&&o.forEach((c,d)=>{var u,f;const p=(f=(u=e.renderChild)==null?void 0:u.call(e,c,d+1))!=null?f:e.renderChildren([c]);if(p!=null){const h=p.split(`
`).map(m=>m?e.indent(m):e.indent("")).join(`
`);l+=c.type==="paragraph"?`
${h}`:`
${h}`}}),l}function Mb(n,e,t={}){const{state:r}=e,{doc:i,tr:s}=r,o=n;i.descendants((a,l)=>{const c=s.mapping.map(l),d=s.mapping.map(l)+a.nodeSize;let u=null;if(a.marks.forEach(p=>{if(p!==o)return!1;u=p}),!u)return;let f=!1;if(Object.keys(t).forEach(p=>{t[p]!==u.attrs[p]&&(f=!0)}),f){const p=n.type.create({...n.attrs,...t});s.removeMark(c,d,n.type),s.addMark(c,d,p)}}),s.docChanged&&e.view.dispatch(s)}var We=class ru extends Fo{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new ru(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function sn(n){return new ub({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=X(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=t.to;if(a){const d=l.search(/\S/),u=t.from+l.indexOf(a),f=u+a.length;if(zo(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;f<t.to&&o.delete(f,t.to),u>t.from&&o.delete(t.from+d,u),c=t.from+d+a.length,o.addMark(t.from+d,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function gl(n){return pf((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var Ab=class extends kb{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=gl(this.view.state),this.reactiveExtensionStorage=gl(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),uf(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},Ob=$i({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=ye(),t=mf();return df(()=>{const r=n.editor;r&&r.options.element&&e.value&&hf(()=>{var i;if(!e.value||!((i=r.view.dom)!=null&&i.parentNode))return;const s=j(e.value);e.value.append(...r.view.dom.parentNode.childNodes),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),mo(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return cf("div",{ref:n=>{this.rootEl=n}})}}),Rb=(n={})=>{const e=ff();return Yl(()=>{e.value=new Ab(n)}),mo(()=>{var t,r,i,s;const o=(r=(t=e.value)==null?void 0:t.view.dom)==null?void 0:r.parentNode,a=o==null?void 0:o.cloneNode(!0);(i=o==null?void 0:o.parentNode)==null||i.replaceChild(a,o),(s=e.value)==null||s.destroy()}),e},oi=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},Ib=/^\s*>\s$/,Db=We.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return oi("blockquote",{...ge(this.options.HTMLAttributes,n),children:oi("slot",{})})},parseMarkdown:(n,e)=>{var t;const r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;return e.createNode("blockquote",void 0,r(n.tokens||[]))},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",r=[];return n.content.forEach((i,s)=>{var o,a;const d=((a=(o=e.renderChild)==null?void 0:o.call(e,i,s))!=null?a:e.renderChildren([i])).split(`
`).map(u=>u.trim()===""?t:`${t} ${u}`);r.push(d.join(`
`))}),r.join(`
${t}
`)},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[An({find:Ib,type:this.type})]}}),Lb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Pb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Bb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,$b=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,zb=an.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return oi("strong",{...ge(this.options.HTMLAttributes,n),children:oi("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,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[Mn({find:Lb,type:this.type}),Mn({find:Bb,type:this.type})]},addPasteRules(){return[sn({find:Pb,type:this.type}),sn({find:$b,type:this.type})]}}),Fb=/(^|[^`])`([^`]+)`(?!`)$/,Ub=/(^|[^`])`([^`]+)`(?!`)/g,Hb=an.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",ge(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",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[Mn({find:Fb,type:this.type})]},addPasteRules(){return[sn({find:Ub,type:this.type})]}}),Ts=4,Kb=/^```([a-z]+)?[\s\n]$/,Vb=/^~~~([a-z]+)?[\s\n]$/,iu=We.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Ts,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const s=[...((e=n.firstElementChild)==null?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",ge(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t,r;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&((r=n.raw)==null?void 0:r.startsWith("~~~"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let r="";const i=((t=n.attrs)==null?void 0:t.language)||"";return n.content?r=[`\`\`\`${i}`,e.renderChildren(n.content),"```"].join(`
`):r=`\`\`\`${i}
\`\`\``,r},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},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Ts,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;if(s.parent.type!==this.type)return!1;const a=" ".repeat(t);return o?n.commands.insertContent(a):n.commands.command(({tr:l})=>{const{from:c,to:d}=i,p=r.doc.textBetween(c,d,`
`,`
`).split(`
`).map(h=>a+h).join(`
`);return l.replaceWith(c,d,r.schema.text(p)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Ts,{state:r}=n,{selection:i}=r,{$from:s,empty:o}=i;return s.parent.type!==this.type?!1:o?n.commands.command(({tr:a})=>{var l;const{pos:c}=s,d=s.start(),u=s.end(),p=r.doc.textBetween(d,u,`
`,`
`).split(`
`);let h=0,m=0;const g=c-d;for(let M=0;M<p.length;M+=1){if(m+p[M].length>=g){h=M;break}m+=p[M].length+1}const E=((l=p[h].match(/^ */))==null?void 0:l[0])||"",y=Math.min(E.length,t);if(y===0)return!0;let w=d;for(let M=0;M<h;M+=1)w+=p[M].length+1;return a.delete(w,w+y),c-w<=y&&a.setSelection(U.create(a.doc,w)),!0}):n.commands.command(({tr:a})=>{const{from:l,to:c}=i,f=r.doc.textBetween(l,c,`
`,`
`).split(`
`).map(p=>{var h;const m=((h=p.match(/^ */))==null?void 0:h[0])||"",g=Math.min(m.length,t);return p.slice(g)}).join(`
`);return a.replaceWith(l,c,r.schema.text(f)),!0})},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?!1:r.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(V.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[no({find:Kb,type:this.type,getAttributes:n=>({language:n[1]})}),no({find:Vb,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new le({key:new be("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,schema:a}=n.state,l=a.text(t.replace(/\r\n?/g,`
`));return o.replaceSelectionWith(this.type.create({language:s},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(U.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),Wb=We.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
`):""}),Gb=We.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",ge(this.options.HTMLAttributes,n)]},renderText(){return`
`},renderMarkdown:()=>`
`,parseMarkdown:()=>({type:"hardBreak"}),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:d})=>{if(d&&l&&o){const u=l.filter(f=>a.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),qb=We.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]}`,ge(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,i="#".repeat(r);return n.content?`${i} ${e.renderChildren(n.content)}`:""},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=>no({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Jb=We.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",ge(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!vb(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,i=n();return Fd(t)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:s,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(U.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection($.create(o.doc,l.pos)):o.setSelection(U.create(o.doc,l.pos));else{const d=s.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,u=d==null?void 0:d.create();u&&(o.insert(c,u),o.setSelection(U.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_b({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Yb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,jb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Zb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Xb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Qb=an.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",ge(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)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Mn({find:Yb,type:this.type}),Mn({find:Zb,type:this.type})]},addPasteRules(){return[sn({find:jb,type:this.type}),sn({find:Xb,type:this.type})]}});const ey="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ty="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3украз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراهاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരത5ලකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",io="numeric",so="ascii",oo="alpha",Jn="asciinumeric",Hn="alphanumeric",ao="domain",su="emoji",ny="scheme",ry="slashscheme",xs="whitespace";function iy(n,e){return n in e||(e[n]=[]),e[n]}function qt(n,e,t){e[io]&&(e[Jn]=!0,e[Hn]=!0),e[so]&&(e[Jn]=!0,e[oo]=!0),e[Jn]&&(e[Hn]=!0),e[oo]&&(e[Hn]=!0),e[Hn]&&(e[ao]=!0),e[su]&&(e[ao]=!0);for(const r in e){const i=iy(r,t);i.indexOf(n)<0&&i.push(n)}}function sy(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function ze(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}ze.groups={};ze.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||ze.groups;let i;return e&&e.j?i=e:(i=new ze(e),t&&r&&qt(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(n[o]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||ze.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let o,a=i.go(n);if(a?(o=new ze,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new ze,s){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(sy(o.t,r),t);qt(s,l,r)}else t&&qt(s,t,r);o.t=s}return i.j[n]=o,o}};const K=(n,e,t,r,i)=>n.ta(e,t,r,i),de=(n,e,t,r,i)=>n.tr(e,t,r,i),bl=(n,e,t,r,i)=>n.ts(e,t,r,i),C=(n,e,t,r,i)=>n.tt(e,t,r,i),ht="WORD",lo="UWORD",ou="ASCIINUMERICAL",au="ALPHANUMERICAL",cr="LOCALHOST",co="TLD",uo="UTLD",Ur="SCHEME",gn="SLASH_SCHEME",Vo="NUM",fo="WS",Wo="NL",Yn="OPENBRACE",jn="CLOSEBRACE",ai="OPENBRACKET",li="CLOSEBRACKET",ci="OPENPAREN",di="CLOSEPAREN",ui="OPENANGLEBRACKET",fi="CLOSEANGLEBRACKET",pi="FULLWIDTHLEFTPAREN",hi="FULLWIDTHRIGHTPAREN",mi="LEFTCORNERBRACKET",gi="RIGHTCORNERBRACKET",bi="LEFTWHITECORNERBRACKET",yi="RIGHTWHITECORNERBRACKET",Ei="FULLWIDTHLESSTHAN",ki="FULLWIDTHGREATERTHAN",_i="AMPERSAND",vi="APOSTROPHE",Si="ASTERISK",Tt="AT",wi="BACKSLASH",Ti="BACKTICK",xi="CARET",Ct="COLON",Go="COMMA",Ni="DOLLAR",st="DOT",Ci="EQUALS",qo="EXCLAMATION",Ye="HYPHEN",Zn="PERCENT",Mi="PIPE",Ai="PLUS",Oi="POUND",Xn="QUERY",Jo="QUOTE",lu="FULLWIDTHMIDDLEDOT",Yo="SEMI",ot="SLASH",Qn="TILDE",Ri="UNDERSCORE",cu="EMOJI",Ii="SYM";var du=Object.freeze({__proto__:null,ALPHANUMERICAL:au,AMPERSAND:_i,APOSTROPHE:vi,ASCIINUMERICAL:ou,ASTERISK:Si,AT:Tt,BACKSLASH:wi,BACKTICK:Ti,CARET:xi,CLOSEANGLEBRACKET:fi,CLOSEBRACE:jn,CLOSEBRACKET:li,CLOSEPAREN:di,COLON:Ct,COMMA:Go,DOLLAR:Ni,DOT:st,EMOJI:cu,EQUALS:Ci,EXCLAMATION:qo,FULLWIDTHGREATERTHAN:ki,FULLWIDTHLEFTPAREN:pi,FULLWIDTHLESSTHAN:Ei,FULLWIDTHMIDDLEDOT:lu,FULLWIDTHRIGHTPAREN:hi,HYPHEN:Ye,LEFTCORNERBRACKET:mi,LEFTWHITECORNERBRACKET:bi,LOCALHOST:cr,NL:Wo,NUM:Vo,OPENANGLEBRACKET:ui,OPENBRACE:Yn,OPENBRACKET:ai,OPENPAREN:ci,PERCENT:Zn,PIPE:Mi,PLUS:Ai,POUND:Oi,QUERY:Xn,QUOTE:Jo,RIGHTCORNERBRACKET:gi,RIGHTWHITECORNERBRACKET:yi,SCHEME:Ur,SEMI:Yo,SLASH:ot,SLASH_SCHEME:gn,SYM:Ii,TILDE:Qn,TLD:co,UNDERSCORE:Ri,UTLD:uo,UWORD:lo,WORD:ht,WS:fo});const ft=/[a-z]/,Pn=new RegExp("\\p{L}","u"),Ns=new RegExp("\\p{Emoji}","u"),pt=/\d/,Cs=/\s/,yl="\r",Ms=`
`,oy="",ay="",As="";let Cr=null,Mr=null;function ly(n=[]){const e={};ze.groups=e;const t=new ze;Cr==null&&(Cr=El(ey)),Mr==null&&(Mr=El(ty)),C(t,"'",vi),C(t,"{",Yn),C(t,"}",jn),C(t,"[",ai),C(t,"]",li),C(t,"(",ci),C(t,")",di),C(t,"<",ui),C(t,">",fi),C(t,"",pi),C(t,"",hi),C(t,"「",mi),C(t,"」",gi),C(t,"『",bi),C(t,"』",yi),C(t,"",Ei),C(t,"",ki),C(t,"&",_i),C(t,"*",Si),C(t,"@",Tt),C(t,"`",Ti),C(t,"^",xi),C(t,":",Ct),C(t,",",Go),C(t,"$",Ni),C(t,".",st),C(t,"=",Ci),C(t,"!",qo),C(t,"-",Ye),C(t,"%",Zn),C(t,"|",Mi),C(t,"+",Ai),C(t,"#",Oi),C(t,"?",Xn),C(t,'"',Jo),C(t,"/",ot),C(t,";",Yo),C(t,"~",Qn),C(t,"_",Ri),C(t,"\\",wi),C(t,"・",lu);const r=de(t,pt,Vo,{[io]:!0});de(r,pt,r);const i=de(r,ft,ou,{[Jn]:!0}),s=de(r,Pn,au,{[Hn]:!0}),o=de(t,ft,ht,{[so]:!0});de(o,pt,i),de(o,ft,o),de(i,pt,i),de(i,ft,i);const a=de(t,Pn,lo,{[oo]:!0});de(a,ft),de(a,pt,s),de(a,Pn,a),de(s,pt,s),de(s,ft),de(s,Pn,s);const l=C(t,Ms,Wo,{[xs]:!0}),c=C(t,yl,fo,{[xs]:!0}),d=de(t,Cs,fo,{[xs]:!0});C(t,As,d),C(c,Ms,l),C(c,As,d),de(c,Cs,d),C(d,yl),C(d,Ms),de(d,Cs,d),C(d,As,d);const u=de(t,Ns,cu,{[su]:!0});C(u,"#"),de(u,Ns,u),C(u,oy,u);const f=C(u,ay);C(f,"#"),de(f,Ns,u);const p=[[ft,o],[pt,i]],h=[[ft,null],[Pn,a],[pt,s]];for(let m=0;m<Cr.length;m++)vt(t,Cr[m],co,ht,p);for(let m=0;m<Mr.length;m++)vt(t,Mr[m],uo,lo,h);qt(co,{tld:!0,ascii:!0},e),qt(uo,{utld:!0,alpha:!0},e),vt(t,"file",Ur,ht,p),vt(t,"mailto",Ur,ht,p),vt(t,"http",gn,ht,p),vt(t,"https",gn,ht,p),vt(t,"ftp",gn,ht,p),vt(t,"ftps",gn,ht,p),qt(Ur,{scheme:!0,ascii:!0},e),qt(gn,{slashscheme:!0,ascii:!0},e),n=n.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<n.length;m++){const g=n[m][0],E=n[m][1]?{[ny]:!0}:{[ry]:!0};g.indexOf("-")>=0?E[ao]=!0:ft.test(g)?pt.test(g)?E[Jn]=!0:E[so]=!0:E[io]=!0,bl(t,g,g,E)}return bl(t,"localhost",cr,{ascii:!0}),t.jd=new ze(Ii),{start:t,tokens:Object.assign({groups:e},du)}}function uu(n,e){const t=cy(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let a=n,l=null,c=0,d=null,u=-1,f=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(u=0,f=0,d=a):u>=0&&(u+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=f,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function cy(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function vt(n,e,t,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?s=n.j[l]:(s=new ze(r),s.jr=i.slice(),n.j[l]=s),n=s}return s=new ze(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function El(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const dr={defaultProtocol:"http",events:null,format:kl,formatHref:kl,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function jo(n,e=null){let t=Object.assign({},dr);n&&(t=Object.assign(t,n instanceof jo?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}jo.prototype={o:dr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:dr[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function kl(n){return n}function fu(n,e){this.t="token",this.v=n,this.tk=e}fu.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=dr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function Qi(n,e){class t extends fu{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const _l=Qi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),vl=Qi("text"),dy=Qi("nl"),Ar=Qi("url",{isLink:!0,toHref(n=dr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==cr&&n[1].t===Ct}}),Je=n=>new ze(n);function uy({groups:n}){const e=n.domain.concat([_i,Si,Tt,wi,Ti,xi,Ni,Ci,Ye,Vo,Zn,Mi,Ai,Oi,ot,Ii,Qn,Ri]),t=[vi,Ct,Go,st,qo,Zn,Xn,Jo,Yo,ui,fi,Yn,jn,li,ai,ci,di,pi,hi,mi,gi,bi,yi,Ei,ki],r=[_i,vi,Si,wi,Ti,xi,Ni,Ci,Ye,Yn,jn,Zn,Mi,Ai,Oi,Xn,ot,Ii,Qn,Ri],i=Je(),s=C(i,Qn);K(s,r,s),K(s,n.domain,s);const o=Je(),a=Je(),l=Je();K(i,n.domain,o),K(i,n.scheme,a),K(i,n.slashscheme,l),K(o,r,s),K(o,n.domain,o);const c=C(o,Tt);C(s,Tt,c),C(a,Tt,c),C(l,Tt,c);const d=C(s,st);K(d,r,s),K(d,n.domain,s);const u=Je();K(c,n.domain,u),K(u,n.domain,u);const f=C(u,st);K(f,n.domain,u);const p=Je(_l);K(f,n.tld,p),K(f,n.utld,p),C(c,cr,p);const h=C(u,Ye);C(h,Ye,h),K(h,n.domain,u),K(p,n.domain,u),C(p,st,f),C(p,Ye,h);const m=C(p,Ct);K(m,n.numeric,_l);const g=C(o,Ye),b=C(o,st);C(g,Ye,g),K(g,n.domain,o),K(b,r,s),K(b,n.domain,o);const E=Je(Ar);K(b,n.tld,E),K(b,n.utld,E),K(E,n.domain,o),K(E,r,s),C(E,st,b),C(E,Ye,g),C(E,Tt,c);const y=C(E,Ct),w=Je(Ar);K(y,n.numeric,w);const T=Je(Ar),M=Je();K(T,e,T),K(T,t,M),K(M,e,T),K(M,t,M),C(E,ot,T),C(w,ot,T);const A=C(a,Ct),R=C(l,Ct),L=C(R,ot),Y=C(L,ot);K(a,n.domain,o),C(a,st,b),C(a,Ye,g),K(l,n.domain,o),C(l,st,b),C(l,Ye,g),K(A,n.domain,T),C(A,ot,T),C(A,Xn,T),K(Y,n.domain,T),K(Y,e,T),C(Y,ot,T);const ce=[[Yn,jn],[ai,li],[ci,di],[ui,fi],[pi,hi],[mi,gi],[bi,yi],[Ei,ki]];for(let ne=0;ne<ce.length;ne++){const[se,q]=ce[ne],W=C(T,se);C(M,se,W),C(W,q,T);const k=Je(Ar);K(W,e,k);const O=Je();K(W,t),K(k,e,k),K(k,t,O),K(O,e,k),K(O,t,O),C(k,q,T),C(O,q,T)}return C(i,cr,E),C(i,Wo,dy),{start:i,tokens:du}}function fy(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let a=n,l=null,c=null,d=0,u=null,f=-1;for(;i<r&&!(l=a.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=l||a.go(t[i].t));)l=null,a=c,a.accepts()?(f=0,u=a):f>=0&&f++,i++,d++;if(f<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Os(vl,e,o)),o=[]),i-=f,d-=f;const p=u.t,h=t.slice(i-d,i);s.push(Os(p,e,h))}}return o.length>0&&s.push(Os(vl,e,o)),s}function Os(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const py=typeof console<"u"&&console&&console.warn||(()=>{}),hy="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ie={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function my(){return ze.groups={},ie.scanner=null,ie.parser=null,ie.tokenQueue=[],ie.pluginQueue=[],ie.customSchemes=[],ie.initialized=!1,ie}function Sl(n,e=!1){if(ie.initialized&&py(`linkifyjs: already initialized - will not register custom scheme "${n}" ${hy}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);ie.customSchemes.push([n,e])}function gy(){ie.scanner=ly(ie.customSchemes);for(let n=0;n<ie.tokenQueue.length;n++)ie.tokenQueue[n][1]({scanner:ie.scanner});ie.parser=uy(ie.scanner.tokens);for(let n=0;n<ie.pluginQueue.length;n++)ie.pluginQueue[n][1]({scanner:ie.scanner,parser:ie.parser});return ie.initialized=!0,ie}function Zo(n){return ie.initialized||gy(),fy(ie.parser.start,n,uu(ie.scanner.start,n))}Zo.scan=uu;function pu(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new jo(t),i=Zo(n),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Xo="[\0-   -\u2029 ]",by=new RegExp(Xo),yy=new RegExp(`${Xo}$`),Ey=new RegExp(Xo,"g");function ky(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function _y(n){return new le({key:new be("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=Rd(t.doc,[...e]);if(zd(a).forEach(({newRange:c})=>{const d=_g(r.doc,c,p=>p.isTextblock);let u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!yy.test(p))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&f){const p=f.split(by).filter(Boolean);if(p.length<=0)return!1;const h=p[p.length-1],m=u.pos+f.lastIndexOf(h);if(!h)return!1;const g=Zo(h).map(b=>b.toObject(n.defaultProtocol));if(!ky(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{zo(b.from,b.to,r.doc).some(E=>E.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function vy(n){return new le({key:new be("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const l=r.target;if(!l)return!1;const c=n.editor.view.dom;o=l.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let a=!1;if(n.enableClickSelection&&(a=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const l=$d(e.state,n.type.name),c=(i=o.href)!=null?i:l.href,d=(s=o.target)!=null?s:l.target;c&&(window.open(c,d),a=!0)}return a}}})}function Sy(n){return new le({key:new be("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:i}=n,{state:s}=e,{selection:o}=s,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(d=>{l+=d.textContent});const c=pu(l,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||i!==void 0&&!i(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function Ht(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(Ey,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var wy=an.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Sl(n);return}Sl(n.scheme,n.optionalSlashes)})},onDestroy(){my()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Ht(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const i=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Ht(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Ht(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ge(this.options.HTMLAttributes,n),0]:["a",ge(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,i,s;const o=(r=(t=n.attrs)==null?void 0:t.href)!=null?r:"",a=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"",l=e.renderChildren(n);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Ht(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Ht(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1: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[sn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=pu(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Ht(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>{this.options.shouldAutoLink(s.value)&&e.push({text:s.value,data:{href:s.href},index:s.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(_y({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Ht(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(vy({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Sy({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Ty=Object.defineProperty,xy=(n,e)=>{for(var t in e)Ty(n,t,{get:e[t],enumerable:!0})},Ny="listItem",wl="textStyle",Tl=/^\s*([-+*])\s$/,hu=We.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ge(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ny,this.editor.getAttributes(wl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=An({find:Tl,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=An({find:Tl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(wl),editor:this.editor})),[n]}}),mu=We.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ge(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;let i=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(o=>o.type==="paragraph"))i=r(n.tokens);else{const o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const l=n.tokens.slice(1),c=r(l);i.push(...c)}}else i=r(n.tokens)}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(n,e,t)=>Ko(n,e,r=>{var i,s;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((s=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:s.start)||1)+r.index}. `:"- "},t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Cy={};xy(Cy,{findListItemPos:()=>gr,getNextListDepth:()=>Qo,handleBackspace:()=>po,handleDelete:()=>ho,hasListBefore:()=>gu,hasListItemAfter:()=>My,hasListItemBefore:()=>bu,listItemHasSubList:()=>yu,nextListIsDeeper:()=>Eu,nextListIsHigher:()=>ku});var gr=(n,e)=>{const{$from:t}=e.selection,r=me(n,e.schema);let i=null,s=t.depth,o=t.pos,a=null;for(;s>0&&a===null;)i=t.node(s),i.type===r?a=s:(s-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Qo=(n,e)=>{const t=gr(n,e);if(!t)return!1;const[,r]=Rg(e,n,t.$pos.pos+4);return r},gu=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},bu=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},yu=(n,e,t)=>{if(!t)return!1;const r=me(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},po=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!$t(n.state,e)&&gu(n.state,e,t)){const{$anchor:a}=n.state.selection,l=n.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,p)=>{f.type.name===e&&c.push({node:f,pos:p})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(l.start()+d.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!$t(n.state,e)||!Pg(n.state))return!1;const r=gr(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=yu(e,n.state,s);return bu(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Eu=(n,e)=>{const t=Qo(n,e),r=gr(n,e);return!r||!t?!1:t>r.depth},ku=(n,e)=>{const t=Qo(n,e),r=gr(n,e);return!r||!t?!1:t<r.depth},ho=(n,e)=>{if(!$t(n.state,e)||!Lg(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:Eu(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():ku(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},My=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},_u=fe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ho(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&ho(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&po(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&po(n,t,r)&&(e=!0)}),e}}}}),xl=/^(\s*)(\d+)\.\s+(.*)$/,Ay=/^\s/;function Oy(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t],s=i.match(xl);if(!s)break;const[,o,a,l]=s,c=o.length;let d=l,u=t+1;const f=[i];for(;u<n.length;){const p=n[u];if(p.match(xl))break;if(p.trim()==="")f.push(p),d+=`
`,u+=1;else if(p.match(Ay))f.push(p),d+=`
${p.slice(c+2)}`,u+=1;else break}e.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:f.join(`
`)}),r=u,t=u}return[e,r]}function vu(n,e,t){var r;const i=[];let s=0;for(;s<n.length;){const o=n[s];if(o.indent===e){const a=o.content.split(`
`),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:t.inlineTokens(l)});const d=a.slice(1).join(`
`).trim();if(d){const p=t.blockTokens(d);c.push(...p)}let u=s+1;const f=[];for(;u<n.length&&n[u].indent>e;)f.push(n[u]),u+=1;if(f.length>0){const p=Math.min(...f.map(m=>m.indent)),h=vu(f,p,t);c.push({type:"list",ordered:!0,start:f[0].number,items:h,raw:f.map(m=>m.raw).join(`
`)})}i.push({type:"list_item",raw:o.raw,tokens:c}),s=u}else s+=1}return i}function Ry(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const s=e.parseChildren([i]);r.push({type:"paragraph",content:s})}else{const s=e.parseChildren([i]);s.length>0&&r.push(...s)}}),{type:"listItem",content:r}})}var Iy="listItem",Nl="textStyle",Cl=/^(\d+)\.\s$/,Su=We.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ge(this.options.HTMLAttributes,t),0]:["ol",ge(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?Ry(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const i=n.split(`
`),[s,o]=Oy(i);if(s.length===0)return;const a=vu(s,0,t);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=s[0])==null?void 0:r.number)||1,items:a,raw:i.slice(0,o).join(`
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Iy,this.editor.getAttributes(Nl)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=An({find:Cl,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=An({find:Cl,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Nl)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Dy=/^\s*(\[([( |x])?\])\s$/,Ly=We.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ge(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const i=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Ko(n,e,i)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};c(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=t();if(typeof h!="number")return!1;const m=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...m==null?void 0:m.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{i.setAttribute(u,f)}),i.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,o),i.append(s,l),Object.entries(e).forEach(([u,f])=>{i.setAttribute(u,f)});let d=new Set(Object.keys(e));return{dom:i,contentDOM:l,update:u=>{if(u.type!==this.type)return!1;i.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u);const f=r.extensionManager.attributes,p=lr(u,f),h=new Set(Object.keys(p)),m=this.options.HTMLAttributes;return d.forEach(g=>{h.has(g)||(g in m?i.setAttribute(g,m[g]):i.removeAttribute(g))}),Object.entries(p).forEach(([g,b])=>{b==null?g in m?i.setAttribute(g,m[g]):i.removeAttribute(g):i.setAttribute(g,b)}),d=h,!0}}}},addInputRules(){return[An({find:Dy,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Py=We.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ge(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=s=>{const o=ro(s,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:t.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(s)},i=ro(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:s=>({indentLevel:s[1].length,mainContent:s[4],checked:s[3].toLowerCase()==="x"}),createToken:(s,o)=>({type:"taskItem",raw:"",mainContent:s.mainContent,indentLevel:s.indentLevel,checked:s.checked,text:s.mainContent,tokens:t.inlineTokens(s.mainContent),nestedTokens:o}),customNestedParser:r},t);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});fe.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(hu.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(mu.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(_u.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Su.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Ly.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Py.configure(this.options.taskList)),n}});var Ml="&nbsp;",By=" ",$y=We.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ge(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return r.length===1&&r[0].type==="text"&&(r[0].text===Ml||r[0].text===By)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{var r,i;if(!n)return"";const s=Array.isArray(n.content)?n.content:[];if(s.length===0){const o=Array.isArray((r=t==null?void 0:t.previousNode)==null?void 0:r.content)?t.previousNode.content:[];return((i=t==null?void 0:t.previousNode)==null?void 0:i.type)==="paragraph"&&o.length===0?Ml:""}return e.renderChildren(s)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),zy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Fy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Uy=an.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",ge(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Mn({find:zy,type:this.type})]},addPasteRules(){return[sn({find:Fy,type:this.type})]}}),Hy=We.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Ky=an.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",ge(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!i)return;const s=i[2].trim();return{type:"underline",raw:i[0],text:s,tokens:t.inlineTokens(s)}}},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 Vy(n={}){return new le({view(e){return new Wy(e,n)}})}class Wy{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let p=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(p){let h=p.getBoundingClientRect(),m=u?h.bottom:h.top;u&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:h.left,right:h.right,top:m-g,bottom:m+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=l.getBoundingClientRect(),f=u.width/l.offsetWidth,p=u.height/l.offsetHeight;c=u.left-l.scrollLeft*f,d=u.top-l.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"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,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Sc(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ue extends V{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ue.valid(r)?new ue(r):V.near(r)}content(){return D.empty}eq(e){return e instanceof ue&&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 ue(e.resolve(t.pos))}getBookmark(){return new ea(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Gy(e)||!qy(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&&ue.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)<a.childCount:e.index(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(ue.valid(l))return l}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!$.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(ue.valid(a))return a}return null}}}ue.prototype.visible=!1;ue.findFrom=ue.findGapCursorFrom;V.jsonID("gapcursor",ue);class ea{constructor(e){this.pos=e}map(e){return new ea(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ue.valid(t)?new ue(t):V.near(t)}}function wu(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function Gy(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||wu(i.type))return!0;if(i.inlineContent)return!1}}return!0}function qy(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||wu(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Jy(){return new le({props:{decorations:Xy,createSelectionBetween(n,e,t){return e.pos==t.pos&&ue.valid(t)?new ue(t):null},handleClick:jy,handleKeyDown:Yy,handleDOMEvents:{beforeinput:Zy}}})}const Yy=wd({ArrowLeft:Or("horiz",-1),ArrowRight:Or("horiz",1),ArrowUp:Or("vert",-1),ArrowDown:Or("vert",1)});function Or(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 U){if(!s.endOfTextblock(t)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=ue.findGapCursorFrom(a,e,l);return c?(i&&i(r.tr.setSelection(new ue(c))),!0):!1}}function jy(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ue.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&$.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ue(r))),!0)}function Zy(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ue))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 D(i,0,0));return s.setSelection(U.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Xy(n){if(!(n.selection instanceof ue))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(n.doc,[Oe.widget(n.selection.head,e,{key:"gapcursor"})])}var Di=200,ke=function(){};ke.prototype.append=function(e){return e.length?(e=ke.from(e),!this.length&&e||e.length<Di&&this.leafAppend(e)||this.length<Di&&e.leafPrepend(this)||this.appendInner(e)):this};ke.prototype.prepend=function(e){return e.length?ke.from(e).append(this):this};ke.prototype.appendInner=function(e){return new Qy(this,e)};ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ke.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};ke.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};ke.from=function(e){return e instanceof ke?e:e&&e.length?new Tu(e):ke.empty};var Tu=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.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Di)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Di)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(ke);ke.empty=new Tu([]);var Qy=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&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<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=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}(ke);const eE=500;class tt{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=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new at(u.map));let p=u.step.map(i.slice(s)),h;p&&o.maybeStep(p).doc&&(h=o.mapping.maps[o.mapping.maps.length-1],c.push(new at(h,void 0,void 0,c.length+d.length))),s--,h&&i.appendMap(h,s)}else o.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(s)):u.selection,l=new tt(this.items.slice(0,r).append(d.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 d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new at(e.mapping.maps[d],u,t),p;(p=l&&l.merge(f))&&(f=p,d?s.pop():a=a.slice(0,a.length-1)),s.push(f),t&&(o++,t=void 0),i||(l=f)}let c=o-r.depth;return c>nE&&(a=tE(a,c),o-=c),new tt(a.append(s),o)}remapping(e,t){let r=new nr;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 tt(this.items.append(e.map(t=>new at(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 p=s.getMirror(--l);if(p==null)return;o=Math.min(o,p);let h=s.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(s.slice(l+1,p));g&&a++,r.push(new at(h,m,g))}else r.push(new at(h))},i);let c=[];for(let f=t;f<o;f++)c.push(new at(s.maps[f]));let d=this.items.slice(0,i).append(c).append(r),u=new tt(d,a);return u.emptyItemCount()>eE&&(u=u.compress(this.items.length-r.length)),u}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 d=o.selection&&o.selection.map(t.slice(r));d&&s++;let u=new at(c.invert(),l,d),f,p=i.length-1;(f=i.length&&i[p].merge(u))?i[p]=f:i.push(u)}}else o.map&&r--},this.items.length,0),new tt(ke.from(i.reverse()),s)}}tt.empty=new tt(ke.empty,0);function tE(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class at{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 at(t.getMap().invert(),t,this.selection)}}}class xt{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const nE=20;function rE(n,e,t,r){let i=t.getMeta(Xt),s;if(i)return i.historyState;t.getMeta(oE)&&(n=new xt(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Xt))return o.getMeta(Xt).redo?new xt(n.done.addTransform(t,void 0,r,Hr(e)),n.undone,Al(t.mapping.maps),n.prevTime,n.prevComposition):new xt(n.done,n.undone.addTransform(t,void 0,r,Hr(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),l=n.prevTime==0||!o&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!iE(t,n.prevRanges)),c=o?Rs(n.prevRanges,t.mapping):Al(t.mapping.maps);return new xt(n.done.addTransform(t,l?e.selection.getBookmark():void 0,r,Hr(e)),tt.empty,c,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new xt(n.done.rebased(t,s),n.undone.rebased(t,s),Rs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new xt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Rs(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function iE(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.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function Al(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Rs(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function sE(n,e,t){let r=Hr(e),i=Xt.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new xt(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Xt,{redo:t,historyState:l})}let Is=!1,Ol=null;function Hr(n){let e=n.plugins;if(Ol!=e){Is=!1,Ol=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Is=!0;break}}return Is}const Xt=new be("history"),oE=new be("closeHistory");function aE(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new le({key:Xt,state:{init(){return new xt(tt.empty,tt.empty,null,0,-1)},apply(e,t,r){return rE(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?Nu:r=="historyRedo"?Cu:null;return!i||!e.editable?!1:(t.preventDefault(),i(e.state,e.dispatch))}}}})}function xu(n,e){return(t,r)=>{let i=Xt.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=sE(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Nu=xu(!1,!0),Cu=xu(!0,!0);fe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new le({key:new be("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=s-r,c=a-l,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var lE=fe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Vy(this.options)]}});fe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new le({key:new be("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return ae.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;o+=1});let a=0;return n.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Oe.node(c,c+l.nodeSize,{class:this.options.className}))}),ae.create(n,s)}}})]}});var cE=fe.create({name:"gapCursor",addProseMirrorPlugins(){return[Jy()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=X(B(n,"allowGapCursor",t)))!=null?e:null}}}),Rl="placeholder";function dE(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}fe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Rl,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${dE(this.options.dataAttribute)}`:`data-${Rl}`;return[new le({key:new be("placeholder"),props:{decorations:({doc:e,selection:t})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=t,s=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((a,l)=>{const c=i>=l&&i<=l+a.nodeSize,d=!a.isLeaf&&ji(a);if(!a.type.isTextblock)return this.options.includeChildren;if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const f=Oe.node(l,l+a.nodeSize,{class:u.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:c}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),ae.create(e,s)}}})]}});fe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new le({key:new be("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Fd(t.selection)||n.view.dragging?null:ae.create(t.doc,[Oe.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var uE="skipTrailingNode";function Il({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var fE=fe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new be(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(t).includes(i.name));return[new le({key:e,appendTransaction:(i,s,o)=>{const{doc:a,tr:l,schema:c}=o,d=e.getState(o),u=a.content.size,f=c.nodes[t];if(!i.some(p=>p.getMeta(uE))&&d)return l.insert(u,f.create())},state:{init:(i,s)=>{const o=s.tr.doc.lastChild;return!Il({node:o,types:r})},apply:(i,s)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return s;const o=i.doc.lastChild;return!Il({node:o,types:r})}}})]}}),pE=fe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Nu(n,e),redo:()=>({state:n,dispatch:e})=>Cu(n,e)}},addProseMirrorPlugins(){return[aE(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),hE=fe.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(zb.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Db.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(hu.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Hb.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(iu.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Wb.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(lE.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(cE.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Gb.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(qb.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(pE.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Jb.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Qb.configure(this.options.italic)),this.options.listItem!==!1&&i.push(mu.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(_u.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(wy.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Su.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push($y.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Uy.configure(this.options.strike)),this.options.text!==!1&&i.push(Hy.configure(this.options.text)),this.options.underline!==!1&&i.push(Ky.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(fE.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),mE=hE;function gE(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Mu(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(e=>{const t=n[e],r=typeof t;(r==="object"||r==="function")&&!Object.isFrozen(t)&&Mu(t)}),n}class Dl{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Au(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Rt(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 bE="</span>",Ll=n=>!!n.scope,yE=(n,{prefix:e})=>{if(n.startsWith("language:"))return n.replace("language:","language-");if(n.includes(".")){const t=n.split(".");return[`${e}${t.shift()}`,...t.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${n}`};class EE{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=Au(e)}openNode(e){if(!Ll(e))return;const t=yE(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){Ll(e)&&(this.buffer+=bE)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const Pl=(n={})=>{const e={children:[]};return Object.assign(e,n),e};class ta{constructor(){this.rootNode=Pl(),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=Pl({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=>{ta._collapse(t)}))}}class kE extends ta{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const r=e.root;t&&(r.scope=`language:${t}`),this.add(r)}toHTML(){return new EE(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function ur(n){return n?typeof n=="string"?n:n.source:null}function Ou(n){return ln("(?=",n,")")}function _E(n){return ln("(?:",n,")*")}function vE(n){return ln("(?:",n,")?")}function ln(...n){return n.map(t=>ur(t)).join("")}function SE(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function na(...n){return"("+(SE(n).capture?"":"?:")+n.map(r=>ur(r)).join("|")+")"}function Ru(n){return new RegExp(n.toString()+"|").exec("").length-1}function wE(n,e){const t=n&&n.exec(e);return t&&t.index===0}const TE=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ra(n,{joinWith:e}){let t=0;return n.map(r=>{t+=1;const i=t;let s=ur(r),o="";for(;s.length>0;){const a=TE.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 xE=/\b\B/,Iu="[a-zA-Z]\\w*",ia="[a-zA-Z_]\\w*",Du="\\b\\d+(\\.\\d+)?",Lu="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Pu="\\b(0b[01]+)",NE="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",CE=(n={})=>{const e=/^#![ ]*\//;return n.binary&&(n.begin=ln(e,/.*\b/,n.binary,/\b.*/)),Rt({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(t,r)=>{t.index!==0&&r.ignoreMatch()}},n)},fr={begin:"\\\\[\\s\\S]",relevance:0},ME={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[fr]},AE={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[fr]},OE={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/},es=function(n,e,t={}){const r=Rt({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=na("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:ln(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},RE=es("//","$"),IE=es("/\\*","\\*/"),DE=es("#","$"),LE={scope:"number",begin:Du,relevance:0},PE={scope:"number",begin:Lu,relevance:0},BE={scope:"number",begin:Pu,relevance:0},$E={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[fr,{begin:/\[/,end:/\]/,relevance:0,contains:[fr]}]},zE={scope:"title",begin:Iu,relevance:0},FE={scope:"title",begin:ia,relevance:0},UE={begin:"\\.\\s*"+ia,relevance:0},HE=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 Rr=Object.freeze({__proto__:null,APOS_STRING_MODE:ME,BACKSLASH_ESCAPE:fr,BINARY_NUMBER_MODE:BE,BINARY_NUMBER_RE:Pu,COMMENT:es,C_BLOCK_COMMENT_MODE:IE,C_LINE_COMMENT_MODE:RE,C_NUMBER_MODE:PE,C_NUMBER_RE:Lu,END_SAME_AS_BEGIN:HE,HASH_COMMENT_MODE:DE,IDENT_RE:Iu,MATCH_NOTHING_RE:xE,METHOD_GUARD:UE,NUMBER_MODE:LE,NUMBER_RE:Du,PHRASAL_WORDS_MODE:OE,QUOTE_STRING_MODE:AE,REGEXP_MODE:$E,RE_STARTERS_RE:NE,SHEBANG:CE,TITLE_MODE:zE,UNDERSCORE_IDENT_RE:ia,UNDERSCORE_TITLE_MODE:FE});function KE(n,e){n.input[n.index-1]==="."&&e.ignoreMatch()}function VE(n,e){n.className!==void 0&&(n.scope=n.className,delete n.className)}function WE(n,e){e&&n.beginKeywords&&(n.begin="\\b("+n.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",n.__beforeBegin=KE,n.keywords=n.keywords||n.beginKeywords,delete n.beginKeywords,n.relevance===void 0&&(n.relevance=0))}function GE(n,e){Array.isArray(n.illegal)&&(n.illegal=na(...n.illegal))}function qE(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 JE(n,e){n.relevance===void 0&&(n.relevance=1)}const YE=(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=ln(t.beforeMatch,Ou(t.begin)),n.starts={relevance:0,contains:[Object.assign(t,{endsParent:!0})]},n.relevance=0,delete t.beforeMatch},jE=["of","and","for","in","not","or","if","then","parent","list","value"],ZE="keyword";function Bu(n,e,t=ZE){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,Bu(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,XE(l[0],l[1])]})}}function XE(n,e){return e?Number(e):QE(n)?0:1}function QE(n){return jE.includes(n.toLowerCase())}const Bl={},Qt=n=>{console.error(n)},$l=(n,...e)=>{console.log(`WARN: ${n}`,...e)},pn=(n,e)=>{Bl[`${n}/${e}`]||(console.log(`Deprecated as of ${n}. ${e}`),Bl[`${n}/${e}`]=!0)},Li=new Error;function $u(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+=Ru(e[a-1]);n[t]=o,n[t]._emit=s,n[t]._multi=!0}function e0(n){if(Array.isArray(n.begin)){if(n.skip||n.excludeBegin||n.returnBegin)throw Qt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Li;if(typeof n.beginScope!="object"||n.beginScope===null)throw Qt("beginScope must be object"),Li;$u(n,n.begin,{key:"beginScope"}),n.begin=ra(n.begin,{joinWith:""})}}function t0(n){if(Array.isArray(n.end)){if(n.skip||n.excludeEnd||n.returnEnd)throw Qt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Li;if(typeof n.endScope!="object"||n.endScope===null)throw Qt("endScope must be object"),Li;$u(n,n.end,{key:"endScope"}),n.end=ra(n.end,{joinWith:""})}}function n0(n){n.scope&&typeof n.scope=="object"&&n.scope!==null&&(n.beginScope=n.scope,delete n.scope)}function r0(n){n0(n),typeof n.beginScope=="string"&&(n.beginScope={_wrap:n.beginScope}),typeof n.endScope=="string"&&(n.endScope={_wrap:n.endScope}),e0(n),t0(n)}function i0(n){function e(o,a){return new RegExp(ur(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+=Ru(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(ra(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((u,f)=>f>0&&u!==void 0),d=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,d)}}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,d])=>l.addRule(c,d)),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 d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,c=d.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;[VE,qE,r0,YE].forEach(d=>d(o,a)),n.compilerExtensions.forEach(d=>d(o,a)),o.__beforeBegin=null,[WE,GE,JE].forEach(d=>d(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=Bu(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=ur(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(d){return s0(d==="self"?o:d)})),o.contains.forEach(function(d){s(d,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=Rt(n.classNameAliases||{}),s(n)}function zu(n){return n?n.endsWithParent||zu(n.starts):!1}function s0(n){return n.variants&&!n.cachedVariants&&(n.cachedVariants=n.variants.map(function(e){return Rt(n,{variants:null},e)})),n.cachedVariants?n.cachedVariants:zu(n)?Rt(n,{starts:n.starts?Rt(n.starts):null}):Object.isFrozen(n)?Rt(n):n}var o0="11.11.1";class a0 extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const Ds=Au,zl=Rt,Fl=Symbol("nomatch"),l0=7,Fu=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:kE};function l(k){return a.noHighlightRe.test(k)}function c(k){let O=k.className+" ";O+=k.parentNode?k.parentNode.className:"";const S=a.languageDetectRe.exec(O);if(S){const _=R(S[1]);return _||($l(s.replace("{}",S[1])),$l("Falling back to no-highlight mode for this block.",k)),_?S[1]:"no-highlight"}return O.split(/\s+/).find(_=>l(_)||R(_))}function d(k,O,S){let _="",N="";typeof O=="object"?(_=k,S=O.ignoreIllegals,N=O.language):(pn("10.7.0","highlight(lang, code, ...args) has been deprecated."),pn("10.7.0",`Please use highlight(code, options) instead.
https://github.com/highlightjs/highlight.js/issues/2277`),N=k,_=O),S===void 0&&(S=!0);const F={code:_,language:N};q("before:highlight",F);const oe=F.result?F.result:u(F.language,F.code,S);return oe.code=F.code,q("after:highlight",oe),oe}function u(k,O,S,_){const N=Object.create(null);function F(I,P){return I.keywords[P]}function oe(){if(!z.keywords){_e.addText(re);return}let I=0;z.keywordPatternRe.lastIndex=0;let P=z.keywordPatternRe.exec(re),G="";for(;P;){G+=re.substring(I,P.index);const Z=qe.case_insensitive?P[0].toLowerCase():P[0],Ne=F(z,Z);if(Ne){const[dt,af]=Ne;if(_e.addText(G),G="",N[Z]=(N[Z]||0)+1,N[Z]<=l0&&(kr+=af),dt.startsWith("_"))G+=P[0];else{const lf=qe.classNameAliases[dt]||dt;Ue(P[0],lf)}}else G+=P[0];I=z.keywordPatternRe.lastIndex,P=z.keywordPatternRe.exec(re)}G+=re.substring(I),_e.addText(G)}function Ge(){if(re==="")return;let I=null;if(typeof z.subLanguage=="string"){if(!e[z.subLanguage]){_e.addText(re);return}I=u(z.subLanguage,re,!0,Er[z.subLanguage]),Er[z.subLanguage]=I._top}else I=p(re,z.subLanguage.length?z.subLanguage:null);z.relevance>0&&(kr+=I.relevance),_e.__addSublanguage(I._emitter,I.language)}function De(){z.subLanguage!=null?Ge():oe(),re=""}function Ue(I,P){I!==""&&(_e.startScope(P),_e.addText(I),_e.endScope())}function cn(I,P){let G=1;const Z=P.length-1;for(;G<=Z;){if(!I._emit[G]){G++;continue}const Ne=qe.classNameAliases[I[G]]||I[G],dt=P[G];Ne?Ue(dt,Ne):(re=dt,oe(),re=""),G++}}function br(I,P){return I.scope&&typeof I.scope=="string"&&_e.openNode(qe.classNameAliases[I.scope]||I.scope),I.beginScope&&(I.beginScope._wrap?(Ue(re,qe.classNameAliases[I.beginScope._wrap]||I.beginScope._wrap),re=""):I.beginScope._multi&&(cn(I.beginScope,P),re="")),z=Object.create(I,{parent:{value:z}}),z}function In(I,P,G){let Z=wE(I.endRe,G);if(Z){if(I["on:end"]){const Ne=new Dl(I);I["on:end"](P,Ne),Ne.isMatchIgnored&&(Z=!1)}if(Z){for(;I.endsParent&&I.parent;)I=I.parent;return I}}if(I.endsWithParent)return In(I.parent,P,G)}function ts(I){return z.matcher.regexIndex===0?(re+=I[0],1):(as=!0,0)}function ns(I){const P=I[0],G=I.rule,Z=new Dl(G),Ne=[G.__beforeBegin,G["on:begin"]];for(const dt of Ne)if(dt&&(dt(I,Z),Z.isMatchIgnored))return ts(P);return G.skip?re+=P:(G.excludeBegin&&(re+=P),De(),!G.returnBegin&&!G.excludeBegin&&(re=P)),br(G,I),G.returnBegin?0:P.length}function rs(I){const P=I[0],G=O.substring(I.index),Z=In(z,I,G);if(!Z)return Fl;const Ne=z;z.endScope&&z.endScope._wrap?(De(),Ue(P,z.endScope._wrap)):z.endScope&&z.endScope._multi?(De(),cn(z.endScope,I)):Ne.skip?re+=P:(Ne.returnEnd||Ne.excludeEnd||(re+=P),De(),Ne.excludeEnd&&(re=P));do z.scope&&_e.closeNode(),!z.skip&&!z.subLanguage&&(kr+=z.relevance),z=z.parent;while(z!==Z.parent);return Z.starts&&br(Z.starts,I),Ne.returnEnd?0:P.length}function is(){const I=[];for(let P=z;P!==qe;P=P.parent)P.scope&&I.unshift(P.scope);I.forEach(P=>_e.openNode(P))}let dn={};function yr(I,P){const G=P&&P[0];if(re+=I,G==null)return De(),0;if(dn.type==="begin"&&P.type==="end"&&dn.index===P.index&&G===""){if(re+=O.slice(P.index,P.index+1),!i){const Z=new Error(`0 width match regex (${k})`);throw Z.languageName=k,Z.badRule=dn.rule,Z}return 1}if(dn=P,P.type==="begin")return ns(P);if(P.type==="illegal"&&!S){const Z=new Error('Illegal lexeme "'+G+'" for mode "'+(z.scope||"<unnamed>")+'"');throw Z.mode=z,Z}else if(P.type==="end"){const Z=rs(P);if(Z!==Fl)return Z}if(P.type==="illegal"&&G==="")return re+=`
`,1;if(ss>1e5&&ss>P.index*3)throw new Error("potential infinite loop, way more iterations than matches");return re+=G,G.length}const qe=R(k);if(!qe)throw Qt(s.replace("{}",k)),new Error('Unknown language: "'+k+'"');const Q=i0(qe);let _t="",z=_||Q;const Er={},_e=new a.__emitter(a);is();let re="",kr=0,Ut=0,ss=0,as=!1;try{if(qe.__emitTokens)qe.__emitTokens(O,_e);else{for(z.matcher.considerAll();;){ss++,as?as=!1:z.matcher.considerAll(),z.matcher.lastIndex=Ut;const I=z.matcher.exec(O);if(!I)break;const P=O.substring(Ut,I.index),G=yr(P,I);Ut=I.index+G}yr(O.substring(Ut))}return _e.finalize(),_t=_e.toHTML(),{language:k,value:_t,relevance:kr,illegal:!1,_emitter:_e,_top:z}}catch(I){if(I.message&&I.message.includes("Illegal"))return{language:k,value:Ds(O),illegal:!0,relevance:0,_illegalBy:{message:I.message,index:Ut,context:O.slice(Ut-100,Ut+100),mode:I.mode,resultSoFar:_t},_emitter:_e};if(i)return{language:k,value:Ds(O),illegal:!1,relevance:0,errorRaised:I,_emitter:_e,_top:z};throw I}}function f(k){const O={value:Ds(k),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return O._emitter.addText(k),O}function p(k,O){O=O||a.languages||Object.keys(e);const S=f(k),_=O.filter(R).filter(Y).map(De=>u(De,k,!1));_.unshift(S);const N=_.sort((De,Ue)=>{if(De.relevance!==Ue.relevance)return Ue.relevance-De.relevance;if(De.language&&Ue.language){if(R(De.language).supersetOf===Ue.language)return 1;if(R(Ue.language).supersetOf===De.language)return-1}return 0}),[F,oe]=N,Ge=F;return Ge.secondBest=oe,Ge}function h(k,O,S){const _=O&&t[O]||S;k.classList.add("hljs"),k.classList.add(`language-${_}`)}function m(k){let O=null;const S=c(k);if(l(S))return;if(q("before:highlightElement",{el:k,language:S}),k.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",k);return}if(k.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(k)),a.throwUnescapedHTML))throw new a0("One of your code blocks includes unescaped HTML.",k.innerHTML);O=k;const _=O.textContent,N=S?d(_,{language:S,ignoreIllegals:!0}):p(_);k.innerHTML=N.value,k.dataset.highlighted="yes",h(k,S,N.language),k.result={language:N.language,re:N.relevance,relevance:N.relevance},N.secondBest&&(k.secondBest={language:N.secondBest.language,relevance:N.secondBest.relevance}),q("after:highlightElement",{el:k,result:N,text:_})}function g(k){a=zl(a,k)}const b=()=>{w(),pn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){w(),pn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let y=!1;function w(){function k(){w()}if(document.readyState==="loading"){y||window.addEventListener("DOMContentLoaded",k,!1),y=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function T(k,O){let S=null;try{S=O(n)}catch(_){if(Qt("Language definition for '{}' could not be registered.".replace("{}",k)),i)Qt(_);else throw _;S=o}S.name||(S.name=k),e[k]=S,S.rawDefinition=O.bind(null,n),S.aliases&&L(S.aliases,{languageName:k})}function M(k){delete e[k];for(const O of Object.keys(t))t[O]===k&&delete t[O]}function A(){return Object.keys(e)}function R(k){return k=(k||"").toLowerCase(),e[k]||e[t[k]]}function L(k,{languageName:O}){typeof k=="string"&&(k=[k]),k.forEach(S=>{t[S.toLowerCase()]=O})}function Y(k){const O=R(k);return O&&!O.disableAutodetect}function ce(k){k["before:highlightBlock"]&&!k["before:highlightElement"]&&(k["before:highlightElement"]=O=>{k["before:highlightBlock"](Object.assign({block:O.el},O))}),k["after:highlightBlock"]&&!k["after:highlightElement"]&&(k["after:highlightElement"]=O=>{k["after:highlightBlock"](Object.assign({block:O.el},O))})}function ne(k){ce(k),r.push(k)}function se(k){const O=r.indexOf(k);O!==-1&&r.splice(O,1)}function q(k,O){const S=k;r.forEach(function(_){_[S]&&_[S](O)})}function W(k){return pn("10.7.0","highlightBlock will be removed entirely in v12.0"),pn("10.7.0","Please use highlightElement now."),m(k)}Object.assign(n,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:m,highlightBlock:W,configure:g,initHighlighting:b,initHighlightingOnLoad:E,registerLanguage:T,unregisterLanguage:M,listLanguages:A,getLanguage:R,registerAliases:L,autoDetection:Y,inherit:zl,addPlugin:ne,removePlugin:se}),n.debugMode=function(){i=!1},n.safeMode=function(){i=!0},n.versionString=o0,n.regex={concat:ln,lookahead:Ou,either:na,optional:vE,anyNumberOfTimes:_E};for(const k in Rr)typeof Rr[k]=="object"&&Mu(Rr[k]);return Object.assign(n,Rr),n},On=Fu({});On.newInstance=()=>Fu({});var c0=On;On.HighlightJS=On;On.default=On;const Uu=gE(c0);function Hu(n,e=[]){return n.flatMap(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?Hu(t.children,r):{text:t.value,classes:r}})}function Ul(n){return n.value||n.children||[]}function d0(n){return!!Uu.getLanguage(n)}function Hl({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return eo(n,s=>s.type.name===e).forEach(s=>{var o;let a=s.pos+1;const l=s.node.attrs.language||r,c=t.listLanguages(),d=l&&(c.includes(l)||d0(l)||(o=t.registered)!=null&&o.call(t,l))?Ul(t.highlight(l,s.node.textContent)):Ul(t.highlightAuto(s.node.textContent));Hu(d).forEach(u=>{const f=a+u.text.length;if(u.classes.length){const p=Oe.inline(a,f,{class:u.classes.join(" ")});i.push(p)}a=f})}),ae.create(n,i)}function u0(n){return typeof n=="function"}function f0({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>u0(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new le({key:new be("lowlight"),state:{init:(i,{doc:s})=>Hl({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,d=eo(o.doc,f=>f.type.name===n),u=eo(a.doc,f=>f.type.name===n);return i.docChanged&&([l,c].includes(n)||u.length!==d.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?Hl({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var p0=iu.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],f0({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),h0=p0;function m0(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={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},p=e.optional(i)+n.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],w={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},T={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},M=[T,u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:M.concat([{begin:/\(/,end:/\)/,keywords:w,contains:M.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,R,T,M,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:w,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function g0(n){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},t=m0(n),r=t.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,t.name="Arduino",t.aliases=["ino"],t.supersetOf="cpp",t}function b0(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=n.inherit(n.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[n.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,t,i]};i.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},d={match:/\\'/},u={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},n.NUMBER_MODE,t]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=n.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[n.inherit(n.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],g=["true","false"],b={match:/(\/[a-z._-]+)+/},E=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],y=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["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"],T=["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","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:g,built_in:[...E,...y,"set","shopt",...w,...T]},contains:[p,n.SHEBANG(),h,u,s,o,b,a,l,c,d,t]}}function y0(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},u={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef 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},p=e.optional(i)+n.IDENT_RE+"\\s*\\(",g={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","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","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","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"},b=[u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],E={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},y={begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:p,returnBegin:!0,contains:[n.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"</",contains:[].concat(E,y,b,[u,{begin:n.IDENT_RE+"::",keywords:g},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},n.TITLE_MODE]}]),exports:{preprocessor:u,strings:c,keywords:g}}}function E0(n){const e=n.regex,t=n.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(i)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},n.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},u={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},p=e.optional(i)+n.IDENT_RE+"\\s*\\(",h=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],m=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],w={type:m,keyword:h,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:g},T={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,n.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},M=[T,u,a,t,n.C_BLOCK_COMMENT_MODE,d,c],A={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:M.concat([{begin:/\(/,end:/\)/,keywords:w,contains:M.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[t,n.C_BLOCK_COMMENT_MODE,c,d,a,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",t,n.C_BLOCK_COMMENT_MODE,c,d,a]}]},a,t,n.C_BLOCK_COMMENT_MODE,u]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(A,R,T,M,[u,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:w,contains:["self",a]},{begin:n.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function k0(n){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],t=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],s=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=n.inherit(n.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},u=n.inherit(d,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:o},p=n.inherit(f,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},n.BACKSLASH_ESCAPE,p]},m={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},g=n.inherit(m,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});f.contains=[m,h,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.C_BLOCK_COMMENT_MODE],p.contains=[g,h,u,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,l,n.inherit(n.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const b={variants:[c,m,h,d,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},E={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},y=n.IDENT_RE+"(<"+n.IDENT_RE+"(\\s*,\\s*"+n.IDENT_RE+")*>)?(\\[\\])?",w={begin:"@"+n.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[n.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},b,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,E,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,E,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+y+"\\s+)+"+n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:t.join(" "),relevance:0},{begin:n.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[n.TITLE_MODE,E],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[b,l,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},w]}}const _0=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_-]*/}}),v0=["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","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],S0=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],w0=[...v0,...S0],T0=["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"].sort().reverse(),x0=["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"].sort().reverse(),N0=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),C0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","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-end-end-radius","border-end-start-radius","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-start-end-radius","border-start-start-radius","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-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","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","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","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","margin-trim","marker","marker-end","marker-mid","marker-start","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","masonry-auto-flow","math-depth","math-shift","math-style","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","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-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","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","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","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function M0(n){const e=n.regex,t=_0(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:":("+x0.join("|")+")"},{begin:":(:)?("+N0.join("|")+")"}]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+C0.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:T0.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+w0.join("|")+")\\b"}]}}function A0(n){const e=n.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function O0(n){const s={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:s,illegal:"</",contains:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,{className:"string",variants:[n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[n.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:s,illegal:/["']/}]}]}}function R0(n){const e=n.regex,t=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[n.HASH_COMMENT_MODE,n.QUOTE_STRING_MODE,n.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(t,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function I0(n){const e=n.regex,t={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:n.NUMBER_RE}]},r=n.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},s={className:"literal",begin:/\bon|off|true|false|yes|no\b/},o={className:"string",contains:[n.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,s,i,o,t,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,d=/'[^']*'/,u=e.either(l,c,d),f=e.concat(u,"(\\s*\\.\\s*",u,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[r,a,s,i,o,t]}}]}}var bn="[0-9](_*[0-9])*",Ir=`\\.(${bn})`,Dr="[0-9a-fA-F](_*[0-9a-fA-F])*",Kl={className:"number",variants:[{begin:`(\\b(${bn})((${Ir})|\\.)?|(${Ir}))[eE][+-]?(${bn})[fFdD]?\\b`},{begin:`\\b(${bn})((${Ir})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Ir})[fFdD]?\\b`},{begin:`\\b(${bn})[fFdD]\\b`},{begin:`\\b0[xX]((${Dr})\\.?|(${Dr})?\\.(${Dr}))[pP][+-]?(${bn})[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 Ku(n,e,t){return t===-1?"":n.replace(e,r=>Ku(n,e,t-1))}function D0(n){const e=n.regex,t="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=t+Ku("(?:<"+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","goto","when"],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"]}]},d={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:[d,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,Kl,n.C_BLOCK_COMMENT_MODE]},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},Kl,c]}}const Vl="[A-Za-z$_][0-9A-Za-z$_]*",L0=["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","using"],P0=["true","false","null","undefined","NaN","Infinity"],Vu=["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"],Wu=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Gu=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],B0=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],$0=[].concat(Gu,Vu,Wu);function z0(n){const e=n.regex,t=(S,{after:_})=>{const N="</"+S[0].slice(1);return S.input.indexOf(N,_)!==-1},r=Vl,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,_)=>{const N=S[0].length+S.index,F=S.input[N];if(F==="<"||F===","){_.ignoreMatch();return}F===">"&&(t(S,{after:N})||_.ignoreMatch());let oe;const Ge=S.input.substring(N);if(oe=Ge.match(/^\s*=/)){_.ignoreMatch();return}if((oe=Ge.match(/^\s+extends\s+/))&&oe.index===0){_.ignoreMatch();return}}},a={$pattern:Vl,keyword:L0,literal:P0,built_in:$0,"variable.language":B0},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\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:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,f]},E={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]},y=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},u];f.contains=y.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(y)});const w=[].concat(E,f.contains),T=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(w)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T},A={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"}}]},R={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:{_:[...Vu,...Wu]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Y={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},ce={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ne(S){return e.concat("(?!",S.join("|"),")")}const se={match:e.concat(/\b/,ne([...Gu,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},W={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",O={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,m,g,E,{match:/\$\d+/},u,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},O,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,n.REGEXP_MODE,{className:"function",begin:k,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T}]}]},{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"]}]}]},Y,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},se,ce,A,W,{match:/\$[(.]/}]}}function F0(n){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,t,n.QUOTE_STRING_MODE,i,n.C_NUMBER_MODE,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var yn="[0-9](_*[0-9])*",Lr=`\\.(${yn})`,Pr="[0-9a-fA-F](_*[0-9a-fA-F])*",U0={className:"number",variants:[{begin:`(\\b(${yn})((${Lr})|\\.)?|(${Lr}))[eE][+-]?(${yn})[fFdD]?\\b`},{begin:`\\b(${yn})((${Lr})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Lr})[fFdD]?\\b`},{begin:`\\b(${yn})[fFdD]\\b`},{begin:`\\b0[xX]((${Pr})\\.?|(${Pr})?\\.(${Pr}))[pP][+-]?(${yn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Pr})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function H0(n){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},t={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:n.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[n.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+n.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[n.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[n.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+n.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+n.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[n.inherit(o,{className:"string"}),"self"]}]},c=U0,d=n.COMMENT("/\\*","\\*/",{contains:[n.C_BLOCK_COMMENT_MODE]}),u={variants:[{className:"type",begin:n.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=u;return f.variants[1].contains=[u],u.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[n.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),n.C_LINE_COMMENT_MODE,d,t,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:n.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[n.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[u,n.C_LINE_COMMENT_MODE,d],relevance:0},n.C_LINE_COMMENT_MODE,d,a,l,o,n.C_NUMBER_MODE]},d]},{begin:[/class|interface|trait/,/\s+/,n.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},n.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
`},c]}}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_-]*/}}),V0=["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","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],W0=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],G0=[...V0,...W0],q0=["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"].sort().reverse(),qu=["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"].sort().reverse(),Ju=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),J0=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","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-end-end-radius","border-end-start-radius","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-start-end-radius","border-start-start-radius","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-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","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","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","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","margin-trim","marker","marker-end","marker-mid","marker-start","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","masonry-auto-flow","math-depth","math-shift","math-style","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","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-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","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","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","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),Y0=qu.concat(Ju).sort().reverse();function j0(n){const e=K0(n),t=Y0,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],a=[],l=function(y){return{className:"string",begin:"~?"+y+".*?"+y}},c=function(y,w,T){return{className:y,begin:w,relevance:T}},d={$pattern:/[a-z-]+/,keyword:r,attribute:q0.join(" ")},u={begin:"\\(",end:"\\)",contains:a,keywords:d,relevance:0};a.push(n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,u,c("variable","@@?"+i,10),c("variable","@\\{"+i+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const f=a.concat({begin:/\{/,end:/\}/,contains:o}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},h={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+J0.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},m={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:a,relevance:0}},g={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},b={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+i+"\\}"),{begin:"\\b("+G0.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",s,0),c("selector-id","#"+s),c("selector-class","\\."+s,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+qu.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Ju.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},E={begin:i+`:(:)?(${t.join("|")})`,returnBegin:!0,contains:[b]};return o.push(n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,m,g,E,h,b,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function Z0(n){const e="\\[=*\\[",t="\\]=*\\]",r={begin:e,end:t,contains:["self"]},i=[n.COMMENT("--(?!"+e+")","$"),n.COMMENT("--"+e,t,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:n.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[n.inherit(n.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},n.C_NUMBER_MODE,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,{className:"string",begin:e,end:t,contains:[r],relevance:5}])}}function X0(n){const e={className:"variable",variants:[{begin:"\\$\\("+n.UNDERSCORE_IDENT_RE+"\\)",contains:[n.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},t={className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,t]},i={begin:"^"+n.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},s={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[n.HASH_COMMENT_MODE,e,t,r,i,s,o]}}function Q0(n){const e=n.regex,t={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},s={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=n.inherit(c,{contains:[]}),f=n.inherit(d,{contains:[]});c.contains.push(f),d.contains.push(u);let p=[t,l];return[c,d,u,f].forEach(b=>{b.contains=b.contains.concat(p)}),p=p.concat(c,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},t,s,c,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function ek(n){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},t=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:t,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:t,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,n.C_NUMBER_MODE,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[n.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},n.inherit(n.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[n.UNDERSCORE_TITLE_MODE]},{begin:"\\."+n.UNDERSCORE_IDENT_RE,relevance:0}]}}function tk(n){const e=n.regex,t=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:t.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},d=[n.BACKSLASH_ESCAPE,s,l],u=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(m,g,b="\\1")=>{const E=b==="\\1"?b:e.concat(b,g);return e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,E,/(?:\\.|[^\\\/])*?/,b,r)},p=(m,g,b)=>e.concat(e.concat("(?:",m,")"),g,/(?:\\.|[^\\\/])*?/,b,r),h=[l,n.HASH_COMMENT_MODE,n.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[n.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+n.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[n.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",e.either(...u,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",e.either(...u,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[n.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[n.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=h,o.contains=h,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:h}}function nk(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=e.concat(/[A-Z]+/,t),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=n.inherit(n.APOS_STRING_MODE,{illegal:null}),d=n.inherit(n.QUOTE_STRING_MODE,{illegal:null,contains:n.QUOTE_STRING_MODE.contains.concat(l)}),u={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:n.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(q,W)=>{W.data._beginMatch=q[1]||q[2]},"on:end":(q,W)=>{W.data._beginMatch!==q[1]&&W.ignoreMatch()}},f=n.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
]`,h={scope:"string",variants:[d,c,u,f]},m={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},g=["false","null","true"],b=["__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"],E=["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"],w={keyword:b,literal:(q=>{const W=[];return q.forEach(k=>{W.push(k),k.toLowerCase()===k?W.push(k.toUpperCase()):W.push(k.toLowerCase())}),W})(g),built_in:E},T=q=>q.map(W=>W.replace(/\|\d+$/,"")),M={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",T(E).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},A=e.concat(r,"\\b(?!\\()"),R={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),A],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),A],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"}}]},L={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},Y={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[L,o,R,n.C_BLOCK_COMMENT_MODE,h,m,M]},ce={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",T(b).join("\\b|"),"|",T(E).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[Y]};Y.contains.push(ce);const ne=[L,R,n.C_BLOCK_COMMENT_MODE,h,m,M],se={begin:e.concat(/#\[\s*\\?/,e.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...ne]},...ne,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:w,contains:[se,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}]}},a,{scope:"variable.language",match:/\$this\b/},o,ce,R,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},M,{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:w,contains:["self",se,o,R,n.C_BLOCK_COMMENT_MODE,h,m]}]},{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]},h,m]}}function rk(n){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},n.inherit(n.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),n.inherit(n.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function ik(n){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function sk(n){const e=n.regex,t=new RegExp("[\\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:/#/},d={begin:/\{\{/,relevance:0},u={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,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[n.BACKSLASH_ESCAPE,l,d,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,d,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[n.BACKSLASH_ESCAPE,d,c]},n.APOS_STRING_MODE,n.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,h=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${h})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${h})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${h})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${h})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${h})`},{begin:`\\b(${f})[jJ](?=${h})`}]},g={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,u,n.HASH_COMMENT_MODE]}]};return c.contains=[u,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},u,g,n.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[b]},{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,b,u]}]}}function ok(n){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function ak(n){const e=n.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:t,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[n.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),n.HASH_COMMENT_MODE,{scope:"string",contains:[n.BACKSLASH_ESCAPE],variants:[n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),n.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function lk(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)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:o},u={className:"string",contains:[n.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{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,d]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",h={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|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}]},M=[u,{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:[u,{begin:t}],relevance:0},h,{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,d],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);d.contains=M,m.contains=M;const Y=[{begin:/^\s*=>/,starts:{end:"$",contains:M}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:M}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[n.SHEBANG({binary:"ruby"})].concat(Y).concat(c).concat(M)}}function ck(n){const e=n.regex,t=/(r#)?/,r=e.concat(t,n.UNDERSCORE_IDENT_RE),i=e.concat(t,n.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],d=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:n.IDENT_RE+"!?",type:d,keyword:a,literal:l,built_in:c},illegal:"</",contains:[n.C_LINE_COMMENT_MODE,n.COMMENT("/\\*","\\*/",{contains:["self"]}),n.inherit(n.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[n.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:n.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:d}},{className:"punctuation",begin:"->"},s]}}const dk=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_-]*/}}),uk=["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","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],fk=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],pk=[...uk,...fk],hk=["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"].sort().reverse(),mk=["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"].sort().reverse(),gk=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),bk=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","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-end-end-radius","border-end-start-radius","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-start-end-radius","border-start-start-radius","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-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","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","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","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","margin-trim","marker","marker-end","marker-mid","marker-start","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","masonry-auto-flow","math-depth","math-shift","math-style","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","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-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","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","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","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function yk(n){const e=dk(n),t=gk,r=mk,i="@[a-z-]+",s="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[n.C_LINE_COMMENT_MODE,n.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+pk.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+t.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+bk.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:hk.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,n.QUOTE_STRING_MODE,n.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function Ek(n){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function kk(n){const e=n.regex,t=n.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],d=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],u=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=d,h=[...c,...l].filter(T=>!d.includes(T)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},g={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},b={match:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function E(T){return e.concat(/\b/,e.either(...T.map(M=>M.replace(/\s+/,"\\s+"))),/\b/)}const y={scope:"keyword",match:E(f),relevance:0};function w(T,{exceptions:M,when:A}={}){const R=A;return M=M||[],T.map(L=>L.match(/\|\d+$/)||M.includes(L)?L:R(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(h,{when:T=>T.length<3}),literal:s,type:a,built_in:u},contains:[{scope:"type",match:E(o)},y,b,m,r,i,n.C_NUMBER_MODE,n.C_BLOCK_COMMENT_MODE,t,g]}}function Yu(n){return n?typeof n=="string"?n:n.source:null}function Bn(n){return ee("(?=",n,")")}function ee(...n){return n.map(t=>Yu(t)).join("")}function _k(n){const e=n[n.length-1];return typeof e=="object"&&e.constructor===Object?(n.splice(n.length-1,1),e):{}}function Le(...n){return"("+(_k(n).capture?"":"?:")+n.map(r=>Yu(r)).join("|")+")"}const sa=n=>ee(/\b/,n,/\w$/.test(n)?/\b/:/\B/),vk=["Protocol","Type"].map(sa),Wl=["init","self"].map(sa),Sk=["Any","Self"],Ls=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Gl=["false","nil","true"],wk=["assignment","associativity","higherThan","left","lowerThan","none","right"],Tk=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],ql=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],ju=Le(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Zu=Le(ju,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Ps=ee(ju,Zu,"*"),Xu=Le(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Pi=Le(Xu,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),it=ee(Xu,Pi,"*"),Br=ee(/[A-Z]/,Pi,"*"),xk=["attached","autoclosure",ee(/convention\(/,Le("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ee(/objc\(/,it,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Nk=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Ck(n){const e={match:/\s+/,relevance:0},t=n.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[n.C_LINE_COMMENT_MODE,t],i={match:[/\./,Le(...vk,...Wl)],className:{2:"keyword"}},s={match:ee(/\./,Le(...Ls)),relevance:0},o=Ls.filter(Q=>typeof Q=="string").concat(["_|0"]),a=Ls.filter(Q=>typeof Q!="string").concat(Sk).map(sa),l={variants:[{className:"keyword",match:Le(...a,...Wl)}]},c={$pattern:Le(/\b\w+/,/#\w+/),keyword:o.concat(Tk),literal:Gl},d=[i,s,l],u={match:ee(/\./,Le(...ql)),relevance:0},f={className:"built_in",match:ee(/\b/,Le(...ql),/(?=\()/)},p=[u,f],h={match:/->/,relevance:0},m={className:"operator",relevance:0,variants:[{match:Ps},{match:`\\.(\\.|${Zu})+`}]},g=[h,m],b="([0-9]_*)+",E="([0-9a-fA-F]_*)+",y={className:"number",relevance:0,variants:[{match:`\\b(${b})(\\.(${b}))?([eE][+-]?(${b}))?\\b`},{match:`\\b0x(${E})(\\.(${E}))?([pP][+-]?(${b}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(Q="")=>({className:"subst",variants:[{match:ee(/\\/,Q,/[0\\tnr"']/)},{match:ee(/\\/,Q,/u\{[0-9a-fA-F]{1,8}\}/)}]}),T=(Q="")=>({className:"subst",match:ee(/\\/,Q,/[\t ]*(?:[\r\n]|\r\n)/)}),M=(Q="")=>({className:"subst",label:"interpol",begin:ee(/\\/,Q,/\(/),end:/\)/}),A=(Q="")=>({begin:ee(Q,/"""/),end:ee(/"""/,Q),contains:[w(Q),T(Q),M(Q)]}),R=(Q="")=>({begin:ee(Q,/"/),end:ee(/"/,Q),contains:[w(Q),M(Q)]}),L={className:"string",variants:[A(),A("#"),A("##"),A("###"),R(),R("#"),R("##"),R("###")]},Y=[n.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[n.BACKSLASH_ESCAPE]}],ce={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:Y},ne=Q=>{const _t=ee(Q,/\//),z=ee(/\//,Q);return{begin:_t,end:z,contains:[...Y,{scope:"comment",begin:`#(?!.*${z})`,end:/$/}]}},se={scope:"regexp",variants:[ne("###"),ne("##"),ne("#"),ce]},q={match:ee(/`/,it,/`/)},W={className:"variable",match:/\$\d+/},k={className:"variable",match:`\\$${Pi}+`},O=[q,W,k],S={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Nk,contains:[...g,y,L]}]}},_={scope:"keyword",match:ee(/@/,Le(...xk),Bn(Le(/\(/,/\s+/)))},N={scope:"meta",match:ee(/@/,it)},F=[S,_,N],oe={match:Bn(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ee(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Pi,"+")},{className:"type",match:Br,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ee(/\s+&\s+/,Bn(Br)),relevance:0}]},Ge={begin:/</,end:/>/,keywords:c,contains:[...r,...d,...F,h,oe]};oe.contains.push(Ge);const De={match:ee(it,/\s*:/),keywords:"_|0",relevance:0},Ue={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",De,...r,se,...d,...p,...g,y,L,...O,...F,oe]},cn={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,oe]},br={begin:Le(Bn(ee(it,/\s*:/)),Bn(ee(it,/\s+/,it,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:it}]},In={begin:/\(/,end:/\)/,keywords:c,contains:[br,...r,...d,...g,y,L,...F,oe,Ue],endsParent:!0,illegal:/["']/},ts={match:[/(func|macro)/,/\s+/,Le(q.match,it,Ps)],className:{1:"keyword",3:"title.function"},contains:[cn,In,e],illegal:[/\[/,/%/]},ns={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[cn,In,e],illegal:/\[|%/},rs={match:[/operator/,/\s+/,Ps],className:{1:"keyword",3:"title"}},is={begin:[/precedencegroup/,/\s+/,Br],className:{1:"keyword",3:"title"},contains:[oe],keywords:[...wk,...Gl],end:/}/},dn={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},yr={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},qe={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,it,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[cn,...d,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Br},...d],relevance:0}]};for(const Q of L.variants){const _t=Q.contains.find(Er=>Er.label==="interpol");_t.keywords=c;const z=[...d,...p,...g,y,L,...O];_t.contains=[...z,{begin:/\(/,end:/\)/,contains:["self",...z]}]}return{name:"Swift",keywords:c,contains:[...r,ts,ns,dn,yr,qe,rs,is,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},se,...d,...p,...g,y,L,...O,...F,oe,Ue]}}const Bi="[A-Za-z$_][0-9A-Za-z$_]*",Qu=["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","using"],ef=["true","false","null","undefined","NaN","Infinity"],tf=["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"],nf=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],rf=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],sf=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],of=[].concat(rf,tf,nf);function Mk(n){const e=n.regex,t=(S,{after:_})=>{const N="</"+S[0].slice(1);return S.input.indexOf(N,_)!==-1},r=Bi,i={begin:"<>",end:"</>"},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(S,_)=>{const N=S[0].length+S.index,F=S.input[N];if(F==="<"||F===","){_.ignoreMatch();return}F===">"&&(t(S,{after:N})||_.ignoreMatch());let oe;const Ge=S.input.substring(N);if(oe=Ge.match(/^\s*=/)){_.ignoreMatch();return}if((oe=Ge.match(/^\s+extends\s+/))&&oe.index===0){_.ignoreMatch();return}}},a={$pattern:Bi,keyword:Qu,literal:ef,built_in:of,"variable.language":sf},l="[0-9](_?[0-9])*",c=`\\.(${l})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",u={className:"number",variants:[{begin:`(\\b(${d})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${d})\\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:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},h={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[n.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},g={className:"string",begin:"`",end:"`",contains:[n.BACKSLASH_ESCAPE,f]},E={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]},y=[n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,m,g,{match:/\$\d+/},u];f.contains=y.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(y)});const w=[].concat(E,f.contains),T=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(w)}]),M={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T},A={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"}}]},R={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:{_:[...tf,...nf]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Y={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[M],illegal:/%/},ce={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ne(S){return e.concat("(?!",S.join("|"),")")}const se={match:e.concat(/\b/,ne([...rf,"super","import"].map(S=>`${S}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},q={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},W={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},M]},k="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+n.UNDERSCORE_IDENT_RE+")\\s*=>",O={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(k)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[M]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:T,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[n.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,n.APOS_STRING_MODE,n.QUOTE_STRING_MODE,p,h,m,g,E,{match:/\$\d+/},u,R,{scope:"attr",match:r+e.lookahead(":"),relevance:0},O,{begin:"("+n.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[E,n.REGEXP_MODE,{className:"function",begin:k,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:n.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:T}]}]},{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"]}]}]},Y,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+n.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[M,n.inherit(n.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},q,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[M]},se,ce,A,W,{match:/\$[(.]/}]}}function Ak(n){const e=n.regex,t=Mk(n),r=Bi,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,n.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[t.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Bi,keyword:Qu.concat(l),literal:ef,built_in:of.concat(i),"variable.language":sf},d={className:"meta",begin:"@"+r},u=(m,g,b)=>{const E=m.contains.findIndex(y=>y.label===g);if(E===-1)throw new Error("can not find mode to replace");m.contains.splice(E,1,b)};Object.assign(t.keywords,c),t.exports.PARAMS_CONTAINS.push(d);const f=t.contains.find(m=>m.scope==="attr"),p=Object.assign({},f,{match:e.concat(r,e.lookahead(/\s*\?:/))});t.exports.PARAMS_CONTAINS.push([t.exports.CLASS_REFERENCE,f,p]),t.contains=t.contains.concat([d,s,o,p]),u(t,"shebang",n.SHEBANG()),u(t,"use_strict",a);const h=t.contains.find(m=>m.label==="func.def");return h.relevance=0,Object.assign(t,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),t}function Ok(n){const e=n.regex,t={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(s,i),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(s,i),/ +/,e.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},d={className:"label",begin:/^\w+:/},u=n.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=n.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[t,r,l,c,d,u,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function Rk(n){n.regex;const e=n.COMMENT(/\(;/,/;\)/);e.contains.push("self");const t=n.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[t,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,n.QUOTE_STRING_MODE,l,c,a]}}function Ik(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:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[s,o,l,a]}]}]},n.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(t,e.either(/\/>/,/>/,/\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}]}]}}function Dk(n){const e="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[n.BACKSLASH_ESCAPE,i]},a=n.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},h={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},g=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type",begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t},{className:"meta",begin:"&"+n.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+n.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},n.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},f,{className:"number",begin:n.C_NUMBER_RE+"\\b",relevance:0},h,m,s,o],b=[...g];return b.pop(),b.push(a),p.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const Lk={arduino:g0,bash:b0,c:y0,cpp:E0,csharp:k0,css:M0,diff:A0,go:O0,graphql:R0,ini:I0,java:D0,javascript:z0,json:F0,kotlin:H0,less:j0,lua:Z0,makefile:X0,markdown:Q0,objectivec:ek,perl:tk,php:nk,"php-template":rk,plaintext:ik,python:sk,"python-repl":ok,r:ak,ruby:lk,rust:ck,scss:yk,shell:Ek,sql:kk,swift:Ck,typescript:Ak,vbnet:Ok,wasm:Rk,xml:Ik,yaml:Dk},Jl={},Pk="hljs-";function Bk(n){const e=Uu.newInstance();return n&&s(n),{highlight:t,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function t(l,c,d){const u=d||Jl,f=typeof u.prefix=="string"?u.prefix:Pk;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:$k,classPrefix:f});const p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const h=p._emitter.root,m=h.data;return m.language=p.language,m.relevance=p.relevance,h}function r(l,c){const u=(c||Jl).subset||i();let f=-1,p=0,h;for(;++f<u.length;){const m=u[f];if(!e.getLanguage(m))continue;const g=t(m,l,c);g.data&&g.data.relevance!==void 0&&g.data.relevance>p&&(p=g.data.relevance,h=g)}return h||{type:"root",children:[],data:{language:void 0,relevance:p}}}function i(){return e.listLanguages()}function s(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let d;for(d in l)Object.hasOwn(l,d)&&e.registerLanguage(d,l[d])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let d;for(d in l)if(Object.hasOwn(l,d)){const u=l[d];e.registerAliases(typeof u=="string"?u:[...u],{languageName:d})}}}function a(l){return!!e.getLanguage(l)}}class $k{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},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})}startScope(e){this.openNode(String(e))}endScope(){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=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):t.options.classPrefix+o}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const zk={class:"tiptap-wrapper"},Fk={key:0,class:"tiptap-toolbar"},Uk=$i({__name:"TipTapEditor",props:{modelValue:{},placeholder:{}},emits:["update:modelValue","ready"],setup(n,{emit:e}){const t=Bk(Lk),r=n,i=e,s=Rb({extensions:[mE.configure({codeBlock:!1}),h0.configure({lowlight:t})],content:r.modelValue||"",editorProps:{attributes:{class:"tiptap-editor"}},onUpdate:({editor:o})=>{i("update:modelValue",o.getJSON())},onCreate:()=>{i("ready")}});return Kr(()=>r.modelValue,o=>{s.value&&JSON.stringify(s.value.getJSON())!==JSON.stringify(o)&&s.value.commands.setContent(o||"",{emitUpdate:!1})}),mo(()=>{var o;(o=s.value)==null||o.destroy()}),(o,a)=>(H(),J("div",zk,[j(s)?(H(),J("div",Fk,[v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("bold")}]),onClick:a[0]||(a[0]=l=>j(s).chain().focus().toggleBold().run()),title:"Bold"},[...a[9]||(a[9]=[v("strong",null,"B",-1)])],2),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("italic")}]),onClick:a[1]||(a[1]=l=>j(s).chain().focus().toggleItalic().run()),title:"Italic"},[...a[10]||(a[10]=[v("em",null,"I",-1)])],2),a[11]||(a[11]=v("span",{class:"tiptap-separator"},null,-1)),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("heading",{level:1})}]),onClick:a[2]||(a[2]=l=>j(s).chain().focus().toggleHeading({level:1}).run()),title:"Heading 1"}," H1 ",2),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("heading",{level:2})}]),onClick:a[3]||(a[3]=l=>j(s).chain().focus().toggleHeading({level:2}).run()),title:"Heading 2"}," H2 ",2),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("heading",{level:3})}]),onClick:a[4]||(a[4]=l=>j(s).chain().focus().toggleHeading({level:3}).run()),title:"Heading 3"}," H3 ",2),a[12]||(a[12]=v("span",{class:"tiptap-separator"},null,-1)),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("bulletList")}]),onClick:a[5]||(a[5]=l=>j(s).chain().focus().toggleBulletList().run()),title:"Bullet List"}," • ",2),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("orderedList")}]),onClick:a[6]||(a[6]=l=>j(s).chain().focus().toggleOrderedList().run()),title:"Ordered List"}," 1. ",2),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("codeBlock")}]),onClick:a[7]||(a[7]=l=>j(s).chain().focus().toggleCodeBlock().run()),title:"Code Block"}," </> ",2),v("button",{type:"button",class:Pe(["tiptap-btn",{active:j(s).isActive("blockquote")}]),onClick:a[8]||(a[8]=l=>j(s).chain().focus().toggleBlockquote().run()),title:"Blockquote"}," “ ",2)])):Ae("",!0),je(j(Ob),{editor:j(s)},null,8,["editor"])]))}}),Hk={class:"reasoning-panel"},Kk={key:0,class:"reasoning-panel__empty"},Vk={key:1,class:"reasoning-panel__content"},Wk={class:"reasoning-panel__field"},Gk=["value"],qk=["value"],Jk={key:1,class:"reasoning-panel__value"},Yk={class:"reasoning-panel__field"},jk={class:"reasoning-panel__confidence"},Zk=["value"],Xk={key:2,class:"reasoning-panel__confidence-bar"},Qk={key:0,class:"reasoning-panel__field"},e_={class:"reasoning-panel__value"},t_={class:"reasoning-panel__steps"},n_={class:"reasoning-panel__steps-header"},r_={class:"reasoning-panel__step-header"},i_={class:"reasoning-panel__step-number"},s_=["onClick"],o_={class:"reasoning-panel__step-body"},a_=["value","onInput"],l_={key:1,class:"reasoning-panel__step-text"},c_={key:2,class:"reasoning-panel__step-conclusion"},d_=["value","onInput"],u_={key:1,class:"reasoning-panel__step-text reasoning-panel__step-text--conclusion"},f_={key:0,class:"reasoning-panel__no-steps"},p_={class:"reasoning-panel__modal"},h_={class:"reasoning-panel__field"},m_={class:"reasoning-panel__field"},g_={class:"reasoning-panel__modal-actions"},b_=$i({__name:"ReasoningPanel",props:{documentId:{},reasoning:{},editable:{type:Boolean}},emits:["update","add-step","delete-step"],setup(n,{emit:e}){const t=n,r=e,i=[{value:"chain",label:"Chain"},{value:"idea",label:"Idea"},{value:"context",label:"Context"},{value:"reflection",label:"Reflection"}],s=ye(null),o=ye(!1),a=ye(""),l=ye("");Kr(()=>t.reasoning,E=>{s.value=E?JSON.parse(JSON.stringify(E)):null},{immediate:!0,deep:!0});const c=yf(()=>!!s.value&&s.value.reasoning_type!==null);function d(E){s.value&&(s.value.reasoning_type=E,p())}function u(E){if(!s.value)return;const y=parseFloat(E);!isNaN(y)&&y>=0&&y<=1&&(s.value.confidence=y,p())}function f(E,y,w){s.value&&(y==="conclusion"?s.value.reasoning_steps[E].conclusion=w||null:s.value.reasoning_steps[E].thought=w,p())}function p(){s.value&&r("update",{...s.value})}function h(){a.value="",l.value="",o.value=!0}function m(){a.value.trim()&&(r("add-step",a.value.trim(),l.value.trim()||null),o.value=!1)}function g(E){r("delete-step",E)}function b(E){return E===null?"var(--text-secondary)":E>=.8?"#22c55e":E>=.5?"#eab308":"#ef4444"}return(E,y)=>{var w,T,M,A,R,L,Y,ce,ne,se,q,W;return H(),J("aside",Hk,[y[19]||(y[19]=gf('<div class="reasoning-panel__header" data-v-be14ffe5><h3 class="reasoning-panel__title" data-v-be14ffe5><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" data-v-be14ffe5><path d="M12 2a8 8 0 0 1 8 8c0 3.5-2 6-4 8l-2 2-2-2c-2-2-4-4.5-4-8a8 8 0 0 1 8-8z" data-v-be14ffe5></path><circle cx="12" cy="10" r="3" data-v-be14ffe5></circle></svg> Reasoning </h3></div>',1)),c.value?(H(),J("div",Vk,[v("div",Wk,[y[8]||(y[8]=v("label",{class:"reasoning-panel__label"},"Type",-1)),n.editable?(H(),J("select",{key:0,value:(w=s.value)==null?void 0:w.reasoning_type,class:"reasoning-panel__select",onChange:y[0]||(y[0]=k=>d(k.target.value))},[(H(),J(En,null,kn(i,k=>v("option",{key:k.value,value:k.value},Me(k.label),9,qk)),64))],40,Gk)):(H(),J("span",Jk,Me((T=i.find(k=>{var O;return k.value===((O=s.value)==null?void 0:O.reasoning_type)}))==null?void 0:T.label),1))]),v("div",Yk,[y[9]||(y[9]=v("label",{class:"reasoning-panel__label"},"Confidence",-1)),v("div",jk,[n.editable?(H(),J("input",{key:0,type:"number",min:"0",max:"1",step:"0.01",value:(M=s.value)==null?void 0:M.confidence,class:"reasoning-panel__input",onChange:y[1]||(y[1]=k=>u(k.target.value))},null,40,Zk)):(H(),J("span",{key:1,class:"reasoning-panel__value",style:Vr({color:b(((A=s.value)==null?void 0:A.confidence)??null)})},Me(((R=s.value)==null?void 0:R.confidence)!==null?(s.value.confidence*100).toFixed(0)+"%":"N/A"),5)),((L=s.value)==null?void 0:L.confidence)!==null?(H(),J("div",Xk,[v("div",{class:"reasoning-panel__confidence-fill",style:Vr({width:(((Y=s.value)==null?void 0:Y.confidence)??0)*100+"%",backgroundColor:b(((ce=s.value)==null?void 0:ce.confidence)??null)})},null,4)])):Ae("",!0)])]),(ne=s.value)!=null&&ne.model_source?(H(),J("div",Qk,[y[10]||(y[10]=v("label",{class:"reasoning-panel__label"},"Model",-1)),v("span",e_,Me(s.value.model_source),1)])):Ae("",!0),v("div",t_,[v("div",n_,[y[12]||(y[12]=v("label",{class:"reasoning-panel__label"},"Steps",-1)),n.editable?(H(),Bs(gt,{key:0,variant:"secondary",size:"sm",onClick:h},{default:He(()=>[...y[11]||(y[11]=[ve(" + Add ",-1)])]),_:1})):Ae("",!0)]),(H(!0),J(En,null,kn((se=s.value)==null?void 0:se.reasoning_steps,(k,O)=>(H(),J("div",{key:k.step,class:"reasoning-panel__step"},[v("div",r_,[v("span",i_,"Step "+Me(k.step),1),n.editable?(H(),J("button",{key:0,class:"reasoning-panel__step-delete",onClick:S=>g(k.step),title:"Delete step"}," × ",8,s_)):Ae("",!0)]),v("div",o_,[n.editable?(H(),J("textarea",{key:0,value:k.thought,class:"reasoning-panel__textarea",placeholder:"Thought...",rows:"2",onInput:S=>f(O,"thought",S.target.value)},null,40,a_)):(H(),J("p",l_,Me(k.thought),1)),k.conclusion!==void 0?(H(),J("div",c_,[y[13]||(y[13]=v("label",{class:"reasoning-panel__sublabel"},"Conclusion",-1)),n.editable?(H(),J("textarea",{key:0,value:k.conclusion??"",class:"reasoning-panel__textarea",placeholder:"Conclusion (optional)...",rows:"2",onInput:S=>f(O,"conclusion",S.target.value)},null,40,d_)):k.conclusion?(H(),J("p",u_,Me(k.conclusion),1)):Ae("",!0)])):Ae("",!0)])]))),128)),(W=(q=s.value)==null?void 0:q.reasoning_steps)!=null&&W.length?Ae("",!0):(H(),J("p",f_," No steps yet. "))])])):(H(),J("div",Kk,[y[7]||(y[7]=v("p",null,"No reasoning data for this document.",-1)),je(gt,{variant:"secondary",size:"sm",onClick:h},{default:He(()=>[...y[6]||(y[6]=[ve(" Add Reasoning ",-1)])]),_:1})])),o.value?(H(),J("div",{key:2,class:"reasoning-panel__modal-overlay",onClick:y[5]||(y[5]=bf(k=>o.value=!1,["self"]))},[v("div",p_,[y[18]||(y[18]=v("h4",{class:"reasoning-panel__modal-title"},"Add Reasoning Step",-1)),v("div",h_,[y[14]||(y[14]=v("label",{class:"reasoning-panel__label"},"Thought",-1)),Wr(v("textarea",{"onUpdate:modelValue":y[2]||(y[2]=k=>a.value=k),class:"reasoning-panel__textarea",placeholder:"Describe the reasoning thought...",rows:"3",autofocus:""},null,512),[[Gr,a.value]])]),v("div",m_,[y[15]||(y[15]=v("label",{class:"reasoning-panel__label"},"Conclusion (optional)",-1)),Wr(v("textarea",{"onUpdate:modelValue":y[3]||(y[3]=k=>l.value=k),class:"reasoning-panel__textarea",placeholder:"Optional conclusion reached...",rows:"2"},null,512),[[Gr,l.value]])]),v("div",g_,[je(gt,{variant:"secondary",size:"sm",onClick:y[4]||(y[4]=k=>o.value=!1)},{default:He(()=>[...y[16]||(y[16]=[ve("Cancel",-1)])]),_:1}),je(gt,{variant:"primary",size:"sm",onClick:m},{default:He(()=>[...y[17]||(y[17]=[ve("Add Step",-1)])]),_:1})])])])):Ae("",!0)])}}}),y_=jl(b_,[["__scopeId","data-v-be14ffe5"]]),E_={class:"layout"},k_={class:"layout__body"},__={key:0,class:"loading"},v_={key:1,class:"error"},S_={key:2,class:"doc-view"},w_={class:"doc-view__toolbar"},T_={class:"doc-view__toolbar-left"},x_={class:"doc-view__toolbar-right"},N_={key:0,class:"doc-view__saving"},C_={key:1,class:"doc-view__saved"},M_={class:"doc-view__header"},A_={class:"doc-view__tags"},O_=["onClick"],R_={key:0,class:"doc-view__links"},I_={key:0,class:"doc-view__links-section"},D_={class:"doc-view__links-title"},L_={class:"doc-view__links-list"},P_=["onClick"],B_={class:"doc-view__link-info"},$_={class:"doc-view__link-title"},z_={class:"doc-view__link-project"},F_={key:1,class:"doc-view__links-section"},U_={class:"doc-view__links-title"},H_={class:"doc-view__links-list"},K_=["onClick"],V_={class:"doc-view__link-icon"},W_={class:"doc-view__link-info"},G_={class:"doc-view__link-title"},q_={class:"doc-view__link-project"},J_={class:"doc-view__editor"},Y_={class:"form__field"},j_={class:"form__field"},Z_={class:"color-picker"},X_=["onClick"],Q_={class:"form__field"},ev={class:"export-formats"},tv=$i({__name:"DocumentView",setup(n){const e=kf(),t=_f(),r=vf(),i=ye(""),s=ye(null),o=ye(!1),a=ye(""),l=ye("#6366f1"),c=ye(!0),d=ye(null),u=ye(!1),f=ye(null),p=ye(null),h=ye(!1),m=ye(!1),g=ye("markdown"),b=ye(!1);async function E(S){h.value=!0;try{const[_,N]=await Promise.all([r.fetchBacklinks(S).catch(()=>null),r.fetchOutgoingLinks(S).catch(()=>null)]);f.value=_,p.value=N}finally{h.value=!1}}Yl(async()=>{const S=e.params.id;if(await r.fetchDocument(S),await r.fetchTags(),r.currentDocument){i.value=r.currentDocument.title;const _=await r.fetchTipTapContent(S);_?s.value=_:r.currentDocument.content?s.value=y(r.currentDocument.content):s.value={type:"doc",content:[{type:"paragraph"}]},await E(S)}}),Kr(()=>e.params.id,async S=>{if(S&&(u.value=!1,await r.fetchDocument(S),r.currentDocument)){i.value=r.currentDocument.title;const _=await r.fetchTipTapContent(S);_?s.value=_:s.value=y(r.currentDocument.content),await E(S)}}),Kr(()=>r.currentDocument,S=>{S&&(i.value=S.title)});function y(S){if(!S)return{type:"doc",content:[{type:"paragraph"}]};const _=S.split(`
`),N=[];for(const F of _)F.startsWith("### ")?N.push({type:"heading",attrs:{level:3},content:[{type:"text",text:F.substring(4)}]}):F.startsWith("## ")?N.push({type:"heading",attrs:{level:2},content:[{type:"text",text:F.substring(3)}]}):F.startsWith("# ")?N.push({type:"heading",attrs:{level:1},content:[{type:"text",text:F.substring(2)}]}):F.startsWith("- ")||F.startsWith("* ")?N.push({type:"bulletList",content:[{type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:F.substring(2)}]}]}]}):/^\d+\.\s/.test(F)?N.push({type:"orderedList",content:[{type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:F.replace(/^\d+\.\s/,"")}]}]}]}):F.startsWith("```")?N.push({type:"paragraph",content:[{type:"text",text:F}]}):F.trim()?N.push({type:"paragraph",content:[{type:"text",text:F}]}):N.push({type:"paragraph"});return{type:"doc",content:N}}function w(S){s.value=S,d.value&&clearTimeout(d.value),d.value=setTimeout(()=>{M()},1500)}function T(){u.value=!0}async function M(){!r.currentDocument||!s.value||await r.updateDocumentTipTapContent(r.currentDocument.id,s.value)}async function A(){!r.currentDocument||!i.value.trim()||await r.updateDocument(r.currentDocument.id,i.value.trim())}async function R(S){r.currentDocument&&await r.removeTag(r.currentDocument.id,S)}async function L(){if(!a.value.trim()||!r.currentDocument)return;const S=await r.createTag(a.value.trim(),l.value),_=r.currentDocument.tags.map(N=>N.id);await r.assignTags(r.currentDocument.id,[..._,S.id]),o.value=!1,a.value="",l.value="#6366f1"}async function Y(){r.currentDocument?t.push(`/projects/${r.currentDocument.project_id}`):t.push("/dashboard")}async function ce(){if(r.currentDocument){b.value=!0;try{const S=await r.exportDocument(r.currentDocument.id,g.value),_=URL.createObjectURL(S),N=document.createElement("a"),F=r.currentDocument.title.replace(/[^a-z0-9]/gi,"_");N.href=_,N.download=`${F}.${g.value}`,document.body.appendChild(N),N.click(),document.body.removeChild(N),URL.revokeObjectURL(_),m.value=!1}catch(S){console.error("Export failed:",S)}finally{b.value=!1}}}function ne(){m.value=!0}function se(S){t.push(`/documents/${S}`)}async function q(S){r.currentDocument&&await r.updateReasoning(r.currentDocument.id,S)}async function W(S,_){if(!r.currentDocument)return;const N=await r.addReasoningStep(r.currentDocument.id,S,_);N&&r.currentDocument.reasoning&&r.currentDocument.reasoning.reasoning_steps.push(N)}async function k(S){r.currentDocument&&(await r.deleteReasoningStep(r.currentDocument.id,S),r.currentDocument.reasoning&&(r.currentDocument.reasoning.reasoning_steps=r.currentDocument.reasoning.reasoning_steps.filter(_=>_.step!==S)))}const O=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f97316","#eab308","#22c55e","#10b981","#14b8a6","#06b6d4"];return(S,_)=>(H(),J("div",E_,[je(Sf),v("div",k_,[v("main",{class:Pe(["layout__content",{"layout__content--with-panel":c.value}])},[j(r).loading?(H(),J("div",__,[..._[11]||(_[11]=[v("div",{class:"loading__spinner"},null,-1),v("p",null,"Loading document...",-1)])])):j(r).error?(H(),J("div",v_,[v("p",null,Me(j(r).error),1),je(gt,{variant:"secondary",onClick:Y},{default:He(()=>[..._[12]||(_[12]=[ve("Go Back",-1)])]),_:1})])):j(r).currentDocument?(H(),J("div",S_,[v("div",w_,[v("div",T_,[v("button",{class:"doc-view__back",onClick:Y},[..._[13]||(_[13]=[v("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("path",{d:"m15 18-6-6 6-6"})],-1),ve(" Back ",-1)])]),v("button",{class:Pe(["doc-view__panel-toggle",{active:c.value}]),onClick:_[0]||(_[0]=N=>c.value=!c.value),title:"Toggle Reasoning Panel"},[..._[14]||(_[14]=[v("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("path",{d:"M12 2a8 8 0 0 1 8 8c0 3.5-2 6-4 8l-2 2-2-2c-2-2-4-4.5-4-8a8 8 0 0 1 8-8z"}),v("circle",{cx:"12",cy:"10",r:"3"})],-1)])],2)]),v("div",x_,[j(r).saving?(H(),J("div",N_,[..._[15]||(_[15]=[v("div",{class:"doc-view__saving-dot"},null,-1),ve(" Saving... ",-1)])])):u.value?(H(),J("div",C_,[..._[16]||(_[16]=[v("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("polyline",{points:"20 6 9 17 4 12"})],-1),ve(" Saved ",-1)])])):Ae("",!0),v("button",{class:"doc-view__export",onClick:ne,title:"Export document"},[..._[17]||(_[17]=[v("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),v("polyline",{points:"7 10 12 15 17 10"}),v("line",{x1:"12",y1:"15",x2:"12",y2:"3"})],-1),ve(" Export ",-1)])])])]),v("div",M_,[Wr(v("input",{"onUpdate:modelValue":_[1]||(_[1]=N=>i.value=N),type:"text",class:"doc-view__title",placeholder:"Untitled Document",onBlur:A,onKeyup:_[2]||(_[2]=Ef(N=>N.target.blur(),["enter"]))},null,544),[[Gr,i.value]])]),v("div",A_,[(H(!0),J(En,null,kn(j(r).currentDocument.tags,N=>(H(),J("span",{key:N.id,class:"doc-view__tag",style:Vr({backgroundColor:N.color+"20",color:N.color,borderColor:N.color})},[ve(Me(N.name)+" ",1),v("button",{class:"doc-view__tag-remove",onClick:F=>R(N.id)},"×",8,O_)],4))),128)),v("button",{class:"doc-view__add-tag",onClick:_[3]||(_[3]=N=>o.value=!0)},[..._[18]||(_[18]=[v("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1),ve(" Add Tag ",-1)])])]),f.value||p.value?(H(),J("div",R_,[f.value&&f.value.backlinks.length>0?(H(),J("div",I_,[v("h3",D_,[_[19]||(_[19]=v("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),v("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),ve(" Backlinks ("+Me(f.value.backlinks_count)+") ",1)]),v("div",L_,[(H(!0),J(En,null,kn(f.value.backlinks,N=>(H(),J("button",{key:N.document_id,class:"doc-view__link-item",onClick:F=>se(N.document_id)},[_[20]||(_[20]=v("span",{class:"doc-view__link-icon"},"📄",-1)),v("span",B_,[v("span",$_,Me(N.title),1),v("span",z_,Me(N.project_name),1)])],8,P_))),128))])])):Ae("",!0),p.value&&p.value.outgoing_links.length>0?(H(),J("div",F_,[v("h3",U_,[_[21]||(_[21]=v("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),v("polyline",{points:"12 5 19 12 12 19"})],-1)),ve(" Outgoing Links ("+Me(p.value.outgoing_links_count)+") ",1)]),v("div",H_,[(H(!0),J(En,null,kn(p.value.outgoing_links,N=>(H(),J("button",{key:N.document_id,class:Pe(["doc-view__link-item",{"doc-view__link-item--broken":!N.exists}]),onClick:F=>N.exists&&se(N.document_id)},[v("span",V_,Me(N.exists?"📄":"⚠️"),1),v("span",W_,[v("span",G_,Me(N.title||"Unknown Document"),1),v("span",q_,Me(N.exists?N.project_name:"Document not found"),1)])],10,K_))),128))])])):Ae("",!0)])):Ae("",!0),v("div",J_,[s.value?(H(),Bs(Uk,{key:0,"model-value":s.value,placeholder:"Start writing...","onUpdate:modelValue":w,onReady:T},null,8,["model-value"])):Ae("",!0)])])):Ae("",!0)],2),c.value&&j(r).currentDocument?(H(),Bs(y_,{key:0,"document-id":j(r).currentDocument.id,reasoning:j(r).currentDocument.reasoning,editable:!0,onUpdate:q,onAddStep:W,onDeleteStep:k},null,8,["document-id","reasoning"])):Ae("",!0)]),je(oa,{show:o.value,title:"Add Tag",onClose:_[6]||(_[6]=N=>o.value=!1)},{footer:He(()=>[je(gt,{variant:"secondary",onClick:_[5]||(_[5]=N=>o.value=!1)},{default:He(()=>[..._[24]||(_[24]=[ve("Cancel",-1)])]),_:1}),je(gt,{variant:"primary",onClick:L},{default:He(()=>[..._[25]||(_[25]=[ve("Add Tag",-1)])]),_:1})]),default:He(()=>[v("div",Y_,[_[22]||(_[22]=v("label",{for:"tag-name",class:"form__label"},"Tag Name",-1)),Wr(v("input",{id:"tag-name","onUpdate:modelValue":_[4]||(_[4]=N=>a.value=N),type:"text",class:"form__input",placeholder:"backend",autofocus:""},null,512),[[Gr,a.value]])]),v("div",j_,[_[23]||(_[23]=v("label",{class:"form__label"},"Color",-1)),v("div",Z_,[(H(),J(En,null,kn(O,N=>v("button",{key:N,class:Pe(["color-picker__option",{"color-picker__option--selected":N===l.value}]),style:Vr({backgroundColor:N}),onClick:F=>l.value=N},null,14,X_)),64))])])]),_:1},8,["show"]),je(oa,{show:m.value,title:"Export Document",onClose:_[10]||(_[10]=N=>m.value=!1)},{footer:He(()=>[je(gt,{variant:"secondary",onClick:_[9]||(_[9]=N=>m.value=!1)},{default:He(()=>[..._[29]||(_[29]=[ve("Cancel",-1)])]),_:1}),je(gt,{variant:"primary",loading:b.value,onClick:ce},{default:He(()=>[..._[30]||(_[30]=[ve("Download",-1)])]),_:1},8,["loading"])]),default:He(()=>[v("div",Q_,[_[28]||(_[28]=v("label",{class:"form__label"},"Format",-1)),v("div",ev,[v("button",{class:Pe(["export-format",{"export-format--selected":g.value==="markdown"}]),onClick:_[7]||(_[7]=N=>g.value="markdown")},[..._[26]||(_[26]=[v("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),v("polyline",{points:"14 2 14 8 20 8"}),v("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),v("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),v("polyline",{points:"10 9 9 9 8 9"})],-1),v("span",null,"Markdown",-1),v("small",null,".md file",-1)])],2),v("button",{class:Pe(["export-format",{"export-format--selected":g.value==="json"}]),onClick:_[8]||(_[8]=N=>g.value="json")},[..._[27]||(_[27]=[v("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[v("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),v("polyline",{points:"14 2 14 8 20 8"}),v("path",{d:"M8 13h2"}),v("path",{d:"M8 17h2"}),v("path",{d:"M14 13h2"}),v("path",{d:"M14 17h2"})],-1),v("span",null,"JSON",-1),v("small",null,".json with metadata",-1)])],2)])])]),_:1},8,["show"])]))}}),av=jl(tv,[["__scopeId","data-v-d8c60e5e"]]);export{av as default};