diff --git a/changes.md b/changes.md index e55c4ba..e17d089 100644 --- a/changes.md +++ b/changes.md @@ -1,5 +1,32 @@ # AiEditor ChangeLog +## v1.1.3 20240923: +- feat: add translate bubble menu items +- feat: add "pasteAsText" config support +- feat: add de and pt langs, thanks to @TobiasKrais +- feat: add Emoji config support +- fix: fix GiteeAiModel parse ai message error +- refactor: optimize AiEditor.ts and Header.ts +- refactor: optimize styles in Emoji.ts/Heading.ts/AbstractDropdownMenuButton.ts, thanks to @TobiasKrais +- refactor: optimize ai panel position +- chore: create npm-publish.yml +- chore: remove comment code + +--- + +- 新增: 浮动菜单新增翻译功能,以及自定义翻译语言 +- 新增: 新增 "pasteAsText" 配置的功能,在粘贴时自动清除样式 +- 新增: 新增德语和葡萄牙语的配置,感谢 @TobiasKrais +- 新增: 新增 emoji 自定义配置的功能 +- 修复: 修复 GiteeAiModel 在某些情况下解析错误的问题 +- 优化: 优化 AiEditor.ts 及 Header.ts 代码 +- 优化: 优化 Emoji.ts/Heading.ts/AbstractDropdownMenuButton.ts 的样式代码, @TobiasKrais +- 优化: 优化 文字选中以及 ai 弹出菜单的位置 +- 优化: 创建 npm-publish.yml 用于自动发布的功能 +- 优化: 上传部分注释代码 + + + ## v1.1.1 20240915: - feat: Increase the indent to 2em instead of 10px - feat: add FontSize defaultValue config diff --git a/dist/index.cjs b/dist/index.cjs index 120c137..58a0701 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -1,16 +1,16 @@ -"use strict";var Ug=Object.defineProperty;var qg=(t,e,n)=>e in t?Ug(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var B=(t,e,n)=>qg(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Ke(t){this.content=t}Ke.prototype={constructor:Ke,find:function(t){for(var e=0;e>1}};Ke.from=function(t){if(t instanceof Ke)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ke(e)};function Dh(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Dh(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Rh(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let u=0,c=Math.min(o.text.length,a.text.length);for(;ue&&r(l,i+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);se)for(let s=0,o=0;oe&&((on)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new L(r,i)}cutByIndex(e,n){return e==n?L.empty:e==0&&n==this.content.length?this:new L(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new L(i,s)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||n>0?ms(r+1,o):ms(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return L.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};ye.none=[];class Xs extends Error{}class F{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Hh(this.content,e+this.openStart,n);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(Ih(this.content,e+this.openStart,n+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,n){if(!n)return F.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(L.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new F(e,r,i)}}F.empty=new F(L.empty,0,0);function Ih(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Ih(s.content,e-i-1,n-i-1)))}function Hh(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=Hh(o.content,e-s-1,n);return a&&t.replaceChild(i,o.copy(a))}function Zg(t,e,n){if(n.openStart>t.depth)throw new Xs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xs("Inconsistent open depths");return Bh(t,e,n,0)}function Bh(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ei(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Qn(t.nodeAfter,r),s++));for(let a=s;ai&&yl(t,e,i+1),o=r.depth>i&&yl(n,r,i+1),a=[];return Ei(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Ph(s,o),Qn(er(s,Fh(t,e,n,r,i+1)),a)):(s&&Qn(er(s,Qs(t,e,i+1)),a),Ei(e,n,i,a),o&&Qn(er(o,Qs(n,r,i+1)),a)),Ei(r,null,i,a),new L(a)}function Qs(t,e,n){let r=[];if(Ei(null,t,n,r),t.depth>n){let i=yl(t,e,n+1);Qn(er(i,Qs(t,e,n+1)),r)}return Ei(e,null,n,r),new L(r)}function Kg(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(L.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Di{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new eo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),u=s-l;if(r.push(o,a,i+l),!u||(o=o.child(a),o.isText))break;s=u-1,i+=l+1}return new Di(n,r,s)}static resolveCached(e,n){let r=yc.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,n,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()+")"),$h(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=L.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=L.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};tr.prototype.text=void 0;class to extends tr{constructor(e,n,r,i){if(super(e,n,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):$h(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new to(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new to(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function $h(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ur{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Jg(e,n);if(r.next==null)return ur.empty;let i=Vh(r);r.next&&r.err("Unexpected trailing text");let s=rm(nm(i));return im(s,r),s}matchType(e){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` -`)}}ur.empty=new ur(!0);class Jg{constructor(e,n){this.string=e,this.nodeTypes=n,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 Vh(t){let e=[];do e.push(Yg(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Yg(t){let e=[];do e.push(Xg(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Xg(t){let e=tm(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Qg(t,e);else break;return e}function vc(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Qg(t,e){let n=vc(t),r=n;return t.eat(",")&&(t.next!="}"?r=vc(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function em(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function tm(t){if(t.eat("(")){let e=Vh(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=em(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function nm(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(s(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=s(o.exprs[l],a);if(l==o.exprs.length-1)return u;i(u,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();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 u=0;u{t[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[r.join(",")]=new ur(r.indexOf(t.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[s]=new Wh(s,n,o));let i=n.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 sm(t,e,n){let r=n.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 ${t}, got ${s}`)}}class om{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sm(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Zo{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Kh(e,i.attrs),this.excluded=null;let s=Uh(this.attrs);this.instance=s?new ye(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ye(this,qh(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Zo(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class lu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ke.from(e.nodes),n.marks=Ke.from(e.marks||{}),this.nodes=wc.compile(this.spec.nodes,this),this.marks=Zo.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]=ur.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?Ec(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==""?[]:Ec(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof wc){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(n,r,i)}text(e,n){let r=this.nodes.text;return new to(r,r.defaultAttrs,e,ye.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return tr.fromJSON(this,e)}markFromJSON(e){return ye.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Ec(t,e){let n=[];for(let r=0;r-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function am(t){return t.tag!=null}function lm(t){return t.style!=null}let nr=class xl{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(am(i))this.tags.push(i);else if(lm(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,n={}){let r=new Cc(this,n,!1);return r.addAll(e,ye.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Cc(this,n,!0);return r.addAll(e,ye.none,n.from,n.to),F.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=_c(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=_c(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xl(e,xl.schemaRules(e)))}};const jh={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},um={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Gh={ol:!0,ul:!0},no=1,ro=2,ki=4;function kc(t,e,n){return e!=null?(e?no:0)|(e==="full"?ro:0):t&&t.whitespace=="pre"?no|ro:n&~ki}class bs{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ye.none,this.match=s||(o&ki?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(L.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);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&no)){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 n=L.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!jh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Cc{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,s,o=kc(null,n.preserveWhitespace,0)|(r?ki:0);i?s=new bs(i.type,i.attrs,ye.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new bs(null,null,ye.none,!0,null,o):s=new bs(e.schema.topNodeType,null,ye.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top;if(i.options&ro||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&no)i.options&ro?r=r.replace(/\r\n?/g,` -`):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 s=i.content[i.content.length-1],o=e.previousSibling;(!s||o&&o.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=e.nodeName.toLowerCase(),s;Gh.hasOwnProperty(i)&&this.parser.normalizeLists&&cm(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,r));if(o?o.ignore:um.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let a,l=this.top,u=this.needsBlock;if(jh.hasOwnProperty(i))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),a=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);return}let c=o&&o.skip?n:this.readStyles(e,n);c&&this.addAll(e,c),a&&this.sync(l),this.needsBlock=u}else{let a=this.readStyles(e,n);a&&this.addElementByRule(e,o,a,o.consuming===!1?s:void 0)}}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r)||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r)}s&&this.sync(a)&&this.open--}addAll(e,n,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,n);this.findAtPoint(e,s)}findPlace(e,n){let r,i;for(let s=this.open;s>=0;s--){let o=this.nodes[s],a=o.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,i=o,!a.length)||o.solid)break}if(!r)return null;this.sync(i);for(let s=0;s(o.type?o.type.allowsMarkType(u.type):Sc(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new bs(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=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 u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function cm(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Gh.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function dm(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function _c(t){let e={};for(let n in t)e[n]=t[n];return e}function Sc(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l{if(s.length||o.marks.length){let a=0,l=0;for(;a=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&zs(_a(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return zs(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new br(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Mc(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Mc(e.marks)}}function Mc(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function _a(t){return t.document||window.document}const Ac=new WeakMap;function fm(t){let e=Ac.get(t);return e===void 0&&Ac.set(t,e=hm(t)),e}function hm(t){let e=null;function n(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-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&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):l.setAttribute(d,u[d])}}for(let d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=zs(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Jh=65535,Yh=Math.pow(2,16);function pm(t,e){return t+e*Yh}function Tc(t){return t&Jh}function gm(t){return(t-(t&Jh))/Yh}const Xh=1,Qh=2,Us=4,ep=8;class wl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ep)>0}get deletedBefore(){return(this.delInfo&(Xh|Us))>0}get deletedAfter(){return(this.delInfo&(Qh|Us))>0}get deletedAcross(){return(this.delInfo&Us)>0}}class mt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&mt.empty)return mt.empty}recover(e){let n=0,r=Tc(e);if(!this.inverted)for(let i=0;ie)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let f=u?e==l?-1:e==d?1:n:n,h=l+i+(f<0?0:c);if(r)return h;let p=e==(n<0?l:d)?null:pm(a/3,e-l),g=e==l?Qh:e==d?Xh:Us;return(n<0?e!=l:e!=d)&&(g|=ep),new wl(h,g,p)}i+=c-u}return r?e+i:new wl(e+i,0,null)}touches(e,n){let r=0,i=Tc(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new zr;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;rs&&l!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Re.fromReplace(e,this.from,this.to,s)}invert(){return new Kt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Mn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mn(n.from,n.to,e.markFromJSON(n.mark))}}et.jsonID("addMark",Mn);class Kt extends et{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new F(uu(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Re.fromReplace(e,this.from,this.to,r)}invert(){return new Mn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Kt(n.from,n.to,e.markFromJSON(n.mark))}}et.jsonID("removeMark",Kt);class An extends et{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Re.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Re.fromReplace(e,this.pos,this.pos+1,new F(L.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new ze(n.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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ze(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(e,n.slice),n.insert,!!n.structure)}}et.jsonID("replaceAround",ze);function El(t,e,n){let r=t.resolve(e),i=n-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 mm(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,e),h=Math.min(u+l.nodeSize,n),p=r.addToSet(d);for(let g=0;gt.step(l)),s.forEach(l=>t.step(l))}function bm(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Zo){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,n);for(let c=0;ct.step(new Kt(o.from,o.to,o.style)))}function tp(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l=0;l--)t.step(o[l])}function ym(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ai(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),s=t.$from.index(r),o=t.$to.indexAfter(r);if(rn;p--)g||r.index(p)>0?(g=!0,c=L.from(r.node(p).copy(c)),d++):l--;let f=L.empty,h=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)=0;o--){if(r.size){let a=n[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=L.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new ze(i,s,i,s,new F(r,0,0),n.length,!0))}function km(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&Sm(t.doc,t.mapping.slice(s).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?u=!1:!h&&p&&(u=!0)}u===!1&&_m(t,o,a,s),tp(t,t.mapping.slice(s).map(a,1),r,void 0,u===null);let c=t.mapping.slice(s),d=c.map(a,1),f=c.map(a+o.nodeSize,1);return t.step(new ze(d,f,d+1,f-1,new F(L.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&Cm(t,o,a,s),!1}})}function Cm(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function _m(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(` -`))}})}function Sm(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Mm(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ze(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new F(L.from(o),0,0),1,!0))}function Ur(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,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 u=i.depth-1,c=n-2;u>s;u--,c--){let d=i.node(u),f=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Am(t,e,n=1,r){let i=t.doc.resolve(e),s=L.empty,o=L.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){s=L.from(i.node(a).copy(s));let c=r&&r[u];o=L.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}t.step(new $e(e,e,new F(s.append(o),n,n),!0))}function $n(t,e){let n=t.resolve(e),r=n.index();return np(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function np(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Ko(t,e,n=-1){let r=t.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):n>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&&np(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Tm(t,e,n){let r=new $e(e-n,e+n,F.empty,!0);t.step(r)}function Om(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))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,n))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,n))return r.after(i+1);if(s=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),u=r.node(o),c=!1;if(s==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Wo(t,e,n=e,r=F.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return ip(i,s,r)?new $e(e,n,r):new Nm(i,s,r).fit()}function ip(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Nm{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=L.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=L.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=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 F(s,o,a);return e>-1?new ze(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new $e(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ma(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:u}=this.frontier[a],c,d=null;if(n==1&&(o?u.matchType(o.type)||(d=u.fillBefore(L.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ma(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new F(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ma(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new F(vi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new F(vi(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g1||l==0||g.content.size)&&(d=m,c.push(sp(g.mark(f.allowedMarks(g.marks)),u==1?l:0,u==a.childCount?h:-1)))}let p=u==a.childCount;p||(h=-1),this.placed=xi(this.placed,n,L.from(c)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n=0;a--){let{match:l,type:u}=this.frontier[a],c=Aa(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=xi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.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,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=xi(this.placed,this.depth,L.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(L.empty,!0);n.childCount&&(this.placed=xi(this.placed,this.frontier.length,n))}}function vi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(vi(t.firstChild.content,e-1,n)))}function xi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(xi(t.lastChild.content,e-1,n)))}function Ma(t,e){for(let n=0;n1&&(r=r.replaceChild(0,sp(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(L.empty,!0)))),t.copy(r)}function Aa(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Lm(n,s.content,o)?a:null}function Lm(t,e,n){for(let r=n;r0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),u=[],c=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(u.push(p),h==r.openStart)break;f=p.content}for(let f=c-1;f>=0;f--){let h=u[f],p=Dm(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))c=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+c+1)%(r.openStart+1),p=u[h];if(p)for(let g=0;g=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function op(t,e,n,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(L.empty,!0))}return t}function Im(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Om(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new F(L.from(r),0,0))}function Hm(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=ap(r,i);for(let o=0;o0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.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&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function ap(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(se.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class qr extends et{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Re.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Re.fromReplace(e,this.pos,this.pos+1,new F(L.from(i),0,n.isLeaf?0:1))}getMap(){return mt.empty}invert(e){return new qr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new qr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new qr(n.pos,n.attr,n.value)}}et.jsonID("attr",qr);class Ri extends et{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Re.ok(r)}getMap(){return mt.empty}invert(e){return new Ri(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ri(n.attr,n.value)}}et.jsonID("docAttr",Ri);let jr=class extends Error{};jr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};jr.prototype=Object.create(Error.prototype);jr.prototype.constructor=jr;jr.prototype.name="TransformError";class du{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new jr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=F.empty){let i=Wo(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new F(L.from(r),0,0))}delete(e,n){return this.replace(e,n,F.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Rm(this,e,n,r),this}replaceRangeWith(e,n,r){return Im(this,e,n,r),this}deleteRange(e,n){return Hm(this,e,n),this}lift(e,n){return vm(this,e,n),this}join(e,n=1){return Tm(this,e,n),this}wrap(e,n){return Em(this,e,n),this}setBlockType(e,n=e,r,i=null){return km(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Mm(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new qr(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ri(e,n)),this}addNodeMark(e,n){return this.step(new An(e,n)),this}removeNodeMark(e,n){if(!(n instanceof ye)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Wr(e,n)),this}split(e,n=1,r){return Am(this,e,n,r),this}addMark(e,n,r){return mm(this,e,n,r),this}removeMark(e,n,r){return bm(this,e,n,r),this}clearIncompatible(e,n,r){return tp(this,e,n,r),this}}const Ta=Object.create(null);class ee{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new lp(e.min(n),e.max(n))]}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 n=0;n=0;s--){let o=n<0?Nr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Nr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ot(e.node(0))}static atStart(e){return Nr(e,e,0,0,1)||new Ot(e)}static atEnd(e){return Nr(e,e,e.content.size,e.childCount,-1)||new Ot(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ta[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ta)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ta[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Y.between(this.$anchor,this.$head).getBookmark()}}ee.prototype.visible=!0;class lp{constructor(e,n){this.$from=e,this.$to=n}}let Nc=!1;function Lc(t){!Nc&&!t.parent.inlineContent&&(Nc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Y extends ee{constructor(e,n=e){Lc(e),Lc(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ee.near(r);let i=e.resolve(n.map(this.anchor));return new Y(i.parent.inlineContent?i:r,r)}replace(e,n=F.empty){if(super.replace(e,n),n==F.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Y&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new jo(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Y(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=ee.findFrom(n,r,!0)||ee.findFrom(n,-r,!0);if(s)n=s.$head;else return ee.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ee.findFrom(e,-r,!0)||ee.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&Q.isSelectable(a))return Q.create(t,n-(i<0?a.nodeSize:0))}else{let l=Nr(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function Dc(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=c)}),t.setSelection(ee.near(t.doc.resolve(o),n))}const Rc=1,ys=2,Ic=4;class Pm extends du{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ys,this}ensureMarks(e){return ye.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&ys)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ys,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ye.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),this.selection.empty||this.setSelection(ee.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=Ic,this}get scrolledIntoView(){return(this.updated&Ic)>0}}function Hc(t,e){return!e||!t?t:t.bind(e)}class wi{constructor(e,n,r){this.name=e,this.init=Hc(n.init,r),this.apply=Hc(n.apply,r)}}const Fm=[new wi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new wi("selection",{init(t,e){return t.selection||ee.atStart(e.doc)},apply(t){return t.selection}}),new wi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new wi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Oa{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Fm.slice(),n&&n.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 wi(r.key,r.spec.state,r))})}}class Br{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,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Oa(e.schema,e.plugins),s=new Br(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=tr.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=ee.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=u.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function up(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=up(i,e,{})),n[r]=i}return n}class ve{constructor(e){this.spec=e,this.props={},e.props&&up(e.props,this,this.props),this.key=e.key?e.key.key:cp("plugin")}getState(e){return e[this.key]}}const Na=Object.create(null);function cp(t){return t in Na?t+"$"+ ++Na[t]:(Na[t]=0,t+"$")}class Ce{constructor(e="key"){this.key=cp(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const We=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ii=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let kl=null;const cn=function(t,e,n){let r=kl||(kl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},$m=function(){kl=null},cr=function(t,e,n,r){return n&&(Bc(t,e,n,r,-1)||Bc(t,e,n,r,1))},Vm=/^(img|br|input|textarea|hr)$/i;function Bc(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:At(t))){let s=t.parentNode;if(!s||s.nodeType!=1||ts(t)||Vm.test(t.nodeName)||t.contentEditable=="false")return!1;e=We(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?At(t):0}else return!1}}function At(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zm(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=At(t)}else if(t.parentNode&&!ts(t))e=We(t),t=t.parentNode;else return null}}function Um(t,e){for(;;){if(t.nodeType==3&&e2),Mt=Gr||(Yt?/Mac/.test(Yt.platform):!1),Wm=Yt?/Win/.test(Yt.platform):!1,It=/Android \d/.test(Vn),ns=!!Pc&&"webkitFontSmoothing"in Pc.documentElement.style,jm=ns?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Gm(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function on(t,e){return typeof t=="number"?t:t[e]}function Jm(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Fc(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;o=Ii(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,u=l?Gm(s):Jm(a),c=0,d=0;if(e.topu.bottom-on(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+on(i,"top")-u.top:e.bottom-u.bottom+on(i,"bottom")),e.leftu.right-on(r,"right")&&(c=e.right-u.right+on(i,"right")),c||d)if(l)s.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let p=a.scrollLeft-f,g=a.scrollTop-h;e={left:e.left-p,top:e.top-g,right:e.right-p,bottom:e.bottom-g}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Ym(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:hp(t.dom)}}function hp(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ii(r));return e}function Xm({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;pp(n,r==0?0:r-e)}function pp(t,e){for(let n=0;n=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?eb(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:gp(n,i)}function eb(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function hu(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function tb(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function rb(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right-1?i:t.docView.posFromDOM(e,n,-1)}function mp(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let u;ns&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=rb(t,r,i,e))}a==null&&(a=nb(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function $c(t){return t.top=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:u++,fi(yn(cn(r,l,u),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==At(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return La(l.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(n<0||i==At(r))){let l=r.childNodes[i-1],u=l.nodeType==3?cn(l,At(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return fi(yn(u,1),!1)}if(s==null&&i=0)}function fi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function La(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function yp(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function ob(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return yp(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=bp(t,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=cn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const ab=/[\u0590-\u08ac]/;function lb(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!ab.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:yp(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&u==g;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return f!=null&&(a.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let Vc=null,zc=null,Uc=!1;function ub(t,e,n){return Vc==e&&zc==n?Uc:(Vc=e,zc=n,Uc=n=="up"||n=="down"?ob(t,e,n):lb(t,e,n))}const Nt=0,qc=1,Jn=2,Xt=3;class rs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Nt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nWe(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(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==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,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||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 n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof xp){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof vp&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?We(s.dom)+1:0}}else{let s,o=!0;for(;s=r=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=We(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;ch&&on){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Jn:qc,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Xt:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Jn:Xt}r=o}this.dirty=Jn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Jn:qc;n.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.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=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Nt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class cb extends rs{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class dr extends rs{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=br.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new dr(e,n,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Xt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Nt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=Tl(s,0,e,r));for(let a=0;a{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=br.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=kp(c,r,n),u?l=new db(e,n,r,i,c,d||null,f,u,s,o+1):n.isText?new Jo(e,n,r,i,c,f,s):new In(e,n,r,i,c,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>L.empty)}return e}matchesNode(e,n,r){return this.dirty==Nt&&e.eq(this.node)&&Al(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new hb(this,o&&o.node,e);mb(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?ye.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,i)},(u,c,d,f)=>{l.syncToMarks(u.marks,r,e);let h;l.findNodeMatch(u,c,d,f)||a&&e.state.selection.from>i&&e.state.selection.to-1&&l.updateNodeAt(u,c,d,h,e)||l.updateNextNode(u,c,d,e,f,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Jn)&&(o&&this.protectLocalComposition(e,o),wp(this.contentDOM,this.children,e),Gr&&bb(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Y)||rn+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=yb(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;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 cb(this,s,n,i);e.input.compositionNodes.push(o),this.children=Tl(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Xt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Nt}updateOuterDeco(e){if(Al(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ep(this.dom,this.nodeDOM,Ml(this.outerDeco,this.node,n),Ml(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Zc(t,e,n,r,i){kp(r,e,t);let s=new In(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Jo extends In{constructor(e,n,r,i,s,o,a){super(e,n,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,n,r,i){return this.dirty==Xt||this.dirty!=Nt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Nt||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=Nt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Jo(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Xt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class xp extends rs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Nt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class db extends In{constructor(e,n,r,i,s,o,a,l,u,c){super(e,n,r,i,s,o,a,u,c),this.spec=l}update(e,n,r,i){if(this.dirty==Xt)return!1;if(this.spec.update){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,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 wp(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=dr.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,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,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof dr)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function gb(t,e){return t.type.side-e.type.side}function mb(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let u=0;us;)a.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let m=p;o!m.inline):a.slice();r(f,g,e.forChild(s,f),h),s=p}}function bb(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function yb(t,e,n,r){for(let i=0,s=0;i=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Tl(t,e,n,r,i){let s=[];for(let o=0,a=0;o=n||c<=e?s.push(l):(un&&s.push(l.slice(n-u,l.size,r)))}return s}function pu(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,u;if(Go(n)){for(l=a;i&&!i.node;)i=i.parent;let c=i.node;if(i&&c.isAtom&&Q.isSelectable(c)&&i.parent&&!(c.isInline&&qm(n.focusNode,n.focusOffset,i.dom))){let d=i.posBefore;u=new Q(o==d?a:r.resolve(d))}}else{let c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null;l=r.resolve(c)}if(!u){let c=e=="pointer"||t.state.selection.head{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Cp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function xb(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,We(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&dt&&Rn<=11&&(r.disabled=!0,r.disabled=!1)}function _p(t,e){if(e instanceof Q){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Jc(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Jc(t)}function Jc(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function gu(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Y.between(e,n,r)}function Yc(t){return t.editable&&!t.hasFocus()?!1:Sp(t)}function Sp(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function wb(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return cr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ol(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ee.findFrom(s,e)}function vn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Xc(t,e,n){let r=t.state.selection;if(r instanceof Y)if(n.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=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return vn(t,new Y(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ol(t.state,e);return i&&i instanceof Q?vn(t,i):!1}else if(!(Mt&&n.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=t.docView.descAt(a))&&!o.contentDOM?Q.isSelectable(s)?vn(t,new Q(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):ns?vn(t,new Y(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Q&&r.node.isInline)return vn(t,new Y(e>0?r.$to:r.$from));{let i=Ol(t.state,e);return i?vn(t,i):!1}}}function io(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function _i(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function kr(t,e){return e<0?Eb(t):kb(t)}function Eb(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Bt&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(_i(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Mp(n))break;{let a=n.previousSibling;for(;a&&_i(a,-1);)i=n.parentNode,s=We(a),a=a.previousSibling;if(a)n=a,r=io(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Nl(t,n,r):i&&Nl(t,i,s)}function kb(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=io(n),s,o;for(;;)if(r{t.state==i&&hn(t)},50)}function Qc(t,e){let n=t.state.doc.resolve(e);if(!(Xe||Wm)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function ed(t,e,n){let r=t.state.selection;if(r instanceof Y&&!r.empty||n.indexOf("s")>-1||Mt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Ol(t.state,e);if(o&&o instanceof Q)return vn(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ot?ee.near(o,e):ee.findFrom(o,e);return a?vn(t,a):!1}return!1}function td(t,e){if(!(t.state.selection instanceof Y))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function nd(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Sb(t){if(!rt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;nd(t,r,"true"),setTimeout(()=>nd(t,r,"false"),20)}return!1}function Mb(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Ab(t,e){let n=e.keyCode,r=Mb(e);if(n==8||Mt&&n==72&&r=="c")return td(t,-1)||kr(t,-1);if(n==46&&!e.shiftKey||Mt&&n==68&&r=="c")return td(t,1)||kr(t,1);if(n==13||n==27)return!0;if(n==37||Mt&&n==66&&r=="c"){let i=n==37?Qc(t,t.state.selection.from)=="ltr"?-1:1:-1;return Xc(t,i,r)||kr(t,i)}else if(n==39||Mt&&n==70&&r=="c"){let i=n==39?Qc(t,t.state.selection.from)=="ltr"?1:-1:1;return Xc(t,i,r)||kr(t,i)}else{if(n==38||Mt&&n==80&&r=="c")return ed(t,-1,r)||kr(t,-1);if(n==40||Mt&&n==78&&r=="c")return Sb(t)||ed(t,1,r)||kr(t,1);if(r==(Mt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ap(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||br.fromSchema(t.state.schema),a=Rp(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=Dp[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=a.createElement(c[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,` +"use strict";var Ug=Object.defineProperty;var qg=(t,e,n)=>e in t?Ug(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var B=(t,e,n)=>qg(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function Ke(t){this.content=t}Ke.prototype={constructor:Ke,find:function(t){for(var e=0;e>1}};Ke.from=function(t){if(t instanceof Ke)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ke(e)};function Lh(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Lh(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Dh(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let u=0,c=Math.min(o.text.length,a.text.length);for(;ue&&r(l,i+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);se)for(let s=0,o=0;oe&&((on)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new L(r,i)}cutByIndex(e,n){return e==n?L.empty:e==0&&n==this.content.length?this:new L(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new L(i,s)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||n>0?ms(r+1,o):ms(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return L.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-i.type.rank),n}};ve.none=[];class Xs extends Error{}class F{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Ih(this.content,e+this.openStart,n);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,n){return new F(Rh(this.content,e+this.openStart,n+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,n){if(!n)return F.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(L.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new F(e,r,i)}}F.empty=new F(L.empty,0,0);function Rh(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Rh(s.content,e-i-1,n-i-1)))}function Ih(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return t.cut(0,e).append(n).append(t.cut(e));let a=Ih(o.content,e-s-1,n);return a&&t.replaceChild(i,o.copy(a))}function Zg(t,e,n){if(n.openStart>t.depth)throw new Xs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xs("Inconsistent open depths");return Hh(t,e,n,0)}function Hh(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ki(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Qn(t.nodeAfter,r),s++));for(let a=s;ai&&yl(t,e,i+1),o=r.depth>i&&yl(n,r,i+1),a=[];return ki(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Bh(s,o),Qn(er(s,Ph(t,e,n,r,i+1)),a)):(s&&Qn(er(s,Qs(t,e,i+1)),a),ki(e,n,i,a),o&&Qn(er(o,Qs(n,r,i+1)),a)),ki(r,null,i,a),new L(a)}function Qs(t,e,n){let r=[];if(ki(null,t,n,r),t.depth>n){let i=yl(t,e,n+1);Qn(er(i,Qs(t,e,n+1)),r)}return ki(e,null,n,r),new L(r)}function Kg(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(L.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Ri{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new eo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),u=s-l;if(r.push(o,a,i+l),!u||(o=o.child(a),o.isText))break;s=u-1,i+=l+1}return new Ri(n,r,s)}static resolveCached(e,n){let r=bc.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,n,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()+")"),Fh(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=L.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=L.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};tr.prototype.text=void 0;class to extends tr{constructor(e,n,r,i){if(super(e,n,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):Fh(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new to(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new to(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Fh(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ur{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Jg(e,n);if(r.next==null)return ur.empty;let i=$h(r);r.next&&r.err("Unexpected trailing text");let s=rm(nm(i));return im(s,r),s}matchType(e){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` +`)}}ur.empty=new ur(!0);class Jg{constructor(e,n){this.string=e,this.nodeTypes=n,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 $h(t){let e=[];do e.push(Yg(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Yg(t){let e=[];do e.push(Xg(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Xg(t){let e=tm(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Qg(t,e);else break;return e}function yc(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Qg(t,e){let n=yc(t),r=n;return t.eat(",")&&(t.next!="}"?r=yc(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function em(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function tm(t){if(t.eat("(")){let e=$h(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=em(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function nm(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(s(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=s(o.exprs[l],a);if(l==o.exprs.length-1)return u;i(u,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();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 u=0;u{t[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[r.join(",")]=new ur(r.indexOf(t.length-1)>-1);for(let o=0;o-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[s]=new Kh(s,n,o));let i=n.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 sm(t,e,n){let r=n.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 ${t}, got ${s}`)}}class om{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sm(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Zo{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Zh(e,i.attrs),this.excluded=null;let s=zh(this.attrs);this.instance=s?new ve(this,s):null}create(e=null){return!e&&this.instance?this.instance:new ve(this,Uh(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Zo(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class lu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Ke.from(e.nodes),n.marks=Ke.from(e.marks||{}),this.nodes=xc.compile(this.spec.nodes,this),this.marks=Zo.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]=ur.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?wc(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==""?[]:wc(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof xc){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(n,r,i)}text(e,n){let r=this.nodes.text;return new to(r,r.defaultAttrs,e,ve.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return tr.fromJSON(this,e)}markFromJSON(e){return ve.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function wc(t,e){let n=[];for(let r=0;r-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function am(t){return t.tag!=null}function lm(t){return t.style!=null}let nr=class xl{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(am(i))this.tags.push(i);else if(lm(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,n={}){let r=new kc(this,n,!1);return r.addAll(e,ve.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new kc(this,n,!0);return r.addAll(e,ve.none,n.from,n.to),F.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=Cc(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=Cc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xl(e,xl.schemaRules(e)))}};const Wh={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},um={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jh={ol:!0,ul:!0},no=1,ro=2,Ci=4;function Ec(t,e,n){return e!=null?(e?no:0)|(e==="full"?ro:0):t&&t.whitespace=="pre"?no|ro:n&~Ci}class bs{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=ve.none,this.match=s||(o&Ci?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(L.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);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&no)){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 n=L.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Wh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class kc{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,s,o=Ec(null,n.preserveWhitespace,0)|(r?Ci:0);i?s=new bs(i.type,i.attrs,ve.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new bs(null,null,ve.none,!0,null,o):s=new bs(e.schema.topNodeType,null,ve.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top;if(i.options&ro||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&no)i.options&ro?r=r.replace(/\r\n?/g,` +`):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 s=i.content[i.content.length-1],o=e.previousSibling;(!s||o&&o.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=e.nodeName.toLowerCase(),s;jh.hasOwnProperty(i)&&this.parser.normalizeLists&&cm(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,r));if(o?o.ignore:um.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,n);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let a,l=this.top,u=this.needsBlock;if(Wh.hasOwnProperty(i))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),a=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);return}let c=o&&o.skip?n:this.readStyles(e,n);c&&this.addAll(e,c),a&&this.sync(l),this.needsBlock=u}else{let a=this.readStyles(e,n);a&&this.addElementByRule(e,o,a,o.consuming===!1?s:void 0)}}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` +`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r)||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r)}s&&this.sync(a)&&this.open--}addAll(e,n,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,n);this.findAtPoint(e,s)}findPlace(e,n){let r,i;for(let s=this.open;s>=0;s--){let o=this.nodes[s],a=o.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,i=o,!a.length)||o.solid)break}if(!r)return null;this.sync(i);for(let s=0;s(o.type?o.type.allowsMarkType(u.type):_c(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new bs(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=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 u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function cm(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jh.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function dm(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Cc(t){let e={};for(let n in t)e[n]=t[n];return e}function _c(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l{if(s.length||o.marks.length){let a=0,l=0;for(;a=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&zs(_a(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return zs(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new yr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Sc(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Sc(e.marks)}}function Sc(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function _a(t){return t.document||window.document}const Mc=new WeakMap;function fm(t){let e=Mc.get(t);return e===void 0&&Mc.set(t,e=hm(t)),e}function hm(t){let e=null;function n(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-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&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):l.setAttribute(d,u[d])}}for(let d=c;dc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=zs(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Gh=65535,Jh=Math.pow(2,16);function pm(t,e){return t+e*Jh}function Ac(t){return t&Gh}function gm(t){return(t-(t&Gh))/Jh}const Yh=1,Xh=2,Us=4,Qh=8;class wl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Qh)>0}get deletedBefore(){return(this.delInfo&(Yh|Us))>0}get deletedAfter(){return(this.delInfo&(Xh|Us))>0}get deletedAcross(){return(this.delInfo&Us)>0}}class mt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&mt.empty)return mt.empty}recover(e){let n=0,r=Ac(e);if(!this.inverted)for(let i=0;ie)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let f=u?e==l?-1:e==d?1:n:n,h=l+i+(f<0?0:c);if(r)return h;let p=e==(n<0?l:d)?null:pm(a/3,e-l),g=e==l?Xh:e==d?Yh:Us;return(n<0?e!=l:e!=d)&&(g|=Qh),new wl(h,g,p)}i+=c-u}return r?e+i:new wl(e+i,0,null)}touches(e,n){let r=0,i=Ac(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Ur;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;rs&&l!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Re.fromReplace(e,this.from,this.to,s)}invert(){return new Kt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Mn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Mn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mn(n.from,n.to,e.markFromJSON(n.mark))}}et.jsonID("addMark",Mn);class Kt extends et{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new F(uu(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Re.fromReplace(e,this.from,this.to,r)}invert(){return new Mn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Kt(n.pos,r.pos,this.mark)}merge(e){return e instanceof Kt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Kt(n.from,n.to,e.markFromJSON(n.mark))}}et.jsonID("removeMark",Kt);class An extends et{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Re.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Re.fromReplace(e,this.pos,this.pos+1,new F(L.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new ze(n.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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ze(n.from,n.to,n.gapFrom,n.gapTo,F.fromJSON(e,n.slice),n.insert,!!n.structure)}}et.jsonID("replaceAround",ze);function El(t,e,n){let r=t.resolve(e),i=n-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 mm(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,e),h=Math.min(u+l.nodeSize,n),p=r.addToSet(d);for(let g=0;gt.step(l)),s.forEach(l=>t.step(l))}function bm(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof Zo){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,n);for(let c=0;ct.step(new Kt(o.from,o.to,o.style)))}function ep(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l=0;l--)t.step(o[l])}function ym(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function li(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),s=t.$from.index(r),o=t.$to.indexAfter(r);if(rn;p--)g||r.index(p)>0?(g=!0,c=L.from(r.node(p).copy(c)),d++):l--;let f=L.empty,h=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)=0;o--){if(r.size){let a=n[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=L.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new ze(i,s,i,s,new F(r,0,0),n.length,!0))}function km(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&Sm(t.doc,t.mapping.slice(s).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?u=!1:!h&&p&&(u=!0)}u===!1&&_m(t,o,a,s),ep(t,t.mapping.slice(s).map(a,1),r,void 0,u===null);let c=t.mapping.slice(s),d=c.map(a,1),f=c.map(a+o.nodeSize,1);return t.step(new ze(d,f,d+1,f-1,new F(L.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&Cm(t,o,a,s),!1}})}function Cm(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function _m(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function Sm(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Mm(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ze(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new F(L.from(o),0,0),1,!0))}function qr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,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 u=i.depth-1,c=n-2;u>s;u--,c--){let d=i.node(u),f=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function Am(t,e,n=1,r){let i=t.doc.resolve(e),s=L.empty,o=L.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){s=L.from(i.node(a).copy(s));let c=r&&r[u];o=L.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}t.step(new $e(e,e,new F(s.append(o),n,n),!0))}function $n(t,e){let n=t.resolve(e),r=n.index();return tp(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function tp(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function Ko(t,e,n=-1){let r=t.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):n>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&&tp(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function Tm(t,e,n){let r=new $e(e-n,e+n,F.empty,!0);t.step(r)}function Om(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))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,n))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,n))return r.after(i+1);if(s=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),u=r.node(o),c=!1;if(s==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Wo(t,e,n=e,r=F.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return rp(i,s,r)?new $e(e,n,r):new Nm(i,s,r).fit()}function rp(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Nm{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=L.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=L.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=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 F(s,o,a);return e>-1?new ze(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new $e(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Ma(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:u}=this.frontier[a],c,d=null;if(n==1&&(o?u.matchType(o.type)||(d=u.fillBefore(L.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ma(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new F(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Ma(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new F(xi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new F(xi(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g1||l==0||g.content.size)&&(d=m,c.push(ip(g.mark(f.allowedMarks(g.marks)),u==1?l:0,u==a.childCount?h:-1)))}let p=u==a.childCount;p||(h=-1),this.placed=wi(this.placed,n,L.from(c)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n=0;a--){let{match:l,type:u}=this.frontier[a],c=Aa(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=wi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.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,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=wi(this.placed,this.depth,L.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(L.empty,!0);n.childCount&&(this.placed=wi(this.placed,this.frontier.length,n))}}function xi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(xi(t.firstChild.content,e-1,n)))}function wi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(wi(t.lastChild.content,e-1,n)))}function Ma(t,e){for(let n=0;n1&&(r=r.replaceChild(0,ip(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(L.empty,!0)))),t.copy(r)}function Aa(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Lm(n,s.content,o)?a:null}function Lm(t,e,n){for(let r=n;r0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),u=[],c=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(u.push(p),h==r.openStart)break;f=p.content}for(let f=c-1;f>=0;f--){let h=u[f],p=Dm(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))c=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+c+1)%(r.openStart+1),p=u[h];if(p)for(let g=0;g=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function sp(t,e,n,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(L.empty,!0))}return t}function Im(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=Om(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new F(L.from(r),0,0))}function Hm(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=op(r,i);for(let o=0;o0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.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&&n>r.end(o)&&i.end(o)-n!=i.depth-o)return t.delete(r.before(o),n);t.delete(e,n)}function op(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(se.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Zr extends et{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Re.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Re.fromReplace(e,this.pos,this.pos+1,new F(L.from(i),0,n.isLeaf?0:1))}getMap(){return mt.empty}invert(e){return new Zr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Zr(n.pos,n.attr,n.value)}}et.jsonID("attr",Zr);class Ii extends et{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Re.ok(r)}getMap(){return mt.empty}invert(e){return new Ii(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ii(n.attr,n.value)}}et.jsonID("docAttr",Ii);let Gr=class extends Error{};Gr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Gr.prototype=Object.create(Error.prototype);Gr.prototype.constructor=Gr;Gr.prototype.name="TransformError";class du{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ur}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Gr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=F.empty){let i=Wo(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new F(L.from(r),0,0))}delete(e,n){return this.replace(e,n,F.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Rm(this,e,n,r),this}replaceRangeWith(e,n,r){return Im(this,e,n,r),this}deleteRange(e,n){return Hm(this,e,n),this}lift(e,n){return vm(this,e,n),this}join(e,n=1){return Tm(this,e,n),this}wrap(e,n){return Em(this,e,n),this}setBlockType(e,n=e,r,i=null){return km(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return Mm(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Zr(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ii(e,n)),this}addNodeMark(e,n){return this.step(new An(e,n)),this}removeNodeMark(e,n){if(!(n instanceof ve)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new jr(e,n)),this}split(e,n=1,r){return Am(this,e,n,r),this}addMark(e,n,r){return mm(this,e,n,r),this}removeMark(e,n,r){return bm(this,e,n,r),this}clearIncompatible(e,n,r){return ep(this,e,n,r),this}}const Ta=Object.create(null);class ee{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new ap(e.min(n),e.max(n))]}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 n=0;n=0;s--){let o=n<0?Lr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Lr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ot(e.node(0))}static atStart(e){return Lr(e,e,0,0,1)||new Ot(e)}static atEnd(e){return Lr(e,e,e.content.size,e.childCount,-1)||new Ot(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ta[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ta)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ta[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Y.between(this.$anchor,this.$head).getBookmark()}}ee.prototype.visible=!0;class ap{constructor(e,n){this.$from=e,this.$to=n}}let Oc=!1;function Nc(t){!Oc&&!t.parent.inlineContent&&(Oc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Y extends ee{constructor(e,n=e){Nc(e),Nc(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ee.near(r);let i=e.resolve(n.map(this.anchor));return new Y(i.parent.inlineContent?i:r,r)}replace(e,n=F.empty){if(super.replace(e,n),n==F.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Y&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new jo(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Y(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=ee.findFrom(n,r,!0)||ee.findFrom(n,-r,!0);if(s)n=s.$head;else return ee.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ee.findFrom(e,-r,!0)||ee.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&Q.isSelectable(a))return Q.create(t,n-(i<0?a.nodeSize:0))}else{let l=Lr(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function Lc(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=c)}),t.setSelection(ee.near(t.doc.resolve(o),n))}const Dc=1,ys=2,Rc=4;class Pm extends du{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ys,this}ensureMarks(e){return ve.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&ys)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ys,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ve.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),this.selection.empty||this.setSelection(ee.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=Rc,this}get scrolledIntoView(){return(this.updated&Rc)>0}}function Ic(t,e){return!e||!t?t:t.bind(e)}class Ei{constructor(e,n,r){this.name=e,this.init=Ic(n.init,r),this.apply=Ic(n.apply,r)}}const Fm=[new Ei("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ei("selection",{init(t,e){return t.selection||ee.atStart(e.doc)},apply(t){return t.selection}}),new Ei("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ei("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Oa{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Fm.slice(),n&&n.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 Ei(r.key,r.spec.state,r))})}}class Pr{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,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Oa(e.schema,e.plugins),s=new Pr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=tr.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=ee.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=u.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function lp(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=lp(i,e,{})),n[r]=i}return n}class be{constructor(e){this.spec=e,this.props={},e.props&&lp(e.props,this,this.props),this.key=e.key?e.key.key:up("plugin")}getState(e){return e[this.key]}}const Na=Object.create(null);function up(t){return t in Na?t+"$"+ ++Na[t]:(Na[t]=0,t+"$")}class ke{constructor(e="key"){this.key=up(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const We=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Hi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let kl=null;const cn=function(t,e,n){let r=kl||(kl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},$m=function(){kl=null},cr=function(t,e,n,r){return n&&(Hc(t,e,n,r,-1)||Hc(t,e,n,r,1))},Vm=/^(img|br|input|textarea|hr)$/i;function Hc(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:At(t))){let s=t.parentNode;if(!s||s.nodeType!=1||ns(t)||Vm.test(t.nodeName)||t.contentEditable=="false")return!1;e=We(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.contentEditable=="false")return!1;e=i<0?At(t):0}else return!1}}function At(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zm(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=At(t)}else if(t.parentNode&&!ns(t))e=We(t),t=t.parentNode;else return null}}function Um(t,e){for(;;){if(t.nodeType==3&&e2),Mt=Jr||(Yt?/Mac/.test(Yt.platform):!1),Wm=Yt?/Win/.test(Yt.platform):!1,It=/Android \d/.test(Vn),rs=!!Bc&&"webkitFontSmoothing"in Bc.documentElement.style,jm=rs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Gm(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function on(t,e){return typeof t=="number"?t:t[e]}function Jm(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Pc(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;o=Hi(o)){if(o.nodeType!=1)continue;let a=o,l=a==s.body,u=l?Gm(s):Jm(a),c=0,d=0;if(e.topu.bottom-on(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+on(i,"top")-u.top:e.bottom-u.bottom+on(i,"bottom")),e.leftu.right-on(r,"right")&&(c=e.right-u.right+on(i,"right")),c||d)if(l)s.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let p=a.scrollLeft-f,g=a.scrollTop-h;e={left:e.left-p,top:e.top-g,right:e.right-p,bottom:e.bottom-g}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function Ym(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:fp(t.dom)}}function fp(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Hi(r));return e}function Xm({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;hp(n,r==0?0:r-e)}function hp(t,e){for(let n=0;n=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?eb(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:pp(n,i)}function eb(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function hu(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function tb(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function rb(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right-1?i:t.docView.posFromDOM(e,n,-1)}function gp(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&i++}let u;rs&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=rb(t,r,i,e))}a==null&&(a=nb(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Fc(t){return t.top=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:u++,hi(yn(cn(r,l,u),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==At(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return La(l.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(n<0||i==At(r))){let l=r.childNodes[i-1],u=l.nodeType==3?cn(l,At(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return hi(yn(u,1),!1)}if(s==null&&i=0)}function hi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function La(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function bp(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function ob(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return bp(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=mp(t,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=cn(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const ab=/[\u0590-\u08ac]/;function lb(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!ab.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:bp(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),m=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&u==g;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return f!=null&&(a.caretBidiLevel=f),m}):r.pos==r.start()||r.pos==r.end()}let $c=null,Vc=null,zc=!1;function ub(t,e,n){return $c==e&&Vc==n?zc:($c=e,Vc=n,zc=n=="up"||n=="down"?ob(t,e,n):lb(t,e,n))}const Nt=0,Uc=1,Jn=2,Xt=3;class is{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Nt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nWe(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(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==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,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||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 n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof vp){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof yp&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?We(s.dom)+1:0}}else{let s,o=!0;for(;s=r=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=We(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;ch&&on){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i=r:er){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Jn:Uc,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Xt:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Jn:Xt}r=o}this.dirty=Jn}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Jn:Uc;n.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.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=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Nt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class cb extends is{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class dr extends is{constructor(e,n,r,i){super(e,[],r,i),this.mark=n}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=yr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new dr(e,n,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Xt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Xt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Nt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=Tl(s,0,e,r));for(let a=0;a{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=yr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=Ep(c,r,n),u?l=new db(e,n,r,i,c,d||null,f,u,s,o+1):n.isText?new Jo(e,n,r,i,c,f,s):new In(e,n,r,i,c,d||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>L.empty)}return e}matchesNode(e,n,r){return this.dirty==Nt&&e.eq(this.node)&&Al(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new hb(this,o&&o.node,e);mb(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?ve.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,i)},(u,c,d,f)=>{l.syncToMarks(u.marks,r,e);let h;l.findNodeMatch(u,c,d,f)||a&&e.state.selection.from>i&&e.state.selection.to-1&&l.updateNodeAt(u,c,d,h,e)||l.updateNextNode(u,c,d,e,f,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Jn)&&(o&&this.protectLocalComposition(e,o),xp(this.contentDOM,this.children,e),Jr&&bb(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Y)||rn+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=yb(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;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 cb(this,s,n,i);e.input.compositionNodes.push(o),this.children=Tl(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Xt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Nt}updateOuterDeco(e){if(Al(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=wp(this.dom,this.nodeDOM,Ml(this.outerDeco,this.node,n),Ml(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function qc(t,e,n,r,i){Ep(r,e,t);let s=new In(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Jo extends In{constructor(e,n,r,i,s,o,a){super(e,n,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,n,r,i){return this.dirty==Xt||this.dirty!=Nt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Nt||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=Nt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Jo(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Xt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class vp extends is{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Nt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class db extends In{constructor(e,n,r,i,s,o,a,l,u,c){super(e,n,r,i,s,o,a,u,c),this.spec=l}update(e,n,r,i){if(this.dirty==Xt)return!1;if(this.spec.update){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,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 xp(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=dr.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,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,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof dr)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function gb(t,e){return t.type.side-e.type.side}function mb(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let u=0;us;)a.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let m=p;o!m.inline):a.slice();r(f,g,e.forChild(s,f),h),s=p}}function bb(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function yb(t,e,n,r){for(let i=0,s=0;i=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Tl(t,e,n,r,i){let s=[];for(let o=0,a=0;o=n||c<=e?s.push(l):(un&&s.push(l.slice(n-u,l.size,r)))}return s}function pu(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,u;if(Go(n)){for(l=a;i&&!i.node;)i=i.parent;let c=i.node;if(i&&c.isAtom&&Q.isSelectable(c)&&i.parent&&!(c.isInline&&qm(n.focusNode,n.focusOffset,i.dom))){let d=i.posBefore;u=new Q(o==d?a:r.resolve(d))}}else{let c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null;l=r.resolve(c)}if(!u){let c=e=="pointer"||t.state.selection.head{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!kp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function xb(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,i=r.nodeName=="IMG";i?n.setStart(r.parentNode,We(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&dt&&Rn<=11&&(r.disabled=!0,r.disabled=!1)}function Cp(t,e){if(e instanceof Q){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Gc(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Gc(t)}function Gc(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function gu(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Y.between(e,n,r)}function Jc(t){return t.editable&&!t.hasFocus()?!1:_p(t)}function _p(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function wb(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return cr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Ol(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ee.findFrom(s,e)}function vn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Yc(t,e,n){let r=t.state.selection;if(r instanceof Y)if(n.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=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return vn(t,new Y(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Ol(t.state,e);return i&&i instanceof Q?vn(t,i):!1}else if(!(Mt&&n.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=t.docView.descAt(a))&&!o.contentDOM?Q.isSelectable(s)?vn(t,new Q(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):rs?vn(t,new Y(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Q&&r.node.isInline)return vn(t,new Y(e>0?r.$to:r.$from));{let i=Ol(t.state,e);return i?vn(t,i):!1}}}function io(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Si(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Cr(t,e){return e<0?Eb(t):kb(t)}function Eb(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Bt&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Si(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Sp(n))break;{let a=n.previousSibling;for(;a&&Si(a,-1);)i=n.parentNode,s=We(a),a=a.previousSibling;if(a)n=a,r=io(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Nl(t,n,r):i&&Nl(t,i,s)}function kb(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=io(n),s,o;for(;;)if(r{t.state==i&&hn(t)},50)}function Xc(t,e){let n=t.state.doc.resolve(e);if(!(Xe||Wm)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Qc(t,e,n){let r=t.state.selection;if(r instanceof Y&&!r.empty||n.indexOf("s")>-1||Mt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Ol(t.state,e);if(o&&o instanceof Q)return vn(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof Ot?ee.near(o,e):ee.findFrom(o,e);return a?vn(t,a):!1}return!1}function ed(t,e){if(!(t.state.selection instanceof Y))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function td(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Sb(t){if(!rt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;td(t,r,"true"),setTimeout(()=>td(t,r,"false"),20)}return!1}function Mb(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Ab(t,e){let n=e.keyCode,r=Mb(e);if(n==8||Mt&&n==72&&r=="c")return ed(t,-1)||Cr(t,-1);if(n==46&&!e.shiftKey||Mt&&n==68&&r=="c")return ed(t,1)||Cr(t,1);if(n==13||n==27)return!0;if(n==37||Mt&&n==66&&r=="c"){let i=n==37?Xc(t,t.state.selection.from)=="ltr"?-1:1:-1;return Yc(t,i,r)||Cr(t,i)}else if(n==39||Mt&&n==70&&r=="c"){let i=n==39?Xc(t,t.state.selection.from)=="ltr"?1:-1:1;return Yc(t,i,r)||Cr(t,i)}else{if(n==38||Mt&&n==80&&r=="c")return Qc(t,-1,r)||Cr(t,-1);if(n==40||Mt&&n==78&&r=="c")return Sb(t)||Qc(t,1,r)||Cr(t,1);if(r==(Mt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Mp(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||yr.fromSchema(t.state.schema),a=Dp(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=Lp[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=a.createElement(c[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,` -`);return{dom:l,text:f,slice:e}}function Tp(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return e?new F(L.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0):F.empty;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)a=d;else{let f=i.marks(),{schema:h}=t.state,p=br.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Lb(n),ns&&Db(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||nr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Tb.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Rb(rd(a,+c[1],+c[2]),c[4]);else if(a=F.maxOpen(Ob(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d{a=d(a,t)}),a}const Tb=/^(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 Ob(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&s.length&&Np(l,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Lp(o[o.length-1],s.length));let c=Op(a,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return L.from(o)}return t}function Op(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,L.from(t));return t}function Np(t,e,n,r,i){if(i1&&(s=0),i=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(L.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function rd(t,e,n){return en}).createHTML(t):t}function Lb(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Rp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Dp[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"").reverse().join("")),n.innerHTML=Nb(t),i)for(let s=0;s=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=L.from(l.create(r[a+1],i)),s++,o++}return new F(i,s,o)}const it={},st={},Ib={touchstart:!0,touchmove:!0};class Hb{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Bb(t){for(let e in it){let n=it[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Fb(t,r)&&!mu(t,r)&&(t.editable||!(r.type in st))&&n(t,r)},Ib[e]?{passive:!0}:void 0)}rt&&t.dom.addEventListener("input",()=>null),Dl(t)}function Tn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Pb(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Dl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>mu(t,r))})}function mu(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Fb(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function $b(t,e){!mu(t,e)&&it[e.type]&&(t.editable||!(e.type in st))&&it[e.type](t,e)}st.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Hp(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(It&&Xe&&n.keyCode==13)))if(t.domObserver.selectionChanged(t.domSelectionRange())?t.domObserver.flush():n.keyCode!=229&&t.domObserver.forceFlush(),Gr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Kn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Ab(t,n)?n.preventDefault():Tn(t,"key")};st.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};st.keypress=(t,e)=>{let n=e;if(Hp(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Mt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Y)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Yo(t){return{left:t.clientX,top:t.clientY}}function Vb(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function bu(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Zr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function zb(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Q.isSelectable(r)?(Zr(t,new Q(n)),!0):!1}function Ub(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Q&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(Q.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Zr(t,Q.create(t.state.doc,i)),!0):!1}function qb(t,e,n,r,i){return bu(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Ub(t,n):zb(t,n))}function Zb(t,e,n,r){return bu(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Kb(t,e,n,r){return bu(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Wb(t,n,r)}function Wb(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Zr(t,Y.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)Zr(t,Y.create(r,a+1,a+1+o.content.size));else if(Q.isSelectable(o))Zr(t,Q.create(r,a));else continue;return!0}}function yu(t){return so(t)}const Ip=Mt?"metaKey":"ctrlKey";it.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=yu(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Vb(n,t.input.lastClick)&&!n[Ip]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=t.posAtCoords(Yo(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new jb(t,o,n,!!r)):(s=="doubleClick"?Zb:Kb)(t,o.pos,o.inside,n)?n.preventDefault():Tn(t,"pointer"))};class jb{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ip],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:u}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof Q&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Bt&&!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)),Tn(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(()=>hn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Yo(e))),this.updateAllowDefault(e),this.allowDefault||!n?Tn(this.view,"pointer"):qb(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||rt&&this.mightDrag&&!this.mightDrag.node.isAtom||Xe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Zr(this.view,ee.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Tn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Tn(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)}}it.touchstart=t=>{t.input.lastTouch=Date.now(),yu(t),Tn(t,"pointer")};it.touchmove=t=>{t.input.lastTouch=Date.now(),Tn(t,"pointer")};it.contextmenu=t=>yu(t);function Hp(t,e){return t.composing?!0:rt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Gb=It?5e3:-1;st.compositionstart=st.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Y&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),so(t,!0),t.markCursor=null;else if(so(t,!e.selection.empty),Bt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.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=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Bp(t,Gb)};st.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Bp(t,20))};function Bp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>so(t),e))}function Pp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Yb());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Jb(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=zm(e.focusNode,e.focusOffset),r=Um(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Yb(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function so(t,e=!1){if(!(It&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Pp(t),e||t.docView&&t.docView.dirty){let n=pu(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Xb(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Hi=dt&&Rn<15||Gr&&jm<604;it.copy=st.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Hi?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Ap(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):Xb(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Qb(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function e2(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Bi(t,r.value,null,i,e):Bi(t,r.textContent,r.innerHTML,i,e)},50)}function Bi(t,e,n,r,i){let s=Tp(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||F.empty)))return!0;if(!s)return!1;let o=Qb(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}st.paste=(t,e)=>{let n=e;if(t.composing&&!It)return;let r=Hi?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Bi(t,Fp(r),r.getData("text/html"),i,n)?n.preventDefault():e2(t,n)};class $p{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Vp=Mt?"altKey":"ctrlKey";it.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Yo(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Q?i.to-1:i.to))){if(r&&r.mightDrag)o=Q.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=Q.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:u,slice:c}=Ap(t,a);(!n.dataTransfer.files.length||!Xe||fp>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Hi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Hi||n.dataTransfer.setData("text/plain",u),t.dragging=new $p(c,!n[Vp],o)};it.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};st.dragover=st.dragenter=(t,e)=>e.preventDefault();st.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Yo(n));if(!i)return;let s=t.state.doc.resolve(i.pos),o=r&&r.slice;o?t.someProp("transformPasted",p=>{o=p(o,t)}):o=Tp(t,Fp(n.dataTransfer),Hi?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!n[Vp]);if(t.someProp("handleDrop",p=>p(t,n,o||F.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?rp(t.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let u=t.state.tr;if(a){let{node:p}=r;p?p.replace(u):u.deleteSelection()}let c=u.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=u.doc;if(d?u.replaceRangeWith(c,c,o.content.firstChild):u.replaceRange(c,c,o),u.doc.eq(f))return;let h=u.doc.resolve(c);if(d&&Q.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new Q(h));else{let p=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((g,m,y,v)=>p=v),u.setSelection(gu(t,h,u.doc.resolve(p)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};it.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&hn(t)},20))};it.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};it.beforeinput=(t,e)=>{if(Xe&&It&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Kn(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in st)it[t]=st[t];function Pi(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class oo{constructor(e,n){this.toDOM=e,this.spec=n||rr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Ie(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof oo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Hn{constructor(e,n){this.attrs=e,this.spec=n||rr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ie(s,o,this)}valid(e,n){return n.from=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;oe){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==Ye||e.maps.length==0?this:this.mapInner(e,n,0,0,r||rr)}mapInner(e,n,r,i,s){let o;for(let a=0;a{let u=l+r,c;if(c=Up(n,a,u)){for(i||(i=this.children.slice());sa&&d.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;as&&l.type instanceof Hn){let u=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;ui.map(e,n,rr));return kn.from(r)}forChild(e,n){if(n.isLeaf)return be.empty;let r=[];for(let i=0;in instanceof be)?e:e.reduce((n,r)=>n.concat(r instanceof be?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let m=g-p-(h-f);for(let y=0;yv+c-d)continue;let x=a[y]+c-d;h>=x?a[y+1]=f<=x?-2:-1:f>=c&&m&&(a[y]+=m,a[y+1]+=m)}d+=m}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u=r.content.size){l=!0;continue}let f=n.map(t[u+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=a[u+2].mapInner(n,m,c+1,t[u]+s+1,o);y!=Ye?(a[u]=d,a[u+1]=h,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=n2(a,t,e,n,i,s,o),c=ao(u,r,0,o);e=c.local;for(let d=0;dn&&o.to{let u=Up(t,a,l+n);if(u){s=!0;let c=ao(u,a,n+l+1,r);c!=Ye&&i.push(l,l+a.nodeSize,c)}});let o=zp(s?qp(t):t,-n).sort(ir);for(let a=0;a0;)e++;t.splice(e,0,n)}function Ra(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ye&&e.push(r)}),t.cursorWrapper&&e.push(be.create(t.state.doc,[t.cursorWrapper.deco])),kn.from(e)}const r2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},i2=dt&&Rn<=11;class s2{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 o2{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new s2,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),i2&&(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,r2)),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 n=0;nthis.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(Yc(this.view)){if(this.suppressingSelectionUpdates)return hn(this.view);if(dt&&Rn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&cr(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 n=new Set,r;for(let s=e.focusNode;s;s=Ii(s))n.add(s);for(let s=e.anchorNode;s;s=Ii(s))if(n.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}selectionChanged(e){return!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Yc(this.view)&&!this.ignoreSelectionChange(e)}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=this.selectionChanged(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let c=0;cd.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||u2(e,d)!=h)&&f.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),a2(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||hn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.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 c=0;ci;m--){let y=r.childNodes[m-1],v=y.pmViewDesc;if(y.nodeName=="BR"&&!v){s=m;break}if(!v||v.size)break}let d=t.state.doc,f=t.someProp("domParser")||nr.fromSchema(t.state.schema),h=d.resolve(o),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:d2,context:h});if(u&&u[0].pos!=null){let m=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=m),p={anchor:m+o,head:y+o}}return{doc:g,sel:p,from:o,to:a}}function d2(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(rt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||rt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const f2=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function h2(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let M=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=pu(t,M);if(I&&!t.state.selection.eq(I)){if(Xe&&It&&t.input.lastKeyCode===13&&Date.now()-100K(t,Kn(13,"Enter"))))return;let $=t.state.tr.setSelection(I);M=="pointer"?$.setMeta("pointer",!0):M=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),t.dispatch($)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=c2(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),f,h;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||It)&&i.some(M=>M.nodeType==1&&!f2.test(M.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",M=>M(t,Kn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof Y&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let M=ud(t,t.state.doc,u.sel);if(M&&!M.eq(t.state.selection)){let I=t.state.tr.setSelection(M);s&&I.setMeta("composition",s),t.dispatch(I)}}return}t.state.selection.fromt.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),dt&&Rn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=u.doc.resolveNoCache(p.start-u.from),m=u.doc.resolveNoCache(p.endB-u.from),y=c.resolve(p.start),v=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA,x;if((Gr&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!v&&g.posM(t,Kn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&g2(c,p.start,p.endA,g,m)&&t.someProp("handleKeyDown",M=>M(t,Kn(8,"Backspace")))){It&&Xe&&t.domObserver.suppressSelectionUpdates();return}Xe&&It&&p.endB==p.start&&(t.input.lastAndroidDelete=Date.now()),It&&!v&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,m=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(M){return M(t,Kn(13,"Enter"))})},20));let b=p.start,k=p.endA,w,_,N;if(v){if(g.pos==m.pos)dt&&Rn<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>hn(t),20)),w=t.state.tr.delete(b,k),_=c.resolve(p.start).marksAcross(c.resolve(p.endA));else if(p.endA==p.endB&&(N=p2(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))w=t.state.tr,N.type=="add"?w.addMark(b,k,N.mark):w.removeMark(b,k,N.mark);else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,m.parentOffset);if(t.someProp("handleTextInput",I=>I(t,b,k,M)))return;w=t.state.tr.insertText(M,b,k)}}if(w||(w=t.state.tr.replace(b,k,u.doc.slice(p.start-u.from,p.endB-u.from))),u.sel){let M=ud(t,w.doc,u.sel);M&&!(Xe&&It&&t.composing&&M.empty&&(p.start!=p.endB||t.input.lastAndroidDeletee.content.size?null:gu(t,e.resolve(n.anchor),e.resolve(n.head))}function p2(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let c=0;cc.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||Ia(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function m2(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o=o?s-r:0;s-=l,s&&s=a?s-r:0;s-=l,s&&s=56320&&e<=57343&&n>=55296&&n<=56319}class b2{constructor(e,n){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 Hb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(gd),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=hd(this),fd(this),this.nodeViews=pd(this),this.docView=Zc(this.state.doc,dd(this),Ra(this),this.dom,this),this.domObserver=new o2(this,(r,i,s,o)=>h2(this,r,i,s,o)),this.domObserver.start(),Bb(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Dl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(gd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Pp(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=pd(this);v2(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Dl(this),this.editable=hd(this),fd(this);let l=Ra(this),u=dd(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Ym(this);if(o){this.domObserver.stop();let h=d&&(dt||Xe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&y2(i.selection,e.selection);if(d){let p=Xe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Jb(this)),(s||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Zc(e.doc,u,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wb(this))?hn(this,h):(_p(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),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&Xm(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Q){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Fc(this,n.getBoundingClientRect(),e)}else Fc(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 n=0;n0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new $p(e.slice,e.move,i<0?void 0:Q.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ib(this,e)}coordsAtPos(e,n=1){return bp(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return ub(this,n||this.state,e)}pasteHTML(e,n){return Bi(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Bi(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Pb(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ra(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,$m())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $b(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?rt&&this.root.nodeType===11&&Zm(this.dom.ownerDocument)==this.dom&&l2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function dd(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ie.node(0,t.state.doc.content.size,e)]}function fd(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ie.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function hd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function y2(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function pd(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function v2(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function gd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Bn={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:"'"},lo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},x2=typeof navigator<"u"&&/Mac/.test(navigator.platform),w2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var je=0;je<10;je++)Bn[48+je]=Bn[96+je]=String(je);for(var je=1;je<=24;je++)Bn[je+111]="F"+je;for(var je=65;je<=90;je++)Bn[je]=String.fromCharCode(je+32),lo[je]=String.fromCharCode(je);for(var Ha in Bn)lo.hasOwnProperty(Ha)||(lo[Ha]=Bn[Ha]);function E2(t){var e=x2&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||w2&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?lo:Bn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const k2=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function C2(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a127)&&(s=Bn[r.keyCode])&&s!=i){let a=e[Ba(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const M2=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Zp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const A2=(t,e,n)=>{let r=Zp(t,n);if(!r)return!1;let i=Eu(r);if(!i){let o=r.blockRange(),a=o&&ai(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(Gp(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Jr(s,"end")||Q.isSelectable(s)))for(let o=r.depth;;o--){let a=Wo(t.doc,r.before(o),r.after(o),F.empty);if(a&&a.slice.size1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},T2=(t,e,n)=>{let r=Zp(t,n);if(!r)return!1;let i=Eu(r);return i?Kp(t,i,e):!1},O2=(t,e,n)=>{let r=Wp(t,n);if(!r)return!1;let i=ku(r);return i?Kp(t,i,e):!1};function Kp(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=Wo(t.doc,s,l,F.empty);if(!u||u.from!=s||u instanceof $e&&u.slice.size>=l-s)return!1;if(n){let c=t.tr.step(u);c.setSelection(Y.create(c.doc,s)),n(c.scrollIntoView())}return!0}function Jr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const N2=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Eu(r)}let o=s&&s.nodeBefore;return!o||!Q.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Q.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Eu(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Wp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=Wp(t,n);if(!r)return!1;let i=ku(r);if(!i)return!1;let s=i.nodeAfter;if(Gp(t,i,e,1))return!0;if(r.parent.content.size==0&&(Jr(s,"start")||Q.isSelectable(s))){let o=Wo(t.doc,r.before(),r.after(),F.empty);if(o&&o.slice.size{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Q,i;if(r){if(n.node.isTextblock||!$n(t.doc,n.from))return!1;i=n.from}else if(i=Ko(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Q.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},I2=(t,e)=>{let n=t.selection,r;if(n instanceof Q){if(n.node.isTextblock||!$n(t.doc,n.to))return!1;r=n.to}else if(r=Ko(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},H2=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&ai(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},B2=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` -`).scrollIntoView()),!0)};function jp(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=jp(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ee.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},F2=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ot||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=jp(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Ur(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&ai(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},V2=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(Q.create(t.doc,i))),!0)};function z2(t,e,n){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)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||$n(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Gp(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&z2(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=L.empty;for(let y=o.length-1;y>=0;y--)p=L.from(o[y].create(null,p));p=L.from(i.copy(p));let g=t.tr.step(new ze(e.pos-1,h,e.pos,h,new F(p,1,0),o.length,!0)),m=h+2*o.length;$n(g.doc,m)&&g.join(m),n(g.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&l?null:ee.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&ai(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(u&&Jr(s,"start",!0)&&Jr(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=L.empty;for(let x=p.length-1;x>=0;x--)y=L.from(p[x].copy(y));let v=t.tr.step(new ze(e.pos-p.length,e.pos+s.nodeSize,e.pos+m,e.pos+s.nodeSize-m,new F(y,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Jp(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(Y.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const U2=Jp(-1),q2=Jp(1);function Z2(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&cu(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function md(t,e=null){return function(n,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o=2&&i.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let c=n.doc.resolve(o.start-2);l=new eo(c,c,o.depth),o.endIndex=0;c--)s=L.from(n[c].type.create(n[c].attrs,s));t.step(new ze(e.start-(r?2:0),e.end,e.start,e.end,new F(s,0,0),n.length,!0));let o=0;for(let c=0;co.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?G2(e,n,t,s):J2(e,n,s):!0:!1}}function G2(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);sg;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(a?0:1),c+1,o.content.append(l?L.empty:L.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new ze(d-(a?1:0),f+(l?1:0),d+1,f-1,new F((a?L.empty:L.from(i.copy(L.empty))).append(l?L.empty:L.from(i.copy(L.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Y2(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);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!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=L.from(u?t.create():null),d=new F(L.from(t.create(null,L.from(a.type.create(null,c)))),u?3:1,0),f=s.start,h=s.end;n(e.tr.step(new ze(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Xo(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;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=n.selection,i=n.doc,s=n.storedMarks,n}}}class Qo{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>{const d=l(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,u=e||s.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const m=this.buildProps(u,n),y=h(...g)(m);return a.push(y),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,u])=>[l,(...c)=>u(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Xo({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}}let X2=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function q(t,e,n){return t.config[e]===void 0&&t.parent?q(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?q(t.parent,e,n):null}):t.config[e]}function ea(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Yp(t){const e=[],{nodeExtensions:n,markExtensions:r}=ea(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=q(o,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=q(o,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const f={...s,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:o.name,name:c,attribute:f})})}),e}function qe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function oe(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],u=a.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;l.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),a.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),r[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=s}),r},{})}function Rl(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>oe(n,r),{})}function Xp(t){return typeof t=="function"}function le(t,e=void 0,...n){return Xp(t)?e?t.bind(e)(...n):t(...n):t}function Q2(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ey(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function bd(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):ey(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function yd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Q2(n)?!1:n!=null))}function ty(t,e){var n;const r=Yp(t),{nodeExtensions:i,markExtensions:s}=ea(t),o=(n=i.find(u=>q(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((y,v)=>{const x=q(v,"extendNodeSchema",d);return{...y,...x?x(u):{}}},{}),h=yd({...f,content:le(q(u,"content",d)),marks:le(q(u,"marks",d)),group:le(q(u,"group",d)),inline:le(q(u,"inline",d)),atom:le(q(u,"atom",d)),selectable:le(q(u,"selectable",d)),draggable:le(q(u,"draggable",d)),code:le(q(u,"code",d)),whitespace:le(q(u,"whitespace",d)),defining:le(q(u,"defining",d)),isolating:le(q(u,"isolating",d)),attrs:Object.fromEntries(c.map(y=>{var v;return[y.name,{default:(v=y==null?void 0:y.attribute)===null||v===void 0?void 0:v.default}]}))}),p=le(q(u,"parseHTML",d));p&&(h.parseDOM=p.map(y=>bd(y,c)));const g=q(u,"renderHTML",d);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:Rl(y,c)}));const m=q(u,"renderText",d);return m&&(h.toText=m),[u.name,h]})),l=Object.fromEntries(s.map(u=>{const c=r.filter(m=>m.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((m,y)=>{const v=q(y,"extendMarkSchema",d);return{...m,...v?v(u):{}}},{}),h=yd({...f,inclusive:le(q(u,"inclusive",d)),excludes:le(q(u,"excludes",d)),group:le(q(u,"group",d)),spanning:le(q(u,"spanning",d)),code:le(q(u,"code",d)),attrs:Object.fromEntries(c.map(m=>{var y;return[m.name,{default:(y=m==null?void 0:m.attribute)===null||y===void 0?void 0:y.default}]}))}),p=le(q(u,"parseHTML",d));p&&(h.parseDOM=p.map(m=>bd(m,c)));const g=q(u,"renderHTML",d);return g&&(h.toDOM=m=>g({mark:m,HTMLAttributes:Rl(m,c)})),[u.name,h]}));return new lu({topNode:o,nodes:a,marks:l})}function Pa(t,e){return e.nodes[t]||e.marks[t]||null}function vd(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const ny=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function Cu(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class is{constructor(e){this.find=e.find,this.handler=e.handler}}const ry=(t,e)=>{if(Cu(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function vs(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=ny(u)+s;return o.forEach(f=>{if(c)return;const h=ry(d,f.find);if(!h)return;const p=l.state.tr,g=Xo({state:l.state,transaction:p}),m={from:r-(h[0].length-s.length),to:i},{commands:y,chain:v,can:x}=new Qo({editor:n,state:g});f.handler({state:g,range:m,match:h,commands:y,chain:v,can:x})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),c=!0)}),c}function iy(t){const{editor:e,rules:n}=t,r=new ve({state:{init(){return null},apply(i,s){const o=i.getMeta(r);if(o)return o;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:u,text:c}=a,d=u+c.length;vs({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return vs({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&vs({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?vs({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function sy(t){return typeof t=="number"}class oy{constructor(e){this.find=e.find,this.handler=e.handler}}const ay=(t,e,n)=>{if(Cu(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,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 ly(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Qo({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(r,p),m=Math.min(i,p+h.content.size),y=h.textBetween(g-p,m-p,void 0,"");ay(y,s.find,o).forEach(x=>{if(x.index===void 0)return;const b=g+x.index+1,k=b+x[0].length,w={from:n.tr.mapping.map(b),to:n.tr.mapping.map(k)},_=s.handler({state:n,range:w,match:x,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:a});d.push(_)})}),d.every(h=>h!==null)}const uy=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function cy(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const l=({state:c,from:d,to:f,rule:h,pasteEvt:p})=>{const g=c.tr,m=Xo({state:c,transaction:g});if(!(!ly({editor:e,state:m,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g};return n.map(c=>new ve({view(d){const f=h=>{var p;r=!((p=d.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(d,f)=>(s=r===d.dom.parentElement,a=f,!1),paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=f,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!i,m=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),v=!!y;if(!g&&!m&&!v)return;if(v){const{from:k,text:w}=y,_=k+w.length,N=uy(w);return l({rule:c,state:h,from:k,to:{b:_},pasteEvt:N})}const x=f.doc.content.findDiffStart(h.doc.content),b=f.doc.content.findDiffEnd(h.doc.content);if(!(!sy(x)||!b||x===b.b))return l({rule:c,state:h,from:x,to:b,pasteEvt:o})}}))}function dy(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Pr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Pr.resolve(e),this.schema=ty(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Pr.sort(Pr.flatten(e)),r=dy(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=q(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=q(r,"priority")||100,o=q(i,"priority")||100;return s>o?-1:s{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Pa(n.name,this.schema)},i=q(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Pr.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:Pa(o.name,this.schema)},l=[],u=q(o,"addKeyboardShortcuts",a);let c={};if(o.type==="mark"&&q(o,"exitable",a)&&(c.ArrowRight=()=>Te.handleExit({editor:e,mark:o})),u){const g=Object.fromEntries(Object.entries(u()).map(([m,y])=>[m,()=>y({editor:e})]));c={...c,...g}}const d=S2(c);l.push(d);const f=q(o,"addInputRules",a);vd(o,e.options.enableInputRules)&&f&&r.push(...f());const h=q(o,"addPasteRules",a);vd(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=q(o,"addProseMirrorPlugins",a);if(p){const g=p();l.push(...g)}return l}).flat();return[iy({editor:e,rules:r}),...cy({editor:e,rules:i}),...s]}get attributes(){return Yp(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ea(this.extensions);return Object.fromEntries(n.filter(r=>!!q(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:qe(r.name,this.schema)},o=q(r,"addNodeView",s);if(!o)return[];const a=(l,u,c,d,f)=>{const h=Rl(l,i);return o()({node:l,view:u,getPos:c,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Pa(e.name,this.schema)};e.type==="mark"&&(!((n=le(q(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=q(e,"onBeforeCreate",r),s=q(e,"onCreate",r),o=q(e,"onUpdate",r),a=q(e,"onSelectionUpdate",r),l=q(e,"onTransaction",r),u=q(e,"onFocus",r),c=q(e,"onBlur",r),d=q(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),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}}function fy(t){return Object.prototype.toString.call(t).slice(8,-1)}function xs(t){return fy(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ta(t,e){const n={...t};return xs(t)&&xs(e)&&Object.keys(e).forEach(r=>{xs(e[r])&&xs(t[r])?n[r]=ta(t[r],e[r]):n[r]=e[r]}),n}class me{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(q(this,"addOptions",{name:this.name}))),this.storage=le(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new me(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ta(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new me({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(q(n,"addOptions",{name:n.name})),n.storage=le(q(n,"addStorage",{name:n.name,options:n.options})),n}}function na(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=` +`);return{dom:l,text:f,slice:e}}function Ap(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return e?new F(L.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0):F.empty;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)a=d;else{let f=i.marks(),{schema:h}=t.state,p=yr.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=o.appendChild(document.createElement("p"));g&&m.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Lb(n),rs&&Db(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||nr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Tb.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Rb(nd(a,+c[1],+c[2]),c[4]);else if(a=F.maxOpen(Ob(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d{a=d(a,t)}),a}const Tb=/^(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 Ob(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&s.length&&Op(l,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=Np(o[o.length-1],s.length));let c=Tp(a,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return L.from(o)}return t}function Tp(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,L.from(t));return t}function Op(t,e,n,r,i){if(i1&&(s=0),i=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(L.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function nd(t,e,n){return en}).createHTML(t):t}function Lb(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Dp().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Lp[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"").reverse().join("")),n.innerHTML=Nb(t),i)for(let s=0;s=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=L.from(l.create(r[a+1],i)),s++,o++}return new F(i,s,o)}const it={},st={},Ib={touchstart:!0,touchmove:!0};class Hb{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Bb(t){for(let e in it){let n=it[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Fb(t,r)&&!mu(t,r)&&(t.editable||!(r.type in st))&&n(t,r)},Ib[e]?{passive:!0}:void 0)}rt&&t.dom.addEventListener("input",()=>null),Dl(t)}function Tn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Pb(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Dl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>mu(t,r))})}function mu(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Fb(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function $b(t,e){!mu(t,e)&&it[e.type]&&(t.editable||!(e.type in st))&&it[e.type](t,e)}st.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Ip(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(It&&Xe&&n.keyCode==13)))if(t.domObserver.selectionChanged(t.domSelectionRange())?t.domObserver.flush():n.keyCode!=229&&t.domObserver.forceFlush(),Jr&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Kn(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Ab(t,n)?n.preventDefault():Tn(t,"key")};st.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};st.keypress=(t,e)=>{let n=e;if(Ip(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Mt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Y)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode);!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i))&&t.dispatch(t.state.tr.insertText(i).scrollIntoView()),n.preventDefault()}};function Yo(t){return{left:t.clientX,top:t.clientY}}function Vb(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function bu(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Kr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function zb(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Q.isSelectable(r)?(Kr(t,new Q(n)),!0):!1}function Ub(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Q&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(Q.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Kr(t,Q.create(t.state.doc,i)),!0):!1}function qb(t,e,n,r,i){return bu(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Ub(t,n):zb(t,n))}function Zb(t,e,n,r){return bu(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Kb(t,e,n,r){return bu(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Wb(t,n,r)}function Wb(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Kr(t,Y.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)Kr(t,Y.create(r,a+1,a+1+o.content.size));else if(Q.isSelectable(o))Kr(t,Q.create(r,a));else continue;return!0}}function yu(t){return so(t)}const Rp=Mt?"metaKey":"ctrlKey";it.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=yu(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Vb(n,t.input.lastClick)&&!n[Rp]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s};let o=t.posAtCoords(Yo(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new jb(t,o,n,!!r)):(s=="doubleClick"?Zb:Kb)(t,o.pos,o.inside,n)?n.preventDefault():Tn(t,"pointer"))};class jb{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Rp],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:u}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof Q&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Bt&&!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)),Tn(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(()=>hn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Yo(e))),this.updateAllowDefault(e),this.allowDefault||!n?Tn(this.view,"pointer"):qb(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||rt&&this.mightDrag&&!this.mightDrag.node.isAtom||Xe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Kr(this.view,ee.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Tn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Tn(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)}}it.touchstart=t=>{t.input.lastTouch=Date.now(),yu(t),Tn(t,"pointer")};it.touchmove=t=>{t.input.lastTouch=Date.now(),Tn(t,"pointer")};it.contextmenu=t=>yu(t);function Ip(t,e){return t.composing?!0:rt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Gb=It?5e3:-1;st.compositionstart=st.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Y&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),so(t,!0),t.markCursor=null;else if(so(t,!e.selection.empty),Bt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.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=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Hp(t,Gb)};st.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Hp(t,20))};function Hp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>so(t),e))}function Bp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Yb());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Jb(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=zm(e.focusNode,e.focusOffset),r=Um(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Yb(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function so(t,e=!1){if(!(It&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bp(t),e||t.docView&&t.docView.dirty){let n=pu(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Xb(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Bi=dt&&Rn<15||Jr&&jm<604;it.copy=st.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Bi?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Mp(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):Xb(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Qb(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function e2(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Pi(t,r.value,null,i,e):Pi(t,r.textContent,r.innerHTML,i,e)},50)}function Pi(t,e,n,r,i){let s=Ap(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||F.empty)))return!0;if(!s)return!1;let o=Qb(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Pp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}st.paste=(t,e)=>{let n=e;if(t.composing&&!It)return;let r=Bi?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Pi(t,Pp(r),r.getData("text/html"),i,n)?n.preventDefault():e2(t,n)};class Fp{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const $p=Mt?"altKey":"ctrlKey";it.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Yo(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Q?i.to-1:i.to))){if(r&&r.mightDrag)o=Q.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=Q.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:u,slice:c}=Mp(t,a);(!n.dataTransfer.files.length||!Xe||dp>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Bi?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Bi||n.dataTransfer.setData("text/plain",u),t.dragging=new Fp(c,!n[$p],o)};it.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};st.dragover=st.dragenter=(t,e)=>e.preventDefault();st.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords(Yo(n));if(!i)return;let s=t.state.doc.resolve(i.pos),o=r&&r.slice;o?t.someProp("transformPasted",p=>{o=p(o,t)}):o=Ap(t,Pp(n.dataTransfer),Bi?null:n.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&!n[$p]);if(t.someProp("handleDrop",p=>p(t,n,o||F.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?np(t.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let u=t.state.tr;if(a){let{node:p}=r;p?p.replace(u):u.deleteSelection()}let c=u.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=u.doc;if(d?u.replaceRangeWith(c,c,o.content.firstChild):u.replaceRange(c,c,o),u.doc.eq(f))return;let h=u.doc.resolve(c);if(d&&Q.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new Q(h));else{let p=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((g,m,y,v)=>p=v),u.setSelection(gu(t,h,u.doc.resolve(p)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};it.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&hn(t)},20))};it.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};it.beforeinput=(t,e)=>{if(Xe&&It&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Kn(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in st)it[t]=st[t];function Fi(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class oo{constructor(e,n){this.toDOM=e,this.spec=n||rr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new Ie(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof oo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Fi(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Hn{constructor(e,n){this.attrs=e,this.spec=n||rr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ie(s,o,this)}valid(e,n){return n.from=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;oe){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==Ye||e.maps.length==0?this:this.mapInner(e,n,0,0,r||rr)}mapInner(e,n,r,i,s){let o;for(let a=0;a{let u=l+r,c;if(c=zp(n,a,u)){for(i||(i=this.children.slice());sa&&d.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;as&&l.type instanceof Hn){let u=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;ui.map(e,n,rr));return kn.from(r)}forChild(e,n){if(n.isLeaf)return ye.empty;let r=[];for(let i=0;in instanceof ye)?e:e.reduce((n,r)=>n.concat(r instanceof ye?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let m=g-p-(h-f);for(let y=0;yv+c-d)continue;let x=a[y]+c-d;h>=x?a[y+1]=f<=x?-2:-1:f>=c&&m&&(a[y]+=m,a[y+1]+=m)}d+=m}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u=r.content.size){l=!0;continue}let f=n.map(t[u+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),m=r.maybeChild(p);if(m&&g==d&&g+m.nodeSize==h){let y=a[u+2].mapInner(n,m,c+1,t[u]+s+1,o);y!=Ye?(a[u]=d,a[u+1]=h,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=n2(a,t,e,n,i,s,o),c=ao(u,r,0,o);e=c.local;for(let d=0;dn&&o.to{let u=zp(t,a,l+n);if(u){s=!0;let c=ao(u,a,n+l+1,r);c!=Ye&&i.push(l,l+a.nodeSize,c)}});let o=Vp(s?Up(t):t,-n).sort(ir);for(let a=0;a0;)e++;t.splice(e,0,n)}function Ra(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ye&&e.push(r)}),t.cursorWrapper&&e.push(ye.create(t.state.doc,[t.cursorWrapper.deco])),kn.from(e)}const r2={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},i2=dt&&Rn<=11;class s2{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 o2{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new s2,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),i2&&(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,r2)),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 n=0;nthis.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(Jc(this.view)){if(this.suppressingSelectionUpdates)return hn(this.view);if(dt&&Rn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&cr(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 n=new Set,r;for(let s=e.focusNode;s;s=Hi(s))n.add(s);for(let s=e.anchorNode;s;s=Hi(s))if(n.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}selectionChanged(e){return!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&Jc(this.view)&&!this.ignoreSelectionChange(e)}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=this.selectionChanged(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let c=0;cd.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||u2(e,d)!=h)&&f.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),a2(e)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||hn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.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 c=0;ci;m--){let y=r.childNodes[m-1],v=y.pmViewDesc;if(y.nodeName=="BR"&&!v){s=m;break}if(!v||v.size)break}let d=t.state.doc,f=t.someProp("domParser")||nr.fromSchema(t.state.schema),h=d.resolve(o),p=null,g=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:d2,context:h});if(u&&u[0].pos!=null){let m=u[0].pos,y=u[1]&&u[1].pos;y==null&&(y=m),p={anchor:m+o,head:y+o}}return{doc:g,sel:p,from:o,to:a}}function d2(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(rt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||rt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const f2=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function h2(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let M=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=pu(t,M);if(I&&!t.state.selection.eq(I)){if(Xe&&It&&t.input.lastKeyCode===13&&Date.now()-100K(t,Kn(13,"Enter"))))return;let $=t.state.tr.setSelection(I);M=="pointer"?$.setMeta("pointer",!0):M=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),t.dispatch($)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=c2(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),f,h;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||It)&&i.some(M=>M.nodeType==1&&!f2.test(M.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",M=>M(t,Kn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof Y&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let M=ld(t,t.state.doc,u.sel);if(M&&!M.eq(t.state.selection)){let I=t.state.tr.setSelection(M);s&&I.setMeta("composition",s),t.dispatch(I)}}return}t.state.selection.fromt.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),dt&&Rn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=u.doc.resolveNoCache(p.start-u.from),m=u.doc.resolveNoCache(p.endB-u.from),y=c.resolve(p.start),v=g.sameParent(m)&&g.parent.inlineContent&&y.end()>=p.endA,x;if((Jr&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!v&&g.posM(t,Kn(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&g2(c,p.start,p.endA,g,m)&&t.someProp("handleKeyDown",M=>M(t,Kn(8,"Backspace")))){It&&Xe&&t.domObserver.suppressSelectionUpdates();return}Xe&&It&&p.endB==p.start&&(t.input.lastAndroidDelete=Date.now()),It&&!v&&g.start()!=m.start()&&m.parentOffset==0&&g.depth==m.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,m=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(M){return M(t,Kn(13,"Enter"))})},20));let b=p.start,k=p.endA,w,_,N;if(v){if(g.pos==m.pos)dt&&Rn<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>hn(t),20)),w=t.state.tr.delete(b,k),_=c.resolve(p.start).marksAcross(c.resolve(p.endA));else if(p.endA==p.endB&&(N=p2(g.parent.content.cut(g.parentOffset,m.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))w=t.state.tr,N.type=="add"?w.addMark(b,k,N.mark):w.removeMark(b,k,N.mark);else if(g.parent.child(g.index()).isText&&g.index()==m.index()-(m.textOffset?0:1)){let M=g.parent.textBetween(g.parentOffset,m.parentOffset);if(t.someProp("handleTextInput",I=>I(t,b,k,M)))return;w=t.state.tr.insertText(M,b,k)}}if(w||(w=t.state.tr.replace(b,k,u.doc.slice(p.start-u.from,p.endB-u.from))),u.sel){let M=ld(t,w.doc,u.sel);M&&!(Xe&&It&&t.composing&&M.empty&&(p.start!=p.endB||t.input.lastAndroidDeletee.content.size?null:gu(t,e.resolve(n.anchor),e.resolve(n.head))}function p2(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let c=0;cc.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||Ia(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function m2(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let l=Math.max(0,s-Math.min(o,a));r-=o+l-s}if(o=o?s-r:0;s-=l,s&&s=a?s-r:0;s-=l,s&&s=56320&&e<=57343&&n>=55296&&n<=56319}class b2{constructor(e,n){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 Hb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(pd),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=fd(this),dd(this),this.nodeViews=hd(this),this.docView=qc(this.state.doc,cd(this),Ra(this),this.dom,this),this.domObserver=new o2(this,(r,i,s,o)=>h2(this,r,i,s,o)),this.domObserver.start(),Bb(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Dl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(pd),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Bp(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=hd(this);v2(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Dl(this),this.editable=fd(this),dd(this);let l=Ra(this),u=cd(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Ym(this);if(o){this.domObserver.stop();let h=d&&(dt||Xe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&y2(i.selection,e.selection);if(d){let p=Xe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Jb(this)),(s||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=qc(e.doc,u,l,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wb(this))?hn(this,h):(Cp(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),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&Xm(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Q){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Pc(this,n.getBoundingClientRect(),e)}else Pc(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 n=0;n0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Fp(e.slice,e.move,i<0?void 0:Q.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ib(this,e)}coordsAtPos(e,n=1){return mp(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return ub(this,n||this.state,e)}pasteHTML(e,n){return Pi(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Pi(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Pb(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ra(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,$m())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $b(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?rt&&this.root.nodeType===11&&Zm(this.dom.ownerDocument)==this.dom&&l2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function cd(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ie.node(0,t.state.doc.content.size,e)]}function dd(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ie.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function fd(t){return!t.someProp("editable",e=>e(t.state)===!1)}function y2(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function hd(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function v2(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function pd(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Bn={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:"'"},lo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},x2=typeof navigator<"u"&&/Mac/.test(navigator.platform),w2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var je=0;je<10;je++)Bn[48+je]=Bn[96+je]=String(je);for(var je=1;je<=24;je++)Bn[je+111]="F"+je;for(var je=65;je<=90;je++)Bn[je]=String.fromCharCode(je+32),lo[je]=String.fromCharCode(je);for(var Ha in Bn)lo.hasOwnProperty(Ha)||(lo[Ha]=Bn[Ha]);function E2(t){var e=x2&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||w2&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?lo:Bn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const k2=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function C2(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a127)&&(s=Bn[r.keyCode])&&s!=i){let a=e[Ba(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const M2=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function qp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const A2=(t,e,n)=>{let r=qp(t,n);if(!r)return!1;let i=Eu(r);if(!i){let o=r.blockRange(),a=o&&li(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(jp(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Yr(s,"end")||Q.isSelectable(s)))for(let o=r.depth;;o--){let a=Wo(t.doc,r.before(o),r.after(o),F.empty);if(a&&a.slice.size1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},T2=(t,e,n)=>{let r=qp(t,n);if(!r)return!1;let i=Eu(r);return i?Zp(t,i,e):!1},O2=(t,e,n)=>{let r=Kp(t,n);if(!r)return!1;let i=ku(r);return i?Zp(t,i,e):!1};function Zp(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=Wo(t.doc,s,l,F.empty);if(!u||u.from!=s||u instanceof $e&&u.slice.size>=l-s)return!1;if(n){let c=t.tr.step(u);c.setSelection(Y.create(c.doc,s)),n(c.scrollIntoView())}return!0}function Yr(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const N2=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=Eu(r)}let o=s&&s.nodeBefore;return!o||!Q.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Q.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Eu(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Kp(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=Kp(t,n);if(!r)return!1;let i=ku(r);if(!i)return!1;let s=i.nodeAfter;if(jp(t,i,e,1))return!0;if(r.parent.content.size==0&&(Yr(s,"start")||Q.isSelectable(s))){let o=Wo(t.doc,r.before(),r.after(),F.empty);if(o&&o.slice.size{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Q,i;if(r){if(n.node.isTextblock||!$n(t.doc,n.from))return!1;i=n.from}else if(i=Ko(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Q.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},I2=(t,e)=>{let n=t.selection,r;if(n instanceof Q){if(n.node.isTextblock||!$n(t.doc,n.to))return!1;r=n.to}else if(r=Ko(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},H2=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&li(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},B2=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function Wp(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Wp(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ee.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},F2=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Ot||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Wp(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(qr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&li(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},V2=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(Q.create(t.doc,i))),!0)};function z2(t,e,n){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)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||$n(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function jp(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&z2(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=L.empty;for(let y=o.length-1;y>=0;y--)p=L.from(o[y].create(null,p));p=L.from(i.copy(p));let g=t.tr.step(new ze(e.pos-1,h,e.pos,h,new F(p,1,0),o.length,!0)),m=h+2*o.length;$n(g.doc,m)&&g.join(m),n(g.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&l?null:ee.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&li(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(u&&Yr(s,"start",!0)&&Yr(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,m=1;for(;!g.isTextblock;g=g.firstChild)m++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=L.empty;for(let x=p.length-1;x>=0;x--)y=L.from(p[x].copy(y));let v=t.tr.step(new ze(e.pos-p.length,e.pos+s.nodeSize,e.pos+m,e.pos+s.nodeSize-m,new F(y,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Gp(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(Y.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const U2=Gp(-1),q2=Gp(1);function Z2(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&cu(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function gd(t,e=null){return function(n,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o=2&&i.node(o.depth-1).type.compatibleContent(t)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let c=n.doc.resolve(o.start-2);l=new eo(c,c,o.depth),o.endIndex=0;c--)s=L.from(n[c].type.create(n[c].attrs,s));t.step(new ze(e.start-(r?2:0),e.end,e.start,e.end,new F(s,0,0),n.length,!0));let o=0;for(let c=0;co.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?G2(e,n,t,s):J2(e,n,s):!0:!1}}function G2(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);sg;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(a?0:1),c+1,o.content.append(l?L.empty:L.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new ze(d-(a?1:0),f+(l?1:0),d+1,f-1,new F((a?L.empty:L.from(i.copy(L.empty))).append(l?L.empty:L.from(i.copy(L.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Y2(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);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!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=L.from(u?t.create():null),d=new F(L.from(t.create(null,L.from(a.type.create(null,c)))),u?3:1,0),f=s.start,h=s.end;n(e.tr.step(new ze(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}function Xo(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;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=n.selection,i=n.doc,s=n.storedMarks,n}}}class Qo{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>{const d=l(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,u=e||s.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const m=this.buildProps(u,n),y=h(...g)(m);return a.push(y),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([l,u])=>[l,(...c)=>u(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Xo({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}}let X2=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function q(t,e,n){return t.config[e]===void 0&&t.parent?q(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?q(t.parent,e,n):null}):t.config[e]}function ea(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Jp(t){const e=[],{nodeExtensions:n,markExtensions:r}=ea(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},l=q(o,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...s,...h}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=q(o,"addAttributes",a);if(!l)return;const u=l();Object.entries(u).forEach(([c,d])=>{const f={...s,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:o.name,name:c,attribute:f})})}),e}function qe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function oe(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?s.split(" "):[],l=r[i]?r[i].split(" "):[],u=a.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;l.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),a.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),r[i]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=s}),r},{})}function Rl(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>oe(n,r),{})}function Yp(t){return typeof t=="function"}function le(t,e=void 0,...n){return Yp(t)?e?t.bind(e)(...n):t(...n):t}function Q2(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ey(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function md(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):ey(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function bd(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Q2(n)?!1:n!=null))}function ty(t,e){var n;const r=Jp(t),{nodeExtensions:i,markExtensions:s}=ea(t),o=(n=i.find(u=>q(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((y,v)=>{const x=q(v,"extendNodeSchema",d);return{...y,...x?x(u):{}}},{}),h=bd({...f,content:le(q(u,"content",d)),marks:le(q(u,"marks",d)),group:le(q(u,"group",d)),inline:le(q(u,"inline",d)),atom:le(q(u,"atom",d)),selectable:le(q(u,"selectable",d)),draggable:le(q(u,"draggable",d)),code:le(q(u,"code",d)),whitespace:le(q(u,"whitespace",d)),defining:le(q(u,"defining",d)),isolating:le(q(u,"isolating",d)),attrs:Object.fromEntries(c.map(y=>{var v;return[y.name,{default:(v=y==null?void 0:y.attribute)===null||v===void 0?void 0:v.default}]}))}),p=le(q(u,"parseHTML",d));p&&(h.parseDOM=p.map(y=>md(y,c)));const g=q(u,"renderHTML",d);g&&(h.toDOM=y=>g({node:y,HTMLAttributes:Rl(y,c)}));const m=q(u,"renderText",d);return m&&(h.toText=m),[u.name,h]})),l=Object.fromEntries(s.map(u=>{const c=r.filter(m=>m.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((m,y)=>{const v=q(y,"extendMarkSchema",d);return{...m,...v?v(u):{}}},{}),h=bd({...f,inclusive:le(q(u,"inclusive",d)),excludes:le(q(u,"excludes",d)),group:le(q(u,"group",d)),spanning:le(q(u,"spanning",d)),code:le(q(u,"code",d)),attrs:Object.fromEntries(c.map(m=>{var y;return[m.name,{default:(y=m==null?void 0:m.attribute)===null||y===void 0?void 0:y.default}]}))}),p=le(q(u,"parseHTML",d));p&&(h.parseDOM=p.map(m=>md(m,c)));const g=q(u,"renderHTML",d);return g&&(h.toDOM=m=>g({mark:m,HTMLAttributes:Rl(m,c)})),[u.name,h]}));return new lu({topNode:o,nodes:a,marks:l})}function Pa(t,e){return e.nodes[t]||e.marks[t]||null}function yd(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}const ny=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,u;const c=((u=(l=i.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function Cu(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class ss{constructor(e){this.find=e.find,this.handler=e.handler}}const ry=(t,e)=>{if(Cu(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function vs(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=ny(u)+s;return o.forEach(f=>{if(c)return;const h=ry(d,f.find);if(!h)return;const p=l.state.tr,g=Xo({state:l.state,transaction:p}),m={from:r-(h[0].length-s.length),to:i},{commands:y,chain:v,can:x}=new Qo({editor:n,state:g});f.handler({state:g,range:m,match:h,commands:y,chain:v,can:x})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),l.dispatch(p),c=!0)}),c}function iy(t){const{editor:e,rules:n}=t,r=new be({state:{init(){return null},apply(i,s){const o=i.getMeta(r);if(o)return o;const a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{const{from:u,text:c}=a,d=u+c.length;vs({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return vs({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&vs({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?vs({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function sy(t){return typeof t=="number"}class oy{constructor(e){this.find=e.find,this.handler=e.handler}}const ay=(t,e,n)=>{if(Cu(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,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 ly(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Qo({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(r,p),m=Math.min(i,p+h.content.size),y=h.textBetween(g-p,m-p,void 0,"");ay(y,s.find,o).forEach(x=>{if(x.index===void 0)return;const b=g+x.index+1,k=b+x[0].length,w={from:n.tr.mapping.map(b),to:n.tr.mapping.map(k)},_=s.handler({state:n,range:w,match:x,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:a});d.push(_)})}),d.every(h=>h!==null)}const uy=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function cy(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null;const l=({state:c,from:d,to:f,rule:h,pasteEvt:p})=>{const g=c.tr,m=Xo({state:c,transaction:g});if(!(!ly({editor:e,state:m,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:a})||!g.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g};return n.map(c=>new be({view(d){const f=h=>{var p;r=!((p=d.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(d,f)=>(s=r===d.dom.parentElement,a=f,!1),paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=f,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],g=p.getMeta("uiEvent")==="paste"&&!i,m=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),v=!!y;if(!g&&!m&&!v)return;if(v){const{from:k,text:w}=y,_=k+w.length,N=uy(w);return l({rule:c,state:h,from:k,to:{b:_},pasteEvt:N})}const x=f.doc.content.findDiffStart(h.doc.content),b=f.doc.content.findDiffEnd(h.doc.content);if(!(!sy(x)||!b||x===b.b))return l({rule:c,state:h,from:x,to:b,pasteEvt:o})}}))}function dy(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Fr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Fr.resolve(e),this.schema=ty(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Fr.sort(Fr.flatten(e)),r=dy(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=q(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=q(r,"priority")||100,o=q(i,"priority")||100;return s>o?-1:s{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Pa(n.name,this.schema)},i=q(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Fr.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:Pa(o.name,this.schema)},l=[],u=q(o,"addKeyboardShortcuts",a);let c={};if(o.type==="mark"&&q(o,"exitable",a)&&(c.ArrowRight=()=>Te.handleExit({editor:e,mark:o})),u){const g=Object.fromEntries(Object.entries(u()).map(([m,y])=>[m,()=>y({editor:e})]));c={...c,...g}}const d=S2(c);l.push(d);const f=q(o,"addInputRules",a);yd(o,e.options.enableInputRules)&&f&&r.push(...f());const h=q(o,"addPasteRules",a);yd(o,e.options.enablePasteRules)&&h&&i.push(...h());const p=q(o,"addProseMirrorPlugins",a);if(p){const g=p();l.push(...g)}return l}).flat();return[iy({editor:e,rules:r}),...cy({editor:e,rules:i}),...s]}get attributes(){return Jp(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=ea(this.extensions);return Object.fromEntries(n.filter(r=>!!q(r,"addNodeView")).map(r=>{const i=this.attributes.filter(l=>l.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:qe(r.name,this.schema)},o=q(r,"addNodeView",s);if(!o)return[];const a=(l,u,c,d,f)=>{const h=Rl(l,i);return o()({node:l,view:u,getPos:c,decorations:d,innerDecorations:f,editor:e,extension:r,HTMLAttributes:h})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Pa(e.name,this.schema)};e.type==="mark"&&(!((n=le(q(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=q(e,"onBeforeCreate",r),s=q(e,"onCreate",r),o=q(e,"onUpdate",r),a=q(e,"onSelectionUpdate",r),l=q(e,"onTransaction",r),u=q(e,"onFocus",r),c=q(e,"onBlur",r),d=q(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),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}}function fy(t){return Object.prototype.toString.call(t).slice(8,-1)}function xs(t){return fy(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ta(t,e){const n={...t};return xs(t)&&xs(e)&&Object.keys(e).forEach(r=>{xs(e[r])&&xs(t[r])?n[r]=ta(t[r],e[r]):n[r]=e[r]}),n}class me{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(q(this,"addOptions",{name:this.name}))),this.storage=le(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new me(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ta(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new me({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(q(n,"addOptions",{name:n.name})),n.storage=le(q(n,"addStorage",{name:n.name,options:n.options})),n}}function na(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=` -`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,u,c,d)=>{var f;l.isBlock&&u>r&&(a+=s);const h=o==null?void 0:o[l.type.name];if(h)return c&&(a+=h({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(f=l==null?void 0:l.text)===null||f===void 0?void 0:f.slice(Math.max(r,u)-u,i-u))}),a}function Qp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const e0=me.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ve({key:new Ce("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),l=Qp(n);return na(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),hy=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),py=(t=!1)=>({commands:e})=>e.setContent("",t),gy=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),f=u.resolve(c.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=ai(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},my=t=>e=>t(e),by=()=>({state:t,dispatch:e})=>F2(t,e),yy=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new Y(r.doc.resolve(o-1))),!0},vy=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.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);t.delete(a,l).scrollIntoView()}return!0}return!1},xy=t=>({tr:e,state:n,dispatch:r})=>{const i=qe(t,n.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),u=s.after(o);e.delete(l,u).scrollIntoView()}return!0}return!1},wy=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},Ey=()=>({state:t,dispatch:e})=>M2(t,e),ky=()=>({commands:t})=>t.keyboardShortcut("Enter"),Cy=()=>({state:t,dispatch:e})=>P2(t,e);function Yr(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Cu(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Il(t,e,n={}){return t.find(r=>r.type===e&&Yr(r.attrs,n))}function _y(t,e,n={}){return!!Il(t,e,n)}function _u(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const i=Il([...r.node.marks],e,n);if(!i)return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(Il([...r.node.marks],e,n);s>0&&i.isInSet(t.parent.child(s-1).marks);)s-=1,o-=t.parent.child(s).nodeSize;for(;a({tr:n,state:r,dispatch:i})=>{const s=mn(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=_u(l,s,e);if(d&&d.from<=u&&d.to>=c){const f=Y.create(o,d.from,d.to);n.setSelection(f)}}return!0},My=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{Mu()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!Su(n.state.selection))return o(),!0;const a=t0(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Ty=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Oy=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),n0=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&n0(r)}return t};function ws(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return n0(n)}function uo(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return L.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),uo("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new lu({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:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?nr.fromSchema(l).parseSlice(ws(t),n.parseOptions):nr.fromSchema(l).parse(ws(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=nr.fromSchema(e);return n.slice?s.parseSlice(ws(t),n.parseOptions).content:s.parse(ws(t),n.parseOptions)}return uo("",e,n)}function Ny(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=c)}),t.setSelection(ee.near(t.doc.resolve(o),n))}const Ly=t=>!("type"in t),Dy=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=uo(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(p){return s.emit("contentError",{editor:s,error:p,disableCollaboration:()=>{console.error("[tiptap error]: Unable to disable collaboration at this point in time")}}),!1}let{from:l,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,d=!0;if((Ly(a)?a:[a]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),l===u&&d){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,u+=1)}let h;c?(Array.isArray(e)?h=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?h=e.text:h=e,r.insertText(h,l,u)):(h=a,r.replaceWith(l,u,h)),n.updateSelection&&Ny(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:h})}return!0},Ry=()=>({state:t,dispatch:e})=>R2(t,e),Iy=()=>({state:t,dispatch:e})=>I2(t,e),Hy=()=>({state:t,dispatch:e})=>A2(t,e),By=()=>({state:t,dispatch:e})=>L2(t,e),Py=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ko(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Fy=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ko(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$y=()=>({state:t,dispatch:e})=>T2(t,e),Vy=()=>({state:t,dispatch:e})=>O2(t,e);function r0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function zy(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a({editor:e,view:n,tr:r,dispatch:i})=>{const s=zy(t).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),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(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l==null||l.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function fr(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?qe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=i-r,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Yr(d.node.attrs,n,{strict:!1}));return s?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=l}const qy=(t,e={})=>({state:n,dispatch:r})=>{const i=qe(t,n.schema);return fr(n,i,e)?H2(n,r):!1},Zy=()=>({state:t,dispatch:e})=>$2(t,e),Ky=t=>({state:e,dispatch:n})=>{const r=qe(t,e.schema);return j2(r)(e,n)},Wy=()=>({state:t,dispatch:e})=>B2(t,e);function ra(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function xd(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const jy=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ra(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=qe(t,r.schema)),a==="mark"&&(o=mn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{s&&s===u.type&&n.setNodeMarkup(c,void 0,xd(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(d=>{o===d.type&&n.addMark(c,c+u.nodeSize,o.create(xd(d.attrs,e)))})})}),!0):!1},Gy=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Jy=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),Yy=()=>({state:t,dispatch:e})=>N2(t,e),Xy=()=>({state:t,dispatch:e})=>D2(t,e),Qy=()=>({state:t,dispatch:e})=>V2(t,e),e3=()=>({state:t,dispatch:e})=>q2(t,e),t3=()=>({state:t,dispatch:e})=>U2(t,e);function Hl(t,e,n={},r={}){return uo(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const n3=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var l,u;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const d=Hl(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function ss(t,e){const n=mn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function r3(t,e){const n=new du(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function i3(t){for(let e=0;e{e(r)&&n.push({node:r,pos:i})}),n}function s3(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function i0(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ia(t){return e=>i0(e.$from,t)}function Au(t,e){const n=br.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function o3(t,e){const n={from:0,to:t.content.size};return na(t,n,e)}function a3(t,e){const n=qe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function s0(t,e){const n=ra(typeof e=="string"?e:e.name,t.schema);return n==="node"?a3(t,e):n==="mark"?ss(t,e):{}}function l3(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function u3(t){const e=l3(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function c3(t){const{mapping:e,steps:n}=t,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}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(s).map(a,-1),c=e.slice(s).map(l),d=e.invert().map(u,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),u3(r)}function Tu(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=_u(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,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}function qs(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Pl(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?mn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Yr(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(g,m)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(h,m),v=Math.min(p,m+g.nodeSize),x=v-y;o+=x,a.push(...g.marks.map(b=>({mark:b,from:y,to:v})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Yr(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+u:l)>=o}function d3(t,e,n={}){if(!e)return fr(t,null,n)||Pl(t,null,n);const r=ra(e,t.schema);return r==="node"?fr(t,e,n):r==="mark"?Pl(t,e,n):!1}function wd(t,e){const{nodeExtensions:n}=ea(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=le(q(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function sa(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(sa(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function Ou(t){return t instanceof Q}function as(t,e,n){const i=t.state.doc.content.size,s=fn(e,0,i),o=fn(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,p=c-u,y={top:u,bottom:c,left:d,right:f,width:h,height:p,x:d,y:u};return{...y,toJSON:()=>y}}function f3(t,e,n){var r;const{selection:i}=e;let s=null;if(Su(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=h&&p}return!u}),u})}const h3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=mn(t,r.schema);if(i)if(o){const u=ss(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,h)=>{const p=Math.max(h,c),g=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(p,g,l.create({...y.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return f3(r,n,l)},p3=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),g3=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=qe(t,n.schema);return s.isTextblock?i().command(({commands:o})=>md(s,e)(n)?!0:o.clearNodes()).command(({state:o})=>md(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},m3=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=fn(t,0,r.content.size),s=Q.create(r,i);e.setSelection(s)}return!0},b3=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=Y.atStart(r).from,a=Y.atEnd(r).to,l=fn(i,o,a),u=fn(s,o,a),c=Y.create(r,l,u);e.setSelection(c)}return!0},y3=t=>({state:e,dispatch:n})=>{const r=qe(t,e.schema);return Y2(r)(e,n)};function Ed(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const v3=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,u=i.extensionManager.attributes,c=qs(u,a.node().type.name,a.node().attrs);if(s instanceof Q&&s.node.isBlock)return!a.parentOffset||!Ur(o,a.pos)?!1:(r&&(t&&Ed(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:i3(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,p=Ur(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&Ur(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:c}]:void 0),r){if(p&&(s instanceof Y&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&Ed(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},x3=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=qe(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.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 y=L.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let N=l.depth-v;N>=l.depth-3;N-=1)y=L.from(l.node(N).copy(y));const x=l.indexAfter(-1){if(_>-1)return!1;N.isTextblock&&N.content.size===0&&(_=M+1)}),_>-1&&n.setSelection(Y.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const h=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...qs(f,d.type.name,d.attrs),...e},g={...qs(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const m=h?[{type:a,attrs:p},{type:h,attrs:g}]:[{type:a,attrs:p}];if(!Ur(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:v}=r,{splittableMarks:x}=s.extensionManager,b=v||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,m).scrollIntoView(),!b||!i)return!0;const k=b.filter(w=>x.includes(w.type.name));n.ensureMarks(k)}return!0},Fa=(t,e)=>{const n=ia(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&$n(t.doc,n.pos)&&t.join(n.pos),!0},$a=(t,e)=>{const n=ia(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&$n(t.doc,r)&&t.join(r),!0},w3=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=qe(t,o.schema),p=qe(e,o.schema),{selection:g,storedMarks:m}=o,{$from:y,$to:v}=g,x=y.blockRange(v),b=m||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const k=ia(w=>wd(w.type.name,d))(g);if(x.depth>=1&&k&&x.depth-k.depth<=1){if(k.node.type===h)return u.liftListItem(p);if(wd(k.node.type.name,d)&&h.validContent(k.node.content)&&a)return l().command(()=>(s.setNodeMarkup(k.pos,h),!0)).command(()=>Fa(s,h)).command(()=>$a(s,h)).run()}return!n||!b||!a?l().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>Fa(s,h)).command(()=>$a(s,h)).run():l().command(()=>{const w=c().wrapInList(h,r),_=b.filter(N=>f.includes(N.type.name));return s.ensureMarks(_),w?!0:u.clearNodes()}).wrapInList(h,r).command(()=>Fa(s,h)).command(()=>$a(s,h)).run()},E3=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=mn(t,r.schema);return Pl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},k3=(t,e,n={})=>({state:r,commands:i})=>{const s=qe(t,r.schema),o=qe(e,r.schema),a=fr(r,s,n);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,...n})},C3=(t,e={})=>({state:n,commands:r})=>{const i=qe(t,n.schema);return fr(n,i,e)?r.lift(i):r.wrapIn(i,e)},_3=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},S3=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},M3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=mn(t,r.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:f,to:h}=a;const p=(s=u.marks().find(m=>m.type===l))===null||s===void 0?void 0:s.attrs,g=_u(u,l,p);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},A3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ra(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=qe(t,r.schema)),a==="mark"&&(o=mn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const u=l.$from.pos,c=l.$to.pos;r.doc.nodesBetween(u,c,(d,f)=>{s&&s===d.type&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(h=>{if(o===h.type){const p=Math.max(f,u),g=Math.min(f+d.nodeSize,c);n.addMark(p,g,o.create({...h.attrs,...e}))}})})}),!0):!1},T3=(t,e={})=>({state:n,dispatch:r})=>{const i=qe(t,n.schema);return Z2(i,e)(n,r)},O3=(t,e={})=>({state:n,dispatch:r})=>{const i=qe(t,n.schema);return K2(i,e)(n,r)};var N3=Object.freeze({__proto__:null,blur:hy,clearContent:py,clearNodes:gy,command:my,createParagraphNear:by,cut:yy,deleteCurrentNode:vy,deleteNode:xy,deleteRange:wy,deleteSelection:Ey,enter:ky,exitCode:Cy,extendMarkRange:Sy,first:My,focus:Ay,forEach:Ty,insertContent:Oy,insertContentAt:Dy,joinBackward:Hy,joinDown:Iy,joinForward:By,joinItemBackward:Py,joinItemForward:Fy,joinTextblockBackward:$y,joinTextblockForward:Vy,joinUp:Ry,keyboardShortcut:Uy,lift:qy,liftEmptyBlock:Zy,liftListItem:Ky,newlineInCode:Wy,resetAttributes:jy,scrollIntoView:Gy,selectAll:Jy,selectNodeBackward:Yy,selectNodeForward:Xy,selectParentNode:Qy,selectTextblockEnd:e3,selectTextblockStart:t3,setContent:n3,setMark:h3,setMeta:p3,setNode:g3,setNodeSelection:m3,setTextSelection:b3,sinkListItem:y3,splitBlock:v3,splitListItem:x3,toggleList:w3,toggleMark:E3,toggleNode:k3,toggleWrap:C3,undoInputRule:_3,unsetAllMarks:S3,unsetMark:M3,updateAttributes:A3,wrapIn:T3,wrapInList:O3});const o0=me.create({name:"commands",addCommands(){return{...N3}}}),a0=me.create({name:"editable",addProseMirrorPlugins(){return[new ve({key:new Ce("editable"),props:{editable:()=>this.editor.options.editable}})]}}),l0=me.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new ve({key:new Ce("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),u0=me.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:ee.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!y||y&&d.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:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"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 Mu()||r0()?s:i},addProseMirrorPlugins(){return[new ve({key:new Ce("clearDocument"),appendTransaction:(t,e,n)=>{const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=ee.atStart(e.doc).from,u=ee.atEnd(e.doc).to;if(s||!(o===l&&a===u)||!sa(n.doc))return;const f=n.tr,h=Xo({state:n,transaction:f}),{commands:p}=new Qo({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),c0=me.create({name:"tabindex",addProseMirrorPlugins(){return[new ve({key:new Ce("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var L3=Object.freeze({__proto__:null,ClipboardTextSerializer:e0,Commands:o0,Editable:a0,FocusEvents:l0,Keymap:u0,Tabindex:c0});class Wn{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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),n=this.resolvedPos.doc.resolve(e);return new Wn(n,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 Wn(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 Wn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=this.pos+r+1,o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const a=new Wn(o,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new Wn(o,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const n=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(n.from).run()}}const D3=t=>new ve({key:new Ce("tiptapDrop"),props:{handleDrop:(e,n,r,i)=>{t(n,r,i)}}}),R3=t=>new ve({key:new Ce("tiptapPaste"),props:{handlePaste:(e,n,r)=>{t(n,r)}}}),I3=`.ProseMirror { +`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,u,c,d)=>{var f;l.isBlock&&u>r&&(a+=s);const h=o==null?void 0:o[l.type.name];if(h)return c&&(a+=h({node:l,pos:u,parent:c,index:d,range:e})),!1;l.isText&&(a+=(f=l==null?void 0:l.text)===null||f===void 0?void 0:f.slice(Math.max(r,u)-u,i-u))}),a}function Xp(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Qp=me.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new be({key:new ke("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),l=Xp(n);return na(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),hy=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),py=(t=!1)=>({commands:e})=>e.setContent("",t),gy=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),f=u.resolve(c.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=li(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},my=t=>e=>t(e),by=()=>({state:t,dispatch:e})=>F2(t,e),yy=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new Y(r.doc.resolve(o-1))),!0},vy=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.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);t.delete(a,l).scrollIntoView()}return!0}return!1},xy=t=>({tr:e,state:n,dispatch:r})=>{const i=qe(t,n.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),u=s.after(o);e.delete(l,u).scrollIntoView()}return!0}return!1},wy=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},Ey=()=>({state:t,dispatch:e})=>M2(t,e),ky=()=>({commands:t})=>t.keyboardShortcut("Enter"),Cy=()=>({state:t,dispatch:e})=>P2(t,e);function Xr(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Cu(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Il(t,e,n={}){return t.find(r=>r.type===e&&Xr(r.attrs,n))}function _y(t,e,n={}){return!!Il(t,e,n)}function _u(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const i=Il([...r.node.marks],e,n);if(!i)return;let s=r.index,o=t.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(Il([...r.node.marks],e,n);s>0&&i.isInSet(t.parent.child(s-1).marks);)s-=1,o-=t.parent.child(s).nodeSize;for(;a({tr:n,state:r,dispatch:i})=>{const s=mn(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=_u(l,s,e);if(d&&d.from<=u&&d.to>=c){const f=Y.create(o,d.from,d.to);n.setSelection(f)}}return!0},My=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{Mu()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!Su(n.state.selection))return o(),!0;const a=e0(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Ty=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Oy=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),t0=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&t0(r)}return t};function ws(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return t0(n)}function uo(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return L.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),uo("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new lu({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:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?nr.fromSchema(l).parseSlice(ws(t),n.parseOptions):nr.fromSchema(l).parse(ws(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=nr.fromSchema(e);return n.slice?s.parseSlice(ws(t),n.parseOptions).content:s.parse(ws(t),n.parseOptions)}return uo("",e,n)}function Ny(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=c)}),t.setSelection(ee.near(t.doc.resolve(o),n))}const Ly=t=>!("type"in t),Dy=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=uo(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(p){return s.emit("contentError",{editor:s,error:p,disableCollaboration:()=>{console.error("[tiptap error]: Unable to disable collaboration at this point in time")}}),!1}let{from:l,to:u}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,d=!0;if((Ly(a)?a:[a]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),l===u&&d){const{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,u+=1)}let h;c?(Array.isArray(e)?h=e.map(p=>p.text||"").join(""):typeof e=="object"&&e&&e.text?h=e.text:h=e,r.insertText(h,l,u)):(h=a,r.replaceWith(l,u,h)),n.updateSelection&&Ny(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:h})}return!0},Ry=()=>({state:t,dispatch:e})=>R2(t,e),Iy=()=>({state:t,dispatch:e})=>I2(t,e),Hy=()=>({state:t,dispatch:e})=>A2(t,e),By=()=>({state:t,dispatch:e})=>L2(t,e),Py=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ko(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Fy=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ko(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$y=()=>({state:t,dispatch:e})=>T2(t,e),Vy=()=>({state:t,dispatch:e})=>O2(t,e);function n0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function zy(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a({editor:e,view:n,tr:r,dispatch:i})=>{const s=zy(t).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),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(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l==null||l.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function fr(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?qe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(i,f+d.nodeSize);a.push({node:d,from:h,to:p})});const l=i-r,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Xr(d.node.attrs,n,{strict:!1}));return s?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=l}const qy=(t,e={})=>({state:n,dispatch:r})=>{const i=qe(t,n.schema);return fr(n,i,e)?H2(n,r):!1},Zy=()=>({state:t,dispatch:e})=>$2(t,e),Ky=t=>({state:e,dispatch:n})=>{const r=qe(t,e.schema);return j2(r)(e,n)},Wy=()=>({state:t,dispatch:e})=>B2(t,e);function ra(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function vd(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const jy=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ra(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=qe(t,r.schema)),a==="mark"&&(o=mn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{s&&s===u.type&&n.setNodeMarkup(c,void 0,vd(u.attrs,e)),o&&u.marks.length&&u.marks.forEach(d=>{o===d.type&&n.addMark(c,c+u.nodeSize,o.create(vd(d.attrs,e)))})})}),!0):!1},Gy=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Jy=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),Yy=()=>({state:t,dispatch:e})=>N2(t,e),Xy=()=>({state:t,dispatch:e})=>D2(t,e),Qy=()=>({state:t,dispatch:e})=>V2(t,e),e3=()=>({state:t,dispatch:e})=>q2(t,e),t3=()=>({state:t,dispatch:e})=>U2(t,e);function Hl(t,e,n={},r={}){return uo(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const n3=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var l,u;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const d=Hl(t,i.schema,n,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck})};function as(t,e){const n=mn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function r3(t,e){const n=new du(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function i3(t){for(let e=0;e{e(r)&&n.push({node:r,pos:i})}),n}function s3(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function r0(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ia(t){return e=>r0(e.$from,t)}function Au(t,e){const n=yr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function o3(t,e){const n={from:0,to:t.content.size};return na(t,n,e)}function a3(t,e){const n=qe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function i0(t,e){const n=ra(typeof e=="string"?e:e.name,t.schema);return n==="node"?a3(t,e):n==="mark"?as(t,e):{}}function l3(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function u3(t){const e=l3(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function c3(t){const{mapping:e,steps:n}=t,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}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(s).map(a,-1),c=e.slice(s).map(l),d=e.invert().map(u,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),u3(r)}function Tu(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=_u(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,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}function qs(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Pl(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?mn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Xr(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(g,m)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(h,m),v=Math.min(p,m+g.nodeSize),x=v-y;o+=x,a.push(...g.marks.map(b=>({mark:b,from:y,to:v})))})}),o===0)return!1;const l=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Xr(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+u:l)>=o}function d3(t,e,n={}){if(!e)return fr(t,null,n)||Pl(t,null,n);const r=ra(e,t.schema);return r==="node"?fr(t,e,n):r==="mark"?Pl(t,e,n):!1}function xd(t,e){const{nodeExtensions:n}=ea(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=le(q(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function sa(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(sa(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function s0(t){return t instanceof Q}function hr(t,e,n){const i=t.state.doc.content.size,s=fn(e,0,i),o=fn(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h=f-d,p=c-u,y={top:u,bottom:c,left:d,right:f,width:h,height:p,x:d,y:u};return{...y,toJSON:()=>y}}function f3(t,e,n){var r;const{selection:i}=e;let s=null;if(Su(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=h&&p}return!u}),u})}const h3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=mn(t,r.schema);if(i)if(o){const u=as(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,h)=>{const p=Math.max(h,c),g=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(p,g,l.create({...y.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return f3(r,n,l)},p3=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),g3=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=qe(t,n.schema);return s.isTextblock?i().command(({commands:o})=>gd(s,e)(n)?!0:o.clearNodes()).command(({state:o})=>gd(s,e)(o,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},m3=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=fn(t,0,r.content.size),s=Q.create(r,i);e.setSelection(s)}return!0},b3=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=Y.atStart(r).from,a=Y.atEnd(r).to,l=fn(i,o,a),u=fn(s,o,a),c=Y.create(r,l,u);e.setSelection(c)}return!0},y3=t=>({state:e,dispatch:n})=>{const r=qe(t,e.schema);return Y2(r)(e,n)};function wd(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const v3=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,u=i.extensionManager.attributes,c=qs(u,a.node().type.name,a.node().attrs);if(s instanceof Q&&s.node.isBlock)return!a.parentOffset||!qr(o,a.pos)?!1:(r&&(t&&wd(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:i3(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,p=qr(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&qr(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:c}]:void 0),r){if(p&&(s instanceof Y&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),m=e.doc.resolve(g);a.node(-1).canReplaceWith(m.index(),m.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&wd(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},x3=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=qe(t,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;const d=l.node(-1);if(d.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 y=L.empty;const v=l.index(-1)?1:l.index(-2)?2:3;for(let N=l.depth-v;N>=l.depth-3;N-=1)y=L.from(l.node(N).copy(y));const x=l.indexAfter(-1){if(_>-1)return!1;N.isTextblock&&N.content.size===0&&(_=M+1)}),_>-1&&n.setSelection(Y.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const h=u.pos===l.end()?d.contentMatchAt(0).defaultType:null,p={...qs(f,d.type.name,d.attrs),...e},g={...qs(f,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,u.pos);const m=h?[{type:a,attrs:p},{type:h,attrs:g}]:[{type:a,attrs:p}];if(!qr(n.doc,l.pos,2))return!1;if(i){const{selection:y,storedMarks:v}=r,{splittableMarks:x}=s.extensionManager,b=v||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,m).scrollIntoView(),!b||!i)return!0;const k=b.filter(w=>x.includes(w.type.name));n.ensureMarks(k)}return!0},Fa=(t,e)=>{const n=ia(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&$n(t.doc,n.pos)&&t.join(n.pos),!0},$a=(t,e)=>{const n=ia(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&$n(t.doc,r)&&t.join(r),!0},w3=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=qe(t,o.schema),p=qe(e,o.schema),{selection:g,storedMarks:m}=o,{$from:y,$to:v}=g,x=y.blockRange(v),b=m||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const k=ia(w=>xd(w.type.name,d))(g);if(x.depth>=1&&k&&x.depth-k.depth<=1){if(k.node.type===h)return u.liftListItem(p);if(xd(k.node.type.name,d)&&h.validContent(k.node.content)&&a)return l().command(()=>(s.setNodeMarkup(k.pos,h),!0)).command(()=>Fa(s,h)).command(()=>$a(s,h)).run()}return!n||!b||!a?l().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>Fa(s,h)).command(()=>$a(s,h)).run():l().command(()=>{const w=c().wrapInList(h,r),_=b.filter(N=>f.includes(N.type.name));return s.ensureMarks(_),w?!0:u.clearNodes()}).wrapInList(h,r).command(()=>Fa(s,h)).command(()=>$a(s,h)).run()},E3=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=mn(t,r.schema);return Pl(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},k3=(t,e,n={})=>({state:r,commands:i})=>{const s=qe(t,r.schema),o=qe(e,r.schema),a=fr(r,s,n);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,...n})},C3=(t,e={})=>({state:n,commands:r})=>{const i=qe(t,n.schema);return fr(n,i,e)?r.lift(i):r.wrapIn(i,e)},_3=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},S3=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},M3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=mn(t,r.schema),{$from:u,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:f,to:h}=a;const p=(s=u.marks().find(m=>m.type===l))===null||s===void 0?void 0:s.attrs,g=_u(u,l,p);g&&(f=g.from,h=g.to),n.removeMark(f,h,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},A3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=ra(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=qe(t,r.schema)),a==="mark"&&(o=mn(t,r.schema)),i&&n.selection.ranges.forEach(l=>{const u=l.$from.pos,c=l.$to.pos;r.doc.nodesBetween(u,c,(d,f)=>{s&&s===d.type&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(h=>{if(o===h.type){const p=Math.max(f,u),g=Math.min(f+d.nodeSize,c);n.addMark(p,g,o.create({...h.attrs,...e}))}})})}),!0):!1},T3=(t,e={})=>({state:n,dispatch:r})=>{const i=qe(t,n.schema);return Z2(i,e)(n,r)},O3=(t,e={})=>({state:n,dispatch:r})=>{const i=qe(t,n.schema);return K2(i,e)(n,r)};var N3=Object.freeze({__proto__:null,blur:hy,clearContent:py,clearNodes:gy,command:my,createParagraphNear:by,cut:yy,deleteCurrentNode:vy,deleteNode:xy,deleteRange:wy,deleteSelection:Ey,enter:ky,exitCode:Cy,extendMarkRange:Sy,first:My,focus:Ay,forEach:Ty,insertContent:Oy,insertContentAt:Dy,joinBackward:Hy,joinDown:Iy,joinForward:By,joinItemBackward:Py,joinItemForward:Fy,joinTextblockBackward:$y,joinTextblockForward:Vy,joinUp:Ry,keyboardShortcut:Uy,lift:qy,liftEmptyBlock:Zy,liftListItem:Ky,newlineInCode:Wy,resetAttributes:jy,scrollIntoView:Gy,selectAll:Jy,selectNodeBackward:Yy,selectNodeForward:Xy,selectParentNode:Qy,selectTextblockEnd:e3,selectTextblockStart:t3,setContent:n3,setMark:h3,setMeta:p3,setNode:g3,setNodeSelection:m3,setTextSelection:b3,sinkListItem:y3,splitBlock:v3,splitListItem:x3,toggleList:w3,toggleMark:E3,toggleNode:k3,toggleWrap:C3,undoInputRule:_3,unsetAllMarks:S3,unsetMark:M3,updateAttributes:A3,wrapIn:T3,wrapInList:O3});const o0=me.create({name:"commands",addCommands(){return{...N3}}}),a0=me.create({name:"editable",addProseMirrorPlugins(){return[new be({key:new ke("editable"),props:{editable:()=>this.editor.options.editable}})]}}),l0=me.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new be({key:new ke("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),u0=me.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,m=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?m===d.pos:ee.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!y||y&&d.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:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"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 Mu()||n0()?s:i},addProseMirrorPlugins(){return[new be({key:new ke("clearDocument"),appendTransaction:(t,e,n)=>{const r=t.some(g=>g.docChanged)&&!e.doc.eq(n.doc),i=t.some(g=>g.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=ee.atStart(e.doc).from,u=ee.atEnd(e.doc).to;if(s||!(o===l&&a===u)||!sa(n.doc))return;const f=n.tr,h=Xo({state:n,transaction:f}),{commands:p}=new Qo({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),c0=me.create({name:"tabindex",addProseMirrorPlugins(){return[new be({key:new ke("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var L3=Object.freeze({__proto__:null,ClipboardTextSerializer:Qp,Commands:o0,Editable:a0,FocusEvents:l0,Keymap:u0,Tabindex:c0});class Wn{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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),n=this.resolvedPos.doc.resolve(e);return new Wn(n,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 Wn(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 Wn(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=this.pos+r+1,o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const a=new Wn(o,this.editor,i,i?n:null);i&&(a.actualDepth=this.depth+1),e.push(new Wn(o,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a{r&&i.length>0||(o.node.type.name===e&&s.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const n=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(n.from).run()}}const D3=t=>new be({key:new ke("tiptapDrop"),props:{handleDrop:(e,n,r,i)=>{t(n,r,i)}}}),R3=t=>new be({key:new ke("tiptapPaste"),props:{handlePaste:(e,n,r)=>{t(n,r)}}}),I3=`.ProseMirror { position: relative; } @@ -84,9 +84,9 @@ img.ProseMirror-separator { .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 -}`;function H3(t,e,n){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=t,document.getElementsByTagName("head")[0].appendChild(i),i}class B3 extends X2{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.options.onPaste&&this.registerPlugin(R3(this.options.onPaste)),this.options.onDrop&&this.registerPlugin(D3(this.options.onDrop)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=H3(I3,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=Xp(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[a0,e0.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),o0,l0,u0,c0].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 Pr(i,this)}createCommandManager(){this.commandManager=new Qo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=Hl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=Hl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=t0(e,this.options.autofocus);this.view=new b2(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Br.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return s0(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return d3(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Au(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=` +}`;function H3(t,e,n){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=t,document.getElementsByTagName("head")[0].appendChild(i),i}class B3 extends X2{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.options.onPaste&&this.registerPlugin(R3(this.options.onPaste)),this.options.onDrop&&this.registerPlugin(D3(this.options.onDrop)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=H3(I3,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=Yp(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[a0,Qp.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),o0,l0,u0,c0].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 Fr(i,this)}createCommandManager(){this.commandManager=new Qo({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=Hl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=Hl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=e0(e,this.options.autofocus);this.view=new b2(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Pr.create({doc:e,selection:n||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return i0(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return d3(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Au(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=` -`,textSerializers:r={}}=e||{};return o3(this.state.doc,{blockSeparator:n,textSerializers:{...Qp(this.schema),...r}})}get isEmpty(){return sa(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Wn(n,this)}get $doc(){return this.$pos(0)}}function hr(t){return new is({find:t.find,handler:({state:e,range:n,match:r})=>{const i=le(t.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/),u=n.from+a.indexOf(o),c=u+o.length;if(Tu(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;cn.from&&s.delete(n.from+l,u);const f=n.from+l+o.length;s.addMark(n.from+l,f,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Nu(t){return new is({find:t.find,handler:({state:e,range:n,match:r})=>{const i=le(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(c,a,l)}else if(r[0]){const u=t.type.isInline?o:o-1;s.insert(u,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()}})}function Fl(t){return new is({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=le(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function pr(t){return new is({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=le(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),u=l&&cu(l,t.type,s);if(!u)return null;if(o.wrap(l,u),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(m=>h.includes(m.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&$n(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)}})}class Te{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(q(this,"addOptions",{name:this.name}))),this.storage=le(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Te(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ta(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Te(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(q(n,"addOptions",{name:n.name})),n.storage=le(q(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const l=o.find(u=>(u==null?void 0:u.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let ae=class $l{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(q(this,"addOptions",{name:this.name}))),this.storage=le(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new $l(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ta(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new $l(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(q(n,"addOptions",{name:n.name})),n.storage=le(q(n,"addStorage",{name:n.name,options:n.options})),n}};function Pn(t){return new oy({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=le(t.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 u=n.to;if(a){const c=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Tu(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>d).length)return null;fn.from&&o.delete(n.from+c,d),u=n.from+c+a.length,o.addMark(n.from+c,u,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function P3(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}class he extends HTMLElement{constructor(){super();B(this,"template","");B(this,"editor");B(this,"options")}registerClickListener(){this.addEventListener("click",()=>{var r;const n=(r=this.editor)==null?void 0:r.chain();this.onClick(n),n==null||n.run()})}connectedCallback(){this.innerHTML=this.template}onClick(n){}onCreate(n,r){this.editor=n.editor,this.options=r}onTransaction(n){const r=this.querySelector("div");r&&(this.onActive(n.editor)?r.classList.add("active"):r.classList.remove("active"))}onActive(n){return!1}}class d0 extends he{constructor(){super(),this.template=` +`,textSerializers:r={}}=e||{};return o3(this.state.doc,{blockSeparator:n,textSerializers:{...Xp(this.schema),...r}})}get isEmpty(){return sa(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Wn(n,this)}get $doc(){return this.$pos(0)}}function pr(t){return new ss({find:t.find,handler:({state:e,range:n,match:r})=>{const i=le(t.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/),u=n.from+a.indexOf(o),c=u+o.length;if(Tu(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===t.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;cn.from&&s.delete(n.from+l,u);const f=n.from+l+o.length;s.addMark(n.from+l,f,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function Ou(t){return new ss({find:t.find,handler:({state:e,range:n,match:r})=>{const i=le(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const l=t.type.create(i);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(c,a,l)}else if(r[0]){const u=t.type.isInline?o:o-1;s.insert(u,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()}})}function Fl(t){return new ss({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=le(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function gr(t){return new ss({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=le(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),u=l&&cu(l,t.type,s);if(!u)return null;if(o.wrap(l,u),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const g=p.filter(m=>h.includes(m.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&$n(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)}})}class Te{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(q(this,"addOptions",{name:this.name}))),this.storage=le(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Te(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ta(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Te(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(q(n,"addOptions",{name:n.name})),n.storage=le(q(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const l=o.find(u=>(u==null?void 0:u.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}let ae=class $l{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=le(q(this,"addOptions",{name:this.name}))),this.storage=le(q(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new $l(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>ta(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new $l(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=le(q(n,"addOptions",{name:n.name})),n.storage=le(q(n,"addStorage",{name:n.name,options:n.options})),n}};function Pn(t){return new oy({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=le(t.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 u=n.to;if(a){const c=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(Tu(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===t.type&&m!==p.mark.type)).filter(p=>p.to>d).length)return null;fn.from&&o.delete(n.from+c,d),u=n.from+c+a.length,o.addMark(n.from+c,u,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function P3(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}class he extends HTMLElement{constructor(){super();B(this,"template","");B(this,"editor");B(this,"options")}registerClickListener(){this.addEventListener("click",()=>{var r;const n=(r=this.editor)==null?void 0:r.chain();this.onClick(n),n==null||n.run()})}connectedCallback(){this.innerHTML=this.template}onClick(n){}onCreate(n,r){this.editor=n.editor,this.options=r}onTransaction(n){const r=this.querySelector("div");r&&(this.onActive(n.editor)?r.classList.add("active"):r.classList.remove("active"))}onActive(n){return!1}}class d0 extends he{constructor(){super(),this.template=`
@@ -94,27 +94,27 @@ img.ProseMirror-separator {
- `,this.registerClickListener()}onClick(e){e.redo()}}var ft="top",Dt="bottom",Rt="right",ht="left",Lu="auto",ls=[ft,Dt,Rt,ht],Xr="start",Fi="end",$3="clippingParents",f0="viewport",hi="popper",V3="reference",kd=ls.reduce(function(t,e){return t.concat([e+"-"+Xr,e+"-"+Fi])},[]),h0=[].concat(ls,[Lu]).reduce(function(t,e){return t.concat([e,e+"-"+Xr,e+"-"+Fi])},[]),z3="beforeRead",U3="read",q3="afterRead",Z3="beforeMain",K3="main",W3="afterMain",j3="beforeWrite",G3="write",J3="afterWrite",Y3=[z3,U3,q3,Z3,K3,W3,j3,G3,J3];function Qt(t){return t?(t.nodeName||"").toLowerCase():null}function yt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function gr(t){var e=yt(t).Element;return t instanceof e||t instanceof Element}function Lt(t){var e=yt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Du(t){if(typeof ShadowRoot>"u")return!1;var e=yt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function X3(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Lt(s)||!Qt(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Q3(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,u){return l[u]="",l},{});!Lt(i)||!Qt(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const p0={name:"applyStyles",enabled:!0,phase:"write",fn:X3,effect:Q3,requires:["computeStyles"]};function Jt(t){return t.split("-")[0]}var sr=Math.max,co=Math.min,Qr=Math.round;function Vl(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function g0(){return!/^((?!chrome|android).)*safari/i.test(Vl())}function ei(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Lt(t)&&(i=t.offsetWidth>0&&Qr(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&Qr(r.height)/t.offsetHeight||1);var o=gr(t)?yt(t):window,a=o.visualViewport,l=!g0()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/i,c=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/i,f=r.height/s;return{width:d,height:f,top:c,right:u+d,bottom:c+f,left:u,x:u,y:c}}function Ru(t){var e=ei(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function m0(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Du(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function pn(t){return yt(t).getComputedStyle(t)}function ev(t){return["table","td","th"].indexOf(Qt(t))>=0}function zn(t){return((gr(t)?t.ownerDocument:t.document)||window.document).documentElement}function oa(t){return Qt(t)==="html"?t:t.assignedSlot||t.parentNode||(Du(t)?t.host:null)||zn(t)}function Cd(t){return!Lt(t)||pn(t).position==="fixed"?null:t.offsetParent}function tv(t){var e=/firefox/i.test(Vl()),n=/Trident/i.test(Vl());if(n&&Lt(t)){var r=pn(t);if(r.position==="fixed")return null}var i=oa(t);for(Du(i)&&(i=i.host);Lt(i)&&["html","body"].indexOf(Qt(i))<0;){var s=pn(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function us(t){for(var e=yt(t),n=Cd(t);n&&ev(n)&&pn(n).position==="static";)n=Cd(n);return n&&(Qt(n)==="html"||Qt(n)==="body"&&pn(n).position==="static")?e:n||tv(t)||e}function Iu(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Si(t,e,n){return sr(t,co(e,n))}function nv(t,e,n){var r=Si(t,e,n);return r>n?n:r}function b0(){return{top:0,right:0,bottom:0,left:0}}function y0(t){return Object.assign({},b0(),t)}function v0(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var rv=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,y0(typeof e!="number"?e:v0(e,ls))};function iv(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=Jt(n.placement),l=Iu(a),u=[ht,Rt].indexOf(a)>=0,c=u?"height":"width";if(!(!s||!o)){var d=rv(i.padding,n),f=Ru(s),h=l==="y"?ft:ht,p=l==="y"?Dt:Rt,g=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],m=o[l]-n.rects.reference[l],y=us(s),v=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,x=g/2-m/2,b=d[h],k=v-f[c]-d[p],w=v/2-f[c]/2+x,_=Si(b,w,k),N=l;n.modifiersData[r]=(e={},e[N]=_,e.centerOffset=_-w,e)}}function sv(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||m0(e.elements.popper,i)&&(e.elements.arrow=i))}const ov={name:"arrow",enabled:!0,phase:"main",fn:iv,effect:sv,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ti(t){return t.split("-")[1]}var av={top:"auto",right:"auto",bottom:"auto",left:"auto"};function lv(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Qr(n*i)/i||0,y:Qr(r*i)/i||0}}function _d(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,d=t.isFixed,f=o.x,h=f===void 0?0:f,p=o.y,g=p===void 0?0:p,m=typeof c=="function"?c({x:h,y:g}):{x:h,y:g};h=m.x,g=m.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),x=ht,b=ft,k=window;if(u){var w=us(n),_="clientHeight",N="clientWidth";if(w===yt(n)&&(w=zn(n),pn(w).position!=="static"&&a==="absolute"&&(_="scrollHeight",N="scrollWidth")),w=w,i===ft||(i===ht||i===Rt)&&s===Fi){b=Dt;var M=d&&w===k&&k.visualViewport?k.visualViewport.height:w[_];g-=M-r.height,g*=l?1:-1}if(i===ht||(i===ft||i===Dt)&&s===Fi){x=Rt;var I=d&&w===k&&k.visualViewport?k.visualViewport.width:w[N];h-=I-r.width,h*=l?1:-1}}var $=Object.assign({position:a},u&&av),K=c===!0?lv({x:h,y:g},yt(n)):{x:h,y:g};if(h=K.x,g=K.y,l){var z;return Object.assign({},$,(z={},z[b]=v?"0":"",z[x]=y?"0":"",z.transform=(k.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",z))}return Object.assign({},$,(e={},e[b]=v?g+"px":"",e[x]=y?h+"px":"",e.transform="",e))}function uv(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Jt(e.placement),variation:ti(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,_d(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,_d(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const cv={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:uv,data:{}};var Es={passive:!0};function dv(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=yt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&u.forEach(function(c){c.addEventListener("scroll",n.update,Es)}),a&&l.addEventListener("resize",n.update,Es),function(){s&&u.forEach(function(c){c.removeEventListener("scroll",n.update,Es)}),a&&l.removeEventListener("resize",n.update,Es)}}const fv={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:dv,data:{}};var hv={left:"right",right:"left",bottom:"top",top:"bottom"};function Zs(t){return t.replace(/left|right|bottom|top/g,function(e){return hv[e]})}var pv={start:"end",end:"start"};function Sd(t){return t.replace(/start|end/g,function(e){return pv[e]})}function Hu(t){var e=yt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Bu(t){return ei(zn(t)).left+Hu(t).scrollLeft}function gv(t,e){var n=yt(t),r=zn(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var u=g0();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Bu(t),y:l}}function mv(t){var e,n=zn(t),r=Hu(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=sr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=sr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Bu(t),l=-r.scrollTop;return pn(i||n).direction==="rtl"&&(a+=sr(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function Pu(t){var e=pn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function x0(t){return["html","body","#document"].indexOf(Qt(t))>=0?t.ownerDocument.body:Lt(t)&&Pu(t)?t:x0(oa(t))}function Mi(t,e){var n;e===void 0&&(e=[]);var r=x0(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=yt(r),o=i?[s].concat(s.visualViewport||[],Pu(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(Mi(oa(o)))}function zl(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function bv(t,e){var n=ei(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function Md(t,e,n){return e===f0?zl(gv(t,n)):gr(e)?bv(e,n):zl(mv(zn(t)))}function yv(t){var e=Mi(oa(t)),n=["absolute","fixed"].indexOf(pn(t).position)>=0,r=n&&Lt(t)?us(t):t;return gr(r)?e.filter(function(i){return gr(i)&&m0(i,r)&&Qt(i)!=="body"}):[]}function vv(t,e,n,r){var i=e==="clippingParents"?yv(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,u){var c=Md(t,u,r);return l.top=sr(c.top,l.top),l.right=co(c.right,l.right),l.bottom=co(c.bottom,l.bottom),l.left=sr(c.left,l.left),l},Md(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function w0(t){var e=t.reference,n=t.element,r=t.placement,i=r?Jt(r):null,s=r?ti(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case ft:l={x:o,y:e.y-n.height};break;case Dt:l={x:o,y:e.y+e.height};break;case Rt:l={x:e.x+e.width,y:a};break;case ht:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=i?Iu(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(s){case Xr:l[u]=l[u]-(e[c]/2-n[c]/2);break;case Fi:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function $i(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?$3:a,u=n.rootBoundary,c=u===void 0?f0:u,d=n.elementContext,f=d===void 0?hi:d,h=n.altBoundary,p=h===void 0?!1:h,g=n.padding,m=g===void 0?0:g,y=y0(typeof m!="number"?m:v0(m,ls)),v=f===hi?V3:hi,x=t.rects.popper,b=t.elements[p?v:f],k=vv(gr(b)?b:b.contextElement||zn(t.elements.popper),l,c,o),w=ei(t.elements.reference),_=w0({reference:w,element:x,strategy:"absolute",placement:i}),N=zl(Object.assign({},x,_)),M=f===hi?N:w,I={top:k.top-M.top+y.top,bottom:M.bottom-k.bottom+y.bottom,left:k.left-M.left+y.left,right:M.right-k.right+y.right},$=t.modifiersData.offset;if(f===hi&&$){var K=$[i];Object.keys(I).forEach(function(z){var j=[Rt,Dt].indexOf(z)>=0?1:-1,U=[ft,Dt].indexOf(z)>=0?"y":"x";I[z]+=K[U]*j})}return I}function xv(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?h0:l,c=ti(r),d=c?a?kd:kd.filter(function(p){return ti(p)===c}):ls,f=d.filter(function(p){return u.indexOf(p)>=0});f.length===0&&(f=d);var h=f.reduce(function(p,g){return p[g]=$i(t,{placement:g,boundary:i,rootBoundary:s,padding:o})[Jt(g)],p},{});return Object.keys(h).sort(function(p,g){return h[p]-h[g]})}function wv(t){if(Jt(t)===Lu)return[];var e=Zs(t);return[Sd(t),e,Sd(e)]}function Ev(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=h===void 0?!0:h,g=n.allowedAutoPlacements,m=e.options.placement,y=Jt(m),v=y===m,x=l||(v||!p?[Zs(m)]:wv(m)),b=[m].concat(x).reduce(function(Oe,se){return Oe.concat(Jt(se)===Lu?xv(e,{placement:se,boundary:c,rootBoundary:d,padding:u,flipVariations:p,allowedAutoPlacements:g}):se)},[]),k=e.rects.reference,w=e.rects.popper,_=new Map,N=!0,M=b[0],I=0;I=0,U=j?"width":"height",te=$i(e,{placement:$,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),E=j?z?Rt:ht:z?Dt:ft;k[U]>w[U]&&(E=Zs(E));var C=Zs(E),O=[];if(s&&O.push(te[K]<=0),a&&O.push(te[E]<=0,te[C]<=0),O.every(function(Oe){return Oe})){M=$,N=!1;break}_.set($,O)}if(N)for(var D=p?3:1,V=function(se){var pe=b.find(function(ot){var Be=_.get(ot);if(Be)return Be.slice(0,se).every(function(at){return at})});if(pe)return M=pe,"break"},G=D;G>0;G--){var ue=V(G);if(ue==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const kv={name:"flip",enabled:!0,phase:"main",fn:Ev,requiresIfExists:["offset"],data:{_skip:!1}};function Ad(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Td(t){return[ft,Rt,Dt,ht].some(function(e){return t[e]>=0})}function Cv(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=$i(e,{elementContext:"reference"}),a=$i(e,{altBoundary:!0}),l=Ad(o,r),u=Ad(a,i,s),c=Td(l),d=Td(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const _v={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Cv};function Sv(t,e,n){var r=Jt(t),i=[ht,ft].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[ht,Rt].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Mv(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=h0.reduce(function(c,d){return c[d]=Sv(d,e.rects,s),c},{}),a=o[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=o}const Av={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Mv};function Tv(t){var e=t.state,n=t.name;e.modifiersData[n]=w0({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Ov={name:"popperOffsets",enabled:!0,phase:"read",fn:Tv,data:{}};function Nv(t){return t==="x"?"y":"x"}function Lv(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,p=n.tetherOffset,g=p===void 0?0:p,m=$i(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=Jt(e.placement),v=ti(e.placement),x=!v,b=Iu(y),k=Nv(b),w=e.modifiersData.popperOffsets,_=e.rects.reference,N=e.rects.popper,M=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,I=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),$=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,K={x:0,y:0};if(w){if(s){var z,j=b==="y"?ft:ht,U=b==="y"?Dt:Rt,te=b==="y"?"height":"width",E=w[b],C=E+m[j],O=E-m[U],D=h?-N[te]/2:0,V=v===Xr?_[te]:N[te],G=v===Xr?-N[te]:-_[te],ue=e.elements.arrow,Oe=h&&ue?Ru(ue):{width:0,height:0},se=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:b0(),pe=se[j],ot=se[U],Be=Si(0,_[te],Oe[te]),at=x?_[te]/2-D-Be-pe-I.mainAxis:V-Be-pe-I.mainAxis,lt=x?-_[te]/2+D+Be+ot+I.mainAxis:G+Be+ot+I.mainAxis,xt=e.elements.arrow&&us(e.elements.arrow),$t=xt?b==="y"?xt.clientTop||0:xt.clientLeft||0:0,de=(z=$==null?void 0:$[b])!=null?z:0,He=E+at-de-$t,Je=E+lt-de,xe=Si(h?co(C,He):C,E,h?sr(O,Je):O);w[b]=xe,K[b]=xe-E}if(a){var sn,wt=b==="x"?ft:ht,R=b==="x"?Dt:Rt,tt=w[k],ie=k==="y"?"height":"width",X=tt+m[wt],Ze=tt-m[R],Ne=[ft,ht].indexOf(y)!==-1,Et=(sn=$==null?void 0:$[k])!=null?sn:0,kt=Ne?X:tt-_[ie]-N[ie]-Et+I.altAxis,S=Ne?tt+_[ie]+N[ie]-Et-I.altAxis:Ze,T=h&&Ne?nv(kt,tt,S):Si(h?kt:X,tt,h?S:Ze);w[k]=T,K[k]=T-tt}e.modifiersData[r]=K}}const Dv={name:"preventOverflow",enabled:!0,phase:"main",fn:Lv,requiresIfExists:["offset"]};function Rv(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Iv(t){return t===yt(t)||!Lt(t)?Hu(t):Rv(t)}function Hv(t){var e=t.getBoundingClientRect(),n=Qr(e.width)/t.offsetWidth||1,r=Qr(e.height)/t.offsetHeight||1;return n!==1||r!==1}function Bv(t,e,n){n===void 0&&(n=!1);var r=Lt(e),i=Lt(e)&&Hv(e),s=zn(e),o=ei(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Qt(e)!=="body"||Pu(s))&&(a=Iv(e)),Lt(e)?(l=ei(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Bu(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Pv(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function Fv(t){var e=Pv(t);return Y3.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function $v(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Vv(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Od={placement:"bottom",modifiers:[],strategy:"absolute"};function Nd(){for(var t=arguments.length,e=new Array(t),n=0;n-1}function S0(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Ld(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function jv(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function Gv(t){return t.split(/\s+/).filter(Boolean)}function Dr(t){return[].concat(t)}function Dd(t,e){t.indexOf(e)===-1&&t.push(e)}function Jv(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function Yv(t){return t.split("-")[0]}function fo(t){return[].slice.call(t)}function Rd(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Ai(){return document.createElement("div")}function Vi(t){return["Element","Fragment"].some(function(e){return Fu(t,e)})}function Xv(t){return Fu(t,"NodeList")}function Qv(t){return Fu(t,"MouseEvent")}function ex(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function tx(t){return Vi(t)?[t]:Xv(t)?fo(t):Array.isArray(t)?t:fo(document.querySelectorAll(t))}function za(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Id(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function nx(t){var e,n=Dr(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function rx(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,u=Yv(o.placement),c=o.modifiersData.offset;if(!c)return!0;var d=u==="bottom"?c.top.y:0,f=u==="top"?c.bottom.y:0,h=u==="right"?c.left.x:0,p=u==="left"?c.right.x:0,g=s.top-r+d>l,m=r-s.bottom-f>l,y=s.left-n+h>l,v=n-s.right-p>l;return g||m||y||v})}function Ua(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function Hd(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Zt={isTouch:!1},Bd=0;function ix(){Zt.isTouch||(Zt.isTouch=!0,window.performance&&document.addEventListener("mousemove",M0))}function M0(){var t=performance.now();t-Bd<20&&(Zt.isTouch=!1,document.removeEventListener("mousemove",M0)),Bd=t}function sx(){var t=document.activeElement;if(ex(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function ox(){document.addEventListener("touchstart",ix,Zn),window.addEventListener("blur",sx)}var ax=typeof window<"u"&&typeof document<"u",lx=ax?!!window.msCrypto:!1;function Cr(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Pd(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function ux(t){return Pd(` + `,this.registerClickListener()}onClick(e){e.redo()}}var ft="top",Dt="bottom",Rt="right",ht="left",Nu="auto",ls=[ft,Dt,Rt,ht],Qr="start",$i="end",$3="clippingParents",f0="viewport",pi="popper",V3="reference",Ed=ls.reduce(function(t,e){return t.concat([e+"-"+Qr,e+"-"+$i])},[]),h0=[].concat(ls,[Nu]).reduce(function(t,e){return t.concat([e,e+"-"+Qr,e+"-"+$i])},[]),z3="beforeRead",U3="read",q3="afterRead",Z3="beforeMain",K3="main",W3="afterMain",j3="beforeWrite",G3="write",J3="afterWrite",Y3=[z3,U3,q3,Z3,K3,W3,j3,G3,J3];function Qt(t){return t?(t.nodeName||"").toLowerCase():null}function yt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function mr(t){var e=yt(t).Element;return t instanceof e||t instanceof Element}function Lt(t){var e=yt(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Lu(t){if(typeof ShadowRoot>"u")return!1;var e=yt(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function X3(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},i=e.attributes[n]||{},s=e.elements[n];!Lt(s)||!Qt(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Q3(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var i=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=o.reduce(function(l,u){return l[u]="",l},{});!Lt(i)||!Qt(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const p0={name:"applyStyles",enabled:!0,phase:"write",fn:X3,effect:Q3,requires:["computeStyles"]};function Jt(t){return t.split("-")[0]}var sr=Math.max,co=Math.min,ei=Math.round;function Vl(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function g0(){return!/^((?!chrome|android).)*safari/i.test(Vl())}function ti(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),i=1,s=1;e&&Lt(t)&&(i=t.offsetWidth>0&&ei(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&ei(r.height)/t.offsetHeight||1);var o=mr(t)?yt(t):window,a=o.visualViewport,l=!g0()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/i,c=(r.top+(l&&a?a.offsetTop:0))/s,d=r.width/i,f=r.height/s;return{width:d,height:f,top:c,right:u+d,bottom:c+f,left:u,x:u,y:c}}function Du(t){var e=ti(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function m0(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Lu(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function pn(t){return yt(t).getComputedStyle(t)}function ev(t){return["table","td","th"].indexOf(Qt(t))>=0}function zn(t){return((mr(t)?t.ownerDocument:t.document)||window.document).documentElement}function oa(t){return Qt(t)==="html"?t:t.assignedSlot||t.parentNode||(Lu(t)?t.host:null)||zn(t)}function kd(t){return!Lt(t)||pn(t).position==="fixed"?null:t.offsetParent}function tv(t){var e=/firefox/i.test(Vl()),n=/Trident/i.test(Vl());if(n&&Lt(t)){var r=pn(t);if(r.position==="fixed")return null}var i=oa(t);for(Lu(i)&&(i=i.host);Lt(i)&&["html","body"].indexOf(Qt(i))<0;){var s=pn(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function us(t){for(var e=yt(t),n=kd(t);n&&ev(n)&&pn(n).position==="static";)n=kd(n);return n&&(Qt(n)==="html"||Qt(n)==="body"&&pn(n).position==="static")?e:n||tv(t)||e}function Ru(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Mi(t,e,n){return sr(t,co(e,n))}function nv(t,e,n){var r=Mi(t,e,n);return r>n?n:r}function b0(){return{top:0,right:0,bottom:0,left:0}}function y0(t){return Object.assign({},b0(),t)}function v0(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var rv=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,y0(typeof e!="number"?e:v0(e,ls))};function iv(t){var e,n=t.state,r=t.name,i=t.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=Jt(n.placement),l=Ru(a),u=[ht,Rt].indexOf(a)>=0,c=u?"height":"width";if(!(!s||!o)){var d=rv(i.padding,n),f=Du(s),h=l==="y"?ft:ht,p=l==="y"?Dt:Rt,g=n.rects.reference[c]+n.rects.reference[l]-o[l]-n.rects.popper[c],m=o[l]-n.rects.reference[l],y=us(s),v=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,x=g/2-m/2,b=d[h],k=v-f[c]-d[p],w=v/2-f[c]/2+x,_=Mi(b,w,k),N=l;n.modifiersData[r]=(e={},e[N]=_,e.centerOffset=_-w,e)}}function sv(t){var e=t.state,n=t.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||m0(e.elements.popper,i)&&(e.elements.arrow=i))}const ov={name:"arrow",enabled:!0,phase:"main",fn:iv,effect:sv,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ni(t){return t.split("-")[1]}var av={top:"auto",right:"auto",bottom:"auto",left:"auto"};function lv(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:ei(n*i)/i||0,y:ei(r*i)/i||0}}function Cd(t){var e,n=t.popper,r=t.popperRect,i=t.placement,s=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,d=t.isFixed,f=o.x,h=f===void 0?0:f,p=o.y,g=p===void 0?0:p,m=typeof c=="function"?c({x:h,y:g}):{x:h,y:g};h=m.x,g=m.y;var y=o.hasOwnProperty("x"),v=o.hasOwnProperty("y"),x=ht,b=ft,k=window;if(u){var w=us(n),_="clientHeight",N="clientWidth";if(w===yt(n)&&(w=zn(n),pn(w).position!=="static"&&a==="absolute"&&(_="scrollHeight",N="scrollWidth")),w=w,i===ft||(i===ht||i===Rt)&&s===$i){b=Dt;var M=d&&w===k&&k.visualViewport?k.visualViewport.height:w[_];g-=M-r.height,g*=l?1:-1}if(i===ht||(i===ft||i===Dt)&&s===$i){x=Rt;var I=d&&w===k&&k.visualViewport?k.visualViewport.width:w[N];h-=I-r.width,h*=l?1:-1}}var $=Object.assign({position:a},u&&av),K=c===!0?lv({x:h,y:g},yt(n)):{x:h,y:g};if(h=K.x,g=K.y,l){var z;return Object.assign({},$,(z={},z[b]=v?"0":"",z[x]=y?"0":"",z.transform=(k.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",z))}return Object.assign({},$,(e={},e[b]=v?g+"px":"",e[x]=y?h+"px":"",e.transform="",e))}function uv(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Jt(e.placement),variation:ni(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Cd(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Cd(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const cv={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:uv,data:{}};var Es={passive:!0};function dv(t){var e=t.state,n=t.instance,r=t.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=yt(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&u.forEach(function(c){c.addEventListener("scroll",n.update,Es)}),a&&l.addEventListener("resize",n.update,Es),function(){s&&u.forEach(function(c){c.removeEventListener("scroll",n.update,Es)}),a&&l.removeEventListener("resize",n.update,Es)}}const fv={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:dv,data:{}};var hv={left:"right",right:"left",bottom:"top",top:"bottom"};function Zs(t){return t.replace(/left|right|bottom|top/g,function(e){return hv[e]})}var pv={start:"end",end:"start"};function _d(t){return t.replace(/start|end/g,function(e){return pv[e]})}function Iu(t){var e=yt(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Hu(t){return ti(zn(t)).left+Iu(t).scrollLeft}function gv(t,e){var n=yt(t),r=zn(t),i=n.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var u=g0();(u||!u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+Hu(t),y:l}}function mv(t){var e,n=zn(t),r=Iu(t),i=(e=t.ownerDocument)==null?void 0:e.body,s=sr(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=sr(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Hu(t),l=-r.scrollTop;return pn(i||n).direction==="rtl"&&(a+=sr(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function Bu(t){var e=pn(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function x0(t){return["html","body","#document"].indexOf(Qt(t))>=0?t.ownerDocument.body:Lt(t)&&Bu(t)?t:x0(oa(t))}function Ai(t,e){var n;e===void 0&&(e=[]);var r=x0(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=yt(r),o=i?[s].concat(s.visualViewport||[],Bu(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(Ai(oa(o)))}function zl(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function bv(t,e){var n=ti(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function Sd(t,e,n){return e===f0?zl(gv(t,n)):mr(e)?bv(e,n):zl(mv(zn(t)))}function yv(t){var e=Ai(oa(t)),n=["absolute","fixed"].indexOf(pn(t).position)>=0,r=n&&Lt(t)?us(t):t;return mr(r)?e.filter(function(i){return mr(i)&&m0(i,r)&&Qt(i)!=="body"}):[]}function vv(t,e,n,r){var i=e==="clippingParents"?yv(t):[].concat(e),s=[].concat(i,[n]),o=s[0],a=s.reduce(function(l,u){var c=Sd(t,u,r);return l.top=sr(c.top,l.top),l.right=co(c.right,l.right),l.bottom=co(c.bottom,l.bottom),l.left=sr(c.left,l.left),l},Sd(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function w0(t){var e=t.reference,n=t.element,r=t.placement,i=r?Jt(r):null,s=r?ni(r):null,o=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(i){case ft:l={x:o,y:e.y-n.height};break;case Dt:l={x:o,y:e.y+e.height};break;case Rt:l={x:e.x+e.width,y:a};break;case ht:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=i?Ru(i):null;if(u!=null){var c=u==="y"?"height":"width";switch(s){case Qr:l[u]=l[u]-(e[c]/2-n[c]/2);break;case $i:l[u]=l[u]+(e[c]/2-n[c]/2);break}}return l}function Vi(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=r===void 0?t.placement:r,s=n.strategy,o=s===void 0?t.strategy:s,a=n.boundary,l=a===void 0?$3:a,u=n.rootBoundary,c=u===void 0?f0:u,d=n.elementContext,f=d===void 0?pi:d,h=n.altBoundary,p=h===void 0?!1:h,g=n.padding,m=g===void 0?0:g,y=y0(typeof m!="number"?m:v0(m,ls)),v=f===pi?V3:pi,x=t.rects.popper,b=t.elements[p?v:f],k=vv(mr(b)?b:b.contextElement||zn(t.elements.popper),l,c,o),w=ti(t.elements.reference),_=w0({reference:w,element:x,strategy:"absolute",placement:i}),N=zl(Object.assign({},x,_)),M=f===pi?N:w,I={top:k.top-M.top+y.top,bottom:M.bottom-k.bottom+y.bottom,left:k.left-M.left+y.left,right:M.right-k.right+y.right},$=t.modifiersData.offset;if(f===pi&&$){var K=$[i];Object.keys(I).forEach(function(z){var j=[Rt,Dt].indexOf(z)>=0?1:-1,U=[ft,Dt].indexOf(z)>=0?"y":"x";I[z]+=K[U]*j})}return I}function xv(t,e){e===void 0&&(e={});var n=e,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?h0:l,c=ni(r),d=c?a?Ed:Ed.filter(function(p){return ni(p)===c}):ls,f=d.filter(function(p){return u.indexOf(p)>=0});f.length===0&&(f=d);var h=f.reduce(function(p,g){return p[g]=Vi(t,{placement:g,boundary:i,rootBoundary:s,padding:o})[Jt(g)],p},{});return Object.keys(h).sort(function(p,g){return h[p]-h[g]})}function wv(t){if(Jt(t)===Nu)return[];var e=Zs(t);return[_d(t),e,_d(e)]}function Ev(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=h===void 0?!0:h,g=n.allowedAutoPlacements,m=e.options.placement,y=Jt(m),v=y===m,x=l||(v||!p?[Zs(m)]:wv(m)),b=[m].concat(x).reduce(function(Oe,se){return Oe.concat(Jt(se)===Nu?xv(e,{placement:se,boundary:c,rootBoundary:d,padding:u,flipVariations:p,allowedAutoPlacements:g}):se)},[]),k=e.rects.reference,w=e.rects.popper,_=new Map,N=!0,M=b[0],I=0;I=0,U=j?"width":"height",te=Vi(e,{placement:$,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),E=j?z?Rt:ht:z?Dt:ft;k[U]>w[U]&&(E=Zs(E));var C=Zs(E),O=[];if(s&&O.push(te[K]<=0),a&&O.push(te[E]<=0,te[C]<=0),O.every(function(Oe){return Oe})){M=$,N=!1;break}_.set($,O)}if(N)for(var D=p?3:1,V=function(se){var pe=b.find(function(ot){var Be=_.get(ot);if(Be)return Be.slice(0,se).every(function(at){return at})});if(pe)return M=pe,"break"},G=D;G>0;G--){var ue=V(G);if(ue==="break")break}e.placement!==M&&(e.modifiersData[r]._skip=!0,e.placement=M,e.reset=!0)}}const kv={name:"flip",enabled:!0,phase:"main",fn:Ev,requiresIfExists:["offset"],data:{_skip:!1}};function Md(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function Ad(t){return[ft,Rt,Dt,ht].some(function(e){return t[e]>=0})}function Cv(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Vi(e,{elementContext:"reference"}),a=Vi(e,{altBoundary:!0}),l=Md(o,r),u=Md(a,i,s),c=Ad(l),d=Ad(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}const _v={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Cv};function Sv(t,e,n){var r=Jt(t),i=[ht,ft].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[ht,Rt].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Mv(t){var e=t.state,n=t.options,r=t.name,i=n.offset,s=i===void 0?[0,0]:i,o=h0.reduce(function(c,d){return c[d]=Sv(d,e.rects,s),c},{}),a=o[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=o}const Av={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Mv};function Tv(t){var e=t.state,n=t.name;e.modifiersData[n]=w0({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const Ov={name:"popperOffsets",enabled:!0,phase:"read",fn:Tv,data:{}};function Nv(t){return t==="x"?"y":"x"}function Lv(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,f=n.tether,h=f===void 0?!0:f,p=n.tetherOffset,g=p===void 0?0:p,m=Vi(e,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=Jt(e.placement),v=ni(e.placement),x=!v,b=Ru(y),k=Nv(b),w=e.modifiersData.popperOffsets,_=e.rects.reference,N=e.rects.popper,M=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,I=typeof M=="number"?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),$=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,K={x:0,y:0};if(w){if(s){var z,j=b==="y"?ft:ht,U=b==="y"?Dt:Rt,te=b==="y"?"height":"width",E=w[b],C=E+m[j],O=E-m[U],D=h?-N[te]/2:0,V=v===Qr?_[te]:N[te],G=v===Qr?-N[te]:-_[te],ue=e.elements.arrow,Oe=h&&ue?Du(ue):{width:0,height:0},se=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:b0(),pe=se[j],ot=se[U],Be=Mi(0,_[te],Oe[te]),at=x?_[te]/2-D-Be-pe-I.mainAxis:V-Be-pe-I.mainAxis,lt=x?-_[te]/2+D+Be+ot+I.mainAxis:G+Be+ot+I.mainAxis,xt=e.elements.arrow&&us(e.elements.arrow),$t=xt?b==="y"?xt.clientTop||0:xt.clientLeft||0:0,de=(z=$==null?void 0:$[b])!=null?z:0,He=E+at-de-$t,Je=E+lt-de,xe=Mi(h?co(C,He):C,E,h?sr(O,Je):O);w[b]=xe,K[b]=xe-E}if(a){var sn,wt=b==="x"?ft:ht,R=b==="x"?Dt:Rt,tt=w[k],ie=k==="y"?"height":"width",X=tt+m[wt],Ze=tt-m[R],Ne=[ft,ht].indexOf(y)!==-1,Et=(sn=$==null?void 0:$[k])!=null?sn:0,kt=Ne?X:tt-_[ie]-N[ie]-Et+I.altAxis,S=Ne?tt+_[ie]+N[ie]-Et-I.altAxis:Ze,T=h&&Ne?nv(kt,tt,S):Mi(h?kt:X,tt,h?S:Ze);w[k]=T,K[k]=T-tt}e.modifiersData[r]=K}}const Dv={name:"preventOverflow",enabled:!0,phase:"main",fn:Lv,requiresIfExists:["offset"]};function Rv(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Iv(t){return t===yt(t)||!Lt(t)?Iu(t):Rv(t)}function Hv(t){var e=t.getBoundingClientRect(),n=ei(e.width)/t.offsetWidth||1,r=ei(e.height)/t.offsetHeight||1;return n!==1||r!==1}function Bv(t,e,n){n===void 0&&(n=!1);var r=Lt(e),i=Lt(e)&&Hv(e),s=zn(e),o=ti(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Qt(e)!=="body"||Bu(s))&&(a=Iv(e)),Lt(e)?(l=ti(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=Hu(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Pv(t){var e=new Map,n=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&i(l)}}),r.push(s)}return t.forEach(function(s){n.has(s.name)||i(s)}),r}function Fv(t){var e=Pv(t);return Y3.reduce(function(n,r){return n.concat(e.filter(function(i){return i.phase===r}))},[])}function $v(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Vv(t){var e=t.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Td={placement:"bottom",modifiers:[],strategy:"absolute"};function Od(){for(var t=arguments.length,e=new Array(t),n=0;n-1}function S0(t,e){return typeof t=="function"?t.apply(void 0,e):t}function Nd(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function jv(t,e){var n=Object.assign({},t);return e.forEach(function(r){delete n[r]}),n}function Gv(t){return t.split(/\s+/).filter(Boolean)}function Rr(t){return[].concat(t)}function Ld(t,e){t.indexOf(e)===-1&&t.push(e)}function Jv(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function Yv(t){return t.split("-")[0]}function fo(t){return[].slice.call(t)}function Dd(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function Ti(){return document.createElement("div")}function zi(t){return["Element","Fragment"].some(function(e){return Pu(t,e)})}function Xv(t){return Pu(t,"NodeList")}function Qv(t){return Pu(t,"MouseEvent")}function ex(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function tx(t){return zi(t)?[t]:Xv(t)?fo(t):Array.isArray(t)?t:fo(document.querySelectorAll(t))}function za(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function Rd(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function nx(t){var e,n=Rr(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function rx(t,e){var n=e.clientX,r=e.clientY;return t.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,u=Yv(o.placement),c=o.modifiersData.offset;if(!c)return!0;var d=u==="bottom"?c.top.y:0,f=u==="top"?c.bottom.y:0,h=u==="right"?c.left.x:0,p=u==="left"?c.right.x:0,g=s.top-r+d>l,m=r-s.bottom-f>l,y=s.left-n+h>l,v=n-s.right-p>l;return g||m||y||v})}function Ua(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){t[r](i,n)})}function Id(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Zt={isTouch:!1},Hd=0;function ix(){Zt.isTouch||(Zt.isTouch=!0,window.performance&&document.addEventListener("mousemove",M0))}function M0(){var t=performance.now();t-Hd<20&&(Zt.isTouch=!1,document.removeEventListener("mousemove",M0)),Hd=t}function sx(){var t=document.activeElement;if(ex(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function ox(){document.addEventListener("touchstart",ix,Zn),window.addEventListener("blur",sx)}var ax=typeof window<"u"&&typeof document<"u",lx=ax?!!window.msCrypto:!1;function _r(t){var e=t==="destroy"?"n already-":" ";return[t+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Bd(t){var e=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(e," ").replace(n,"").trim()}function ux(t){return Bd(` %ctippy.js - %c`+Pd(t)+` + %c`+Bd(t)+` %c👷‍ This is a development-only message. It will be removed in production. - `)}function A0(t){return[ux(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var zi;St.NODE_ENV!=="production"&&cx();function cx(){zi=new Set}function dn(t,e){if(t&&!zi.has(e)){var n;zi.add(e),(n=console).warn.apply(n,A0(e))}}function Ul(t,e){if(t&&!zi.has(e)){var n;zi.add(e),(n=console).error.apply(n,A0(e))}}function dx(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Ul(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Ul(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var T0={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},fx={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},bt=Object.assign({appendTo:_0,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},T0,fx),hx=Object.keys(bt),px=function(e){St.NODE_ENV!=="production"&&N0(e,[]);var n=Object.keys(e);n.forEach(function(r){bt[r]=e[r]})};function O0(t){var e=t.plugins||[],n=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=bt[s])!=null?a:o}return r},{});return Object.assign({},t,n)}function gx(t,e){var n=e?Object.keys(O0(Object.assign({},bt,{plugins:e}))):hx,r=n.reduce(function(i,s){var o=(t.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function Fd(t,e){var n=Object.assign({},e,{content:S0(e.content,[t])},e.ignoreAttributes?{}:gx(t,e.plugins));return n.aria=Object.assign({},bt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function N0(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=jv(bt,Object.keys(T0)),s=!Wv(i,r);s&&(s=e.filter(function(o){return o.name===r}).length===0),dn(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",` + `)}function A0(t){return[ux(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Ui;St.NODE_ENV!=="production"&&cx();function cx(){Ui=new Set}function dn(t,e){if(t&&!Ui.has(e)){var n;Ui.add(e),(n=console).warn.apply(n,A0(e))}}function Ul(t,e){if(t&&!Ui.has(e)){var n;Ui.add(e),(n=console).error.apply(n,A0(e))}}function dx(t){var e=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Ul(e,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Ul(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var T0={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},fx={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},bt=Object.assign({appendTo:_0,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},T0,fx),hx=Object.keys(bt),px=function(e){St.NODE_ENV!=="production"&&N0(e,[]);var n=Object.keys(e);n.forEach(function(r){bt[r]=e[r]})};function O0(t){var e=t.plugins||[],n=e.reduce(function(r,i){var s=i.name,o=i.defaultValue;if(s){var a;r[s]=t[s]!==void 0?t[s]:(a=bt[s])!=null?a:o}return r},{});return Object.assign({},t,n)}function gx(t,e){var n=e?Object.keys(O0(Object.assign({},bt,{plugins:e}))):hx,r=n.reduce(function(i,s){var o=(t.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return r}function Pd(t,e){var n=Object.assign({},e,{content:S0(e.content,[t])},e.ignoreAttributes?{}:gx(t,e.plugins));return n.aria=Object.assign({},bt.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}function N0(t,e){t===void 0&&(t={}),e===void 0&&(e=[]);var n=Object.keys(t);n.forEach(function(r){var i=jv(bt,Object.keys(T0)),s=!Wv(i,r);s&&(s=e.filter(function(o){return o.name===r}).length===0),dn(s,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",` `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/ -`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var mx=function(){return"innerHTML"};function ql(t,e){t[mx()]=e}function $d(t){var e=Ai();return t===!0?e.className=k0:(e.className=C0,Vi(t)?e.appendChild(t):ql(e,t)),e}function Vd(t,e){Vi(e.content)?(ql(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ql(t,e.content):t.textContent=e.content)}function Zl(t){var e=t.firstElementChild,n=fo(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(E0)}),arrow:n.find(function(r){return r.classList.contains(k0)||r.classList.contains(C0)}),backdrop:n.find(function(r){return r.classList.contains(Kv)})}}function L0(t){var e=Ai(),n=Ai();n.className=Zv,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Ai();r.className=E0,r.setAttribute("data-state","hidden"),Vd(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Zl(e),l=a.box,u=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&Vd(u,t.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild($d(o.arrow))):l.appendChild($d(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}L0.$$tippy=!0;var bx=1,ks=[],qa=[];function yx(t,e){var n=Fd(t,Object.assign({},bt,O0(Rd(e)))),r,i,s,o=!1,a=!1,l=!1,u=!1,c,d,f,h=[],p=Ld(He,n.interactiveDebounce),g,m=bx++,y=null,v=Jv(n.plugins),x={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:m,reference:t,popper:Ai(),popperInstance:y,props:n,state:x,plugins:v,clearDelayTimeouts:kt,setProps:S,setContent:T,show:P,hide:Z,hideWithInteractivity:fe,enable:Ne,disable:Et,unmount:Le,destroy:di};if(!n.render)return St.NODE_ENV!=="production"&&Ul(!0,"render() function has not been supplied."),b;var k=n.render(b),w=k.popper,_=k.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+b.id,b.popper=w,t._tippy=b,w._tippy=b;var N=v.map(function(A){return A.fn(b)}),M=t.hasAttribute("aria-expanded");return xt(),D(),E(),C("onCreate",[b]),n.showOnCreate&&X(),w.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),w.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&j().addEventListener("mousemove",p)}),b;function I(){var A=b.props.touch;return Array.isArray(A)?A:[A,0]}function $(){return I()[0]==="hold"}function K(){var A;return!!((A=b.props.render)!=null&&A.$$tippy)}function z(){return g||t}function j(){var A=z().parentNode;return A?nx(A):document}function U(){return Zl(w)}function te(A){return b.state.isMounted&&!b.state.isVisible||Zt.isTouch||c&&c.type==="focus"?0:Va(b.props.delay,A?0:1,bt.delay)}function E(A){A===void 0&&(A=!1),w.style.pointerEvents=b.props.interactive&&!A?"":"none",w.style.zIndex=""+b.props.zIndex}function C(A,W,re){if(re===void 0&&(re=!0),N.forEach(function(ge){ge[A]&&ge[A].apply(ge,W)}),re){var we;(we=b.props)[A].apply(we,W)}}function O(){var A=b.props.aria;if(A.content){var W="aria-"+A.content,re=w.id,we=Dr(b.props.triggerTarget||t);we.forEach(function(ge){var nt=ge.getAttribute(W);if(b.state.isVisible)ge.setAttribute(W,nt?nt+" "+re:re);else{var Ct=nt&&nt.replace(re,"").trim();Ct?ge.setAttribute(W,Ct):ge.removeAttribute(W)}})}}function D(){if(!(M||!b.props.aria.expanded)){var A=Dr(b.props.triggerTarget||t);A.forEach(function(W){b.props.interactive?W.setAttribute("aria-expanded",b.state.isVisible&&W===z()?"true":"false"):W.removeAttribute("aria-expanded")})}}function V(){j().removeEventListener("mousemove",p),ks=ks.filter(function(A){return A!==p})}function G(A){if(!(Zt.isTouch&&(l||A.type==="mousedown"))){var W=A.composedPath&&A.composedPath()[0]||A.target;if(!(b.props.interactive&&Hd(w,W))){if(Dr(b.props.triggerTarget||t).some(function(re){return Hd(re,W)})){if(Zt.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else C("onClickOutside",[b,A]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||pe())}}}function ue(){l=!0}function Oe(){l=!1}function se(){var A=j();A.addEventListener("mousedown",G,!0),A.addEventListener("touchend",G,Zn),A.addEventListener("touchstart",Oe,Zn),A.addEventListener("touchmove",ue,Zn)}function pe(){var A=j();A.removeEventListener("mousedown",G,!0),A.removeEventListener("touchend",G,Zn),A.removeEventListener("touchstart",Oe,Zn),A.removeEventListener("touchmove",ue,Zn)}function ot(A,W){at(A,function(){!b.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&W()})}function Be(A,W){at(A,W)}function at(A,W){var re=U().box;function we(ge){ge.target===re&&(Ua(re,"remove",we),W())}if(A===0)return W();Ua(re,"remove",d),Ua(re,"add",we),d=we}function lt(A,W,re){re===void 0&&(re=!1);var we=Dr(b.props.triggerTarget||t);we.forEach(function(ge){ge.addEventListener(A,W,re),h.push({node:ge,eventType:A,handler:W,options:re})})}function xt(){$()&&(lt("touchstart",de,{passive:!0}),lt("touchend",Je,{passive:!0})),Gv(b.props.trigger).forEach(function(A){if(A!=="manual")switch(lt(A,de),A){case"mouseenter":lt("mouseleave",Je);break;case"focus":lt(lx?"focusout":"blur",xe);break;case"focusin":lt("focusout",xe);break}})}function $t(){h.forEach(function(A){var W=A.node,re=A.eventType,we=A.handler,ge=A.options;W.removeEventListener(re,we,ge)}),h=[]}function de(A){var W,re=!1;if(!(!b.state.isEnabled||sn(A)||a)){var we=((W=c)==null?void 0:W.type)==="focus";c=A,g=A.currentTarget,D(),!b.state.isVisible&&Qv(A)&&ks.forEach(function(ge){return ge(A)}),A.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?re=!0:X(A),A.type==="click"&&(o=!re),re&&!we&&Ze(A)}}function He(A){var W=A.target,re=z().contains(W)||w.contains(W);if(!(A.type==="mousemove"&&re)){var we=ie().concat(w).map(function(ge){var nt,Ct=ge._tippy,xr=(nt=Ct.popperInstance)==null?void 0:nt.state;return xr?{popperRect:ge.getBoundingClientRect(),popperState:xr,props:n}:null}).filter(Boolean);rx(we,A)&&(V(),Ze(A))}}function Je(A){var W=sn(A)||b.props.trigger.indexOf("click")>=0&&o;if(!W){if(b.props.interactive){b.hideWithInteractivity(A);return}Ze(A)}}function xe(A){b.props.trigger.indexOf("focusin")<0&&A.target!==z()||b.props.interactive&&A.relatedTarget&&w.contains(A.relatedTarget)||Ze(A)}function sn(A){return Zt.isTouch?$()!==A.type.indexOf("touch")>=0:!1}function wt(){R();var A=b.props,W=A.popperOptions,re=A.placement,we=A.offset,ge=A.getReferenceClientRect,nt=A.moveTransition,Ct=K()?Zl(w).arrow:null,xr=ge?{getBoundingClientRect:ge,contextElement:ge.contextElement||z()}:t,bc={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ps){var wr=ps.state;if(K()){var zg=U(),ka=zg.box;["placement","reference-hidden","escaped"].forEach(function(gs){gs==="placement"?ka.setAttribute("data-placement",wr.placement):wr.attributes.popper["data-popper-"+gs]?ka.setAttribute("data-"+gs,""):ka.removeAttribute("data-"+gs)}),wr.attributes.popper={}}}},Un=[{name:"offset",options:{offset:we}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!nt}},bc];K()&&Ct&&Un.push({name:"arrow",options:{element:Ct,padding:3}}),Un.push.apply(Un,(W==null?void 0:W.modifiers)||[]),b.popperInstance=qv(xr,w,Object.assign({},W,{placement:re,onFirstUpdate:f,modifiers:Un}))}function R(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function tt(){var A=b.props.appendTo,W,re=z();b.props.interactive&&A===_0||A==="parent"?W=re.parentNode:W=S0(A,[re]),W.contains(w)||W.appendChild(w),b.state.isMounted=!0,wt(),St.NODE_ENV!=="production"&&dn(b.props.interactive&&A===bt.appendTo&&re.nextElementSibling!==w,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",` +`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var mx=function(){return"innerHTML"};function ql(t,e){t[mx()]=e}function Fd(t){var e=Ti();return t===!0?e.className=k0:(e.className=C0,zi(t)?e.appendChild(t):ql(e,t)),e}function $d(t,e){zi(e.content)?(ql(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ql(t,e.content):t.textContent=e.content)}function Zl(t){var e=t.firstElementChild,n=fo(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(E0)}),arrow:n.find(function(r){return r.classList.contains(k0)||r.classList.contains(C0)}),backdrop:n.find(function(r){return r.classList.contains(Kv)})}}function L0(t){var e=Ti(),n=Ti();n.className=Zv,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=Ti();r.className=E0,r.setAttribute("data-state","hidden"),$d(r,t.props),e.appendChild(n),n.appendChild(r),i(t.props,t.props);function i(s,o){var a=Zl(e),l=a.box,u=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&$d(u,t.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(Fd(o.arrow))):l.appendChild(Fd(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}L0.$$tippy=!0;var bx=1,ks=[],qa=[];function yx(t,e){var n=Pd(t,Object.assign({},bt,O0(Dd(e)))),r,i,s,o=!1,a=!1,l=!1,u=!1,c,d,f,h=[],p=Nd(He,n.interactiveDebounce),g,m=bx++,y=null,v=Jv(n.plugins),x={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},b={id:m,reference:t,popper:Ti(),popperInstance:y,props:n,state:x,plugins:v,clearDelayTimeouts:kt,setProps:S,setContent:T,show:P,hide:Z,hideWithInteractivity:fe,enable:Ne,disable:Et,unmount:Le,destroy:fi};if(!n.render)return St.NODE_ENV!=="production"&&Ul(!0,"render() function has not been supplied."),b;var k=n.render(b),w=k.popper,_=k.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+b.id,b.popper=w,t._tippy=b,w._tippy=b;var N=v.map(function(A){return A.fn(b)}),M=t.hasAttribute("aria-expanded");return xt(),D(),E(),C("onCreate",[b]),n.showOnCreate&&X(),w.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),w.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&j().addEventListener("mousemove",p)}),b;function I(){var A=b.props.touch;return Array.isArray(A)?A:[A,0]}function $(){return I()[0]==="hold"}function K(){var A;return!!((A=b.props.render)!=null&&A.$$tippy)}function z(){return g||t}function j(){var A=z().parentNode;return A?nx(A):document}function U(){return Zl(w)}function te(A){return b.state.isMounted&&!b.state.isVisible||Zt.isTouch||c&&c.type==="focus"?0:Va(b.props.delay,A?0:1,bt.delay)}function E(A){A===void 0&&(A=!1),w.style.pointerEvents=b.props.interactive&&!A?"":"none",w.style.zIndex=""+b.props.zIndex}function C(A,W,re){if(re===void 0&&(re=!0),N.forEach(function(ge){ge[A]&&ge[A].apply(ge,W)}),re){var we;(we=b.props)[A].apply(we,W)}}function O(){var A=b.props.aria;if(A.content){var W="aria-"+A.content,re=w.id,we=Rr(b.props.triggerTarget||t);we.forEach(function(ge){var nt=ge.getAttribute(W);if(b.state.isVisible)ge.setAttribute(W,nt?nt+" "+re:re);else{var Ct=nt&&nt.replace(re,"").trim();Ct?ge.setAttribute(W,Ct):ge.removeAttribute(W)}})}}function D(){if(!(M||!b.props.aria.expanded)){var A=Rr(b.props.triggerTarget||t);A.forEach(function(W){b.props.interactive?W.setAttribute("aria-expanded",b.state.isVisible&&W===z()?"true":"false"):W.removeAttribute("aria-expanded")})}}function V(){j().removeEventListener("mousemove",p),ks=ks.filter(function(A){return A!==p})}function G(A){if(!(Zt.isTouch&&(l||A.type==="mousedown"))){var W=A.composedPath&&A.composedPath()[0]||A.target;if(!(b.props.interactive&&Id(w,W))){if(Rr(b.props.triggerTarget||t).some(function(re){return Id(re,W)})){if(Zt.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else C("onClickOutside",[b,A]);b.props.hideOnClick===!0&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||pe())}}}function ue(){l=!0}function Oe(){l=!1}function se(){var A=j();A.addEventListener("mousedown",G,!0),A.addEventListener("touchend",G,Zn),A.addEventListener("touchstart",Oe,Zn),A.addEventListener("touchmove",ue,Zn)}function pe(){var A=j();A.removeEventListener("mousedown",G,!0),A.removeEventListener("touchend",G,Zn),A.removeEventListener("touchstart",Oe,Zn),A.removeEventListener("touchmove",ue,Zn)}function ot(A,W){at(A,function(){!b.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&W()})}function Be(A,W){at(A,W)}function at(A,W){var re=U().box;function we(ge){ge.target===re&&(Ua(re,"remove",we),W())}if(A===0)return W();Ua(re,"remove",d),Ua(re,"add",we),d=we}function lt(A,W,re){re===void 0&&(re=!1);var we=Rr(b.props.triggerTarget||t);we.forEach(function(ge){ge.addEventListener(A,W,re),h.push({node:ge,eventType:A,handler:W,options:re})})}function xt(){$()&&(lt("touchstart",de,{passive:!0}),lt("touchend",Je,{passive:!0})),Gv(b.props.trigger).forEach(function(A){if(A!=="manual")switch(lt(A,de),A){case"mouseenter":lt("mouseleave",Je);break;case"focus":lt(lx?"focusout":"blur",xe);break;case"focusin":lt("focusout",xe);break}})}function $t(){h.forEach(function(A){var W=A.node,re=A.eventType,we=A.handler,ge=A.options;W.removeEventListener(re,we,ge)}),h=[]}function de(A){var W,re=!1;if(!(!b.state.isEnabled||sn(A)||a)){var we=((W=c)==null?void 0:W.type)==="focus";c=A,g=A.currentTarget,D(),!b.state.isVisible&&Qv(A)&&ks.forEach(function(ge){return ge(A)}),A.type==="click"&&(b.props.trigger.indexOf("mouseenter")<0||o)&&b.props.hideOnClick!==!1&&b.state.isVisible?re=!0:X(A),A.type==="click"&&(o=!re),re&&!we&&Ze(A)}}function He(A){var W=A.target,re=z().contains(W)||w.contains(W);if(!(A.type==="mousemove"&&re)){var we=ie().concat(w).map(function(ge){var nt,Ct=ge._tippy,wr=(nt=Ct.popperInstance)==null?void 0:nt.state;return wr?{popperRect:ge.getBoundingClientRect(),popperState:wr,props:n}:null}).filter(Boolean);rx(we,A)&&(V(),Ze(A))}}function Je(A){var W=sn(A)||b.props.trigger.indexOf("click")>=0&&o;if(!W){if(b.props.interactive){b.hideWithInteractivity(A);return}Ze(A)}}function xe(A){b.props.trigger.indexOf("focusin")<0&&A.target!==z()||b.props.interactive&&A.relatedTarget&&w.contains(A.relatedTarget)||Ze(A)}function sn(A){return Zt.isTouch?$()!==A.type.indexOf("touch")>=0:!1}function wt(){R();var A=b.props,W=A.popperOptions,re=A.placement,we=A.offset,ge=A.getReferenceClientRect,nt=A.moveTransition,Ct=K()?Zl(w).arrow:null,wr=ge?{getBoundingClientRect:ge,contextElement:ge.contextElement||z()}:t,mc={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ps){var Er=ps.state;if(K()){var zg=U(),ka=zg.box;["placement","reference-hidden","escaped"].forEach(function(gs){gs==="placement"?ka.setAttribute("data-placement",Er.placement):Er.attributes.popper["data-popper-"+gs]?ka.setAttribute("data-"+gs,""):ka.removeAttribute("data-"+gs)}),Er.attributes.popper={}}}},Un=[{name:"offset",options:{offset:we}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!nt}},mc];K()&&Ct&&Un.push({name:"arrow",options:{element:Ct,padding:3}}),Un.push.apply(Un,(W==null?void 0:W.modifiers)||[]),b.popperInstance=qv(wr,w,Object.assign({},W,{placement:re,onFirstUpdate:f,modifiers:Un}))}function R(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function tt(){var A=b.props.appendTo,W,re=z();b.props.interactive&&A===_0||A==="parent"?W=re.parentNode:W=S0(A,[re]),W.contains(w)||W.appendChild(w),b.state.isMounted=!0,wt(),St.NODE_ENV!=="production"&&dn(b.props.interactive&&A===bt.appendTo&&re.nextElementSibling!==w,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",` `,"Using a wrapper
or tag around the reference element","solves this by creating a new parentNode context.",` `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",` -`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function ie(){return fo(w.querySelectorAll("[data-tippy-root]"))}function X(A){b.clearDelayTimeouts(),A&&C("onTrigger",[b,A]),se();var W=te(!0),re=I(),we=re[0],ge=re[1];Zt.isTouch&&we==="hold"&&ge&&(W=ge),W?r=setTimeout(function(){b.show()},W):b.show()}function Ze(A){if(b.clearDelayTimeouts(),C("onUntrigger",[b,A]),!b.state.isVisible){pe();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(A.type)>=0&&o)){var W=te(!1);W?i=setTimeout(function(){b.state.isVisible&&b.hide()},W):s=requestAnimationFrame(function(){b.hide()})}}function Ne(){b.state.isEnabled=!0}function Et(){b.hide(),b.state.isEnabled=!1}function kt(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function S(A){if(St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,Cr("setProps")),!b.state.isDestroyed){C("onBeforeUpdate",[b,A]),$t();var W=b.props,re=Fd(t,Object.assign({},W,Rd(A),{ignoreAttributes:!0}));b.props=re,xt(),W.interactiveDebounce!==re.interactiveDebounce&&(V(),p=Ld(He,re.interactiveDebounce)),W.triggerTarget&&!re.triggerTarget?Dr(W.triggerTarget).forEach(function(we){we.removeAttribute("aria-expanded")}):re.triggerTarget&&t.removeAttribute("aria-expanded"),D(),E(),_&&_(W,re),b.popperInstance&&(wt(),ie().forEach(function(we){requestAnimationFrame(we._tippy.popperInstance.forceUpdate)})),C("onAfterUpdate",[b,A])}}function T(A){b.setProps({content:A})}function P(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,Cr("show"));var A=b.state.isVisible,W=b.state.isDestroyed,re=!b.state.isEnabled,we=Zt.isTouch&&!b.props.touch,ge=Va(b.props.duration,0,bt.duration);if(!(A||W||re||we)&&!z().hasAttribute("disabled")&&(C("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,K()&&(w.style.visibility="visible"),E(),se(),b.state.isMounted||(w.style.transition="none"),K()){var nt=U(),Ct=nt.box,xr=nt.content;za([Ct,xr],0)}f=function(){var Un;if(!(!b.state.isVisible||u)){if(u=!0,w.offsetHeight,w.style.transition=b.props.moveTransition,K()&&b.props.animation){var Ea=U(),ps=Ea.box,wr=Ea.content;za([ps,wr],ge),Id([ps,wr],"visible")}O(),D(),Dd(qa,b),(Un=b.popperInstance)==null||Un.forceUpdate(),C("onMount",[b]),b.props.animation&&K()&&Be(ge,function(){b.state.isShown=!0,C("onShown",[b])})}},tt()}}function Z(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,Cr("hide"));var A=!b.state.isVisible,W=b.state.isDestroyed,re=!b.state.isEnabled,we=Va(b.props.duration,1,bt.duration);if(!(A||W||re)&&(C("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,K()&&(w.style.visibility="hidden"),V(),pe(),E(!0),K()){var ge=U(),nt=ge.box,Ct=ge.content;b.props.animation&&(za([nt,Ct],we),Id([nt,Ct],"hidden"))}O(),D(),b.props.animation?K()&&ot(we,b.unmount):b.unmount()}}function fe(A){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,Cr("hideWithInteractivity")),j().addEventListener("mousemove",p),Dd(ks,p),p(A)}function Le(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,Cr("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(R(),ie().forEach(function(A){A._tippy.unmount()}),w.parentNode&&w.parentNode.removeChild(w),qa=qa.filter(function(A){return A!==b}),b.state.isMounted=!1,C("onHidden",[b]))}function di(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,Cr("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),$t(),delete t._tippy,b.state.isDestroyed=!0,C("onDestroy",[b]))}}function De(t,e){e===void 0&&(e={});var n=bt.plugins.concat(e.plugins||[]);St.NODE_ENV!=="production"&&(dx(t),N0(e,n)),ox();var r=Object.assign({},e,{plugins:n}),i=tx(t);if(St.NODE_ENV!=="production"){var s=Vi(r.content),o=i.length>1;dn(s&&o,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",` +`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function ie(){return fo(w.querySelectorAll("[data-tippy-root]"))}function X(A){b.clearDelayTimeouts(),A&&C("onTrigger",[b,A]),se();var W=te(!0),re=I(),we=re[0],ge=re[1];Zt.isTouch&&we==="hold"&&ge&&(W=ge),W?r=setTimeout(function(){b.show()},W):b.show()}function Ze(A){if(b.clearDelayTimeouts(),C("onUntrigger",[b,A]),!b.state.isVisible){pe();return}if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(A.type)>=0&&o)){var W=te(!1);W?i=setTimeout(function(){b.state.isVisible&&b.hide()},W):s=requestAnimationFrame(function(){b.hide()})}}function Ne(){b.state.isEnabled=!0}function Et(){b.hide(),b.state.isEnabled=!1}function kt(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(s)}function S(A){if(St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,_r("setProps")),!b.state.isDestroyed){C("onBeforeUpdate",[b,A]),$t();var W=b.props,re=Pd(t,Object.assign({},W,Dd(A),{ignoreAttributes:!0}));b.props=re,xt(),W.interactiveDebounce!==re.interactiveDebounce&&(V(),p=Nd(He,re.interactiveDebounce)),W.triggerTarget&&!re.triggerTarget?Rr(W.triggerTarget).forEach(function(we){we.removeAttribute("aria-expanded")}):re.triggerTarget&&t.removeAttribute("aria-expanded"),D(),E(),_&&_(W,re),b.popperInstance&&(wt(),ie().forEach(function(we){requestAnimationFrame(we._tippy.popperInstance.forceUpdate)})),C("onAfterUpdate",[b,A])}}function T(A){b.setProps({content:A})}function P(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,_r("show"));var A=b.state.isVisible,W=b.state.isDestroyed,re=!b.state.isEnabled,we=Zt.isTouch&&!b.props.touch,ge=Va(b.props.duration,0,bt.duration);if(!(A||W||re||we)&&!z().hasAttribute("disabled")&&(C("onShow",[b],!1),b.props.onShow(b)!==!1)){if(b.state.isVisible=!0,K()&&(w.style.visibility="visible"),E(),se(),b.state.isMounted||(w.style.transition="none"),K()){var nt=U(),Ct=nt.box,wr=nt.content;za([Ct,wr],0)}f=function(){var Un;if(!(!b.state.isVisible||u)){if(u=!0,w.offsetHeight,w.style.transition=b.props.moveTransition,K()&&b.props.animation){var Ea=U(),ps=Ea.box,Er=Ea.content;za([ps,Er],ge),Rd([ps,Er],"visible")}O(),D(),Ld(qa,b),(Un=b.popperInstance)==null||Un.forceUpdate(),C("onMount",[b]),b.props.animation&&K()&&Be(ge,function(){b.state.isShown=!0,C("onShown",[b])})}},tt()}}function Z(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,_r("hide"));var A=!b.state.isVisible,W=b.state.isDestroyed,re=!b.state.isEnabled,we=Va(b.props.duration,1,bt.duration);if(!(A||W||re)&&(C("onHide",[b],!1),b.props.onHide(b)!==!1)){if(b.state.isVisible=!1,b.state.isShown=!1,u=!1,o=!1,K()&&(w.style.visibility="hidden"),V(),pe(),E(!0),K()){var ge=U(),nt=ge.box,Ct=ge.content;b.props.animation&&(za([nt,Ct],we),Rd([nt,Ct],"hidden"))}O(),D(),b.props.animation?K()&&ot(we,b.unmount):b.unmount()}}function fe(A){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,_r("hideWithInteractivity")),j().addEventListener("mousemove",p),Ld(ks,p),p(A)}function Le(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,_r("unmount")),b.state.isVisible&&b.hide(),b.state.isMounted&&(R(),ie().forEach(function(A){A._tippy.unmount()}),w.parentNode&&w.parentNode.removeChild(w),qa=qa.filter(function(A){return A!==b}),b.state.isMounted=!1,C("onHidden",[b]))}function fi(){St.NODE_ENV!=="production"&&dn(b.state.isDestroyed,_r("destroy")),!b.state.isDestroyed&&(b.clearDelayTimeouts(),b.unmount(),$t(),delete t._tippy,b.state.isDestroyed=!0,C("onDestroy",[b]))}}function De(t,e){e===void 0&&(e={});var n=bt.plugins.concat(e.plugins||[]);St.NODE_ENV!=="production"&&(dx(t),N0(e,n)),ox();var r=Object.assign({},e,{plugins:n}),i=tx(t);if(St.NODE_ENV!=="production"){var s=zi(r.content),o=i.length>1;dn(s&&o,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",` `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",` `,`1) content: element.innerHTML -`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,u){var c=u&&yx(u,r);return c&&l.push(c),l},[]);return Vi(t)?a[0]:a}De.defaultProps=bt;De.setDefaultProps=px;De.currentInput=Zt;Object.assign({},p0,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});De.setDefaultProps({render:L0});class li extends he{constructor(){super(...arguments);B(this,"tippyInstance");B(this,"tippyEl");B(this,"textEl");B(this,"menuData",[]);B(this,"menuTextWidth","fit-content");B(this,"defaultMenuIndex",0);B(this,"refreshMenuText",!0);B(this,"width","fit-content");B(this,"dropDivWith","100px");B(this,"dropDivHeight","fit-content");B(this,"showItemsTip",!1)}renderTemplate(){this.template=` +`,"2) content: () => element.cloneNode(true)"].join(" "))}var a=i.reduce(function(l,u){var c=u&&yx(u,r);return c&&l.push(c),l},[]);return zi(t)?a[0]:a}De.defaultProps=bt;De.setDefaultProps=px;De.currentInput=Zt;Object.assign({},p0,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});De.setDefaultProps({render:L0});class ui extends he{constructor(){super(...arguments);B(this,"tippyInstance");B(this,"tippyEl");B(this,"textEl");B(this,"menuData",[]);B(this,"menuTextWidth","fit-content");B(this,"defaultMenuIndex",0);B(this,"refreshMenuText",!0);B(this,"width","fit-content");B(this,"dropDivWith","100px");B(this,"dropDivHeight","fit-content");B(this,"showItemsTip",!1)}renderTemplate(){this.template=`
@@ -128,7 +128,7 @@ img.ProseMirror-separator { `}connectedCallback(){this.renderTemplate(),super.connectedCallback(),this.textEl=this.querySelector("#text"),this.tippyInstance=De(this.querySelector("#tippy"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const n=document.createElement("div");n.style.height=this.dropDivHeight,n.style.width=this.dropDivWith,n.classList.add("aie-dropdown-container");for(let r=0;r
${this.onDropdownItemRender(r)}
- `,i.addEventListener("click",s=>{const o=this.menuData[r];o.onClick?o.onClick(s)&&this.tippyInstance.hide():(this.onDropdownItemClick(r),this.tippyInstance.hide())}),this.showItemsTip){const s=this.menuData[r];De(i,{appendTo:()=>this.closest(".aie-container"),content:s.tip||s.title,theme:"aietip",arrow:!0,placement:"right"})}n.appendChild(i)}return this.tippyEl=n,n}onTransaction(n){var s,o;const r=(s=this.tippyEl)==null?void 0:s.querySelector(".red-dot");r&&r.classList.remove("red-dot");let i=this.defaultMenuIndex;for(let a=0;a1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||vx,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e]=this.observers[e].filter(r=>r!==n)}}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{o(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(o=>{o.apply(o,[e,...r])})}}function pi(){let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n}function zd(t){return t==null?"":""+t}function xx(t,e,n){t.forEach(r=>{e[r]&&(n[r]=e[r])})}function $u(t,e,n){function r(o){return o&&o.indexOf("###")>-1?o.replace(/###/g,"."):o}function i(){return!t||typeof t=="string"}const s=typeof e!="string"?[].concat(e):e.split(".");for(;s.length>1;){if(i())return{};const o=r(s.shift());!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={}}return i()?{}:{obj:t,k:r(s.shift())}}function Ud(t,e,n){const{obj:r,k:i}=$u(t,e,Object);r[i]=n}function wx(t,e,n,r){const{obj:i,k:s}=$u(t,e,Object);i[s]=i[s]||[],i[s].push(n)}function po(t,e){const{obj:n,k:r}=$u(t,e);if(n)return n[r]}function Ex(t,e,n){const r=po(t,n);return r!==void 0?r:po(e,n)}function D0(t,e,n){for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):D0(t[r],e[r],n):t[r]=e[r]);return t}function _r(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kx={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Cx(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,e=>kx[e]):t}const _x=[" ",",","?","!",";"];function Sx(t,e,n){e=e||"",n=n||"";const r=_x.filter(o=>e.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(t);if(!s){const o=t.indexOf(n);o>0&&!i.test(t.substring(0,o))&&(s=!0)}return s}function go(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const r=e.split(n);let i=t;for(let s=0;ss+o;)o++,a=r.slice(s,s+o).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const u=r.slice(s+o).join(n);return u?go(l,u,n):void 0}i=i[r[s]]}return i}function mo(t){return t&&t.indexOf("_")>0?t.replace("_","-"):t}class qd extends aa{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[e,n];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(a=e.split("."));const l=po(this.data,a);return l||!o||typeof r!="string"?l:go(this.data&&this.data[e]&&this.data[e][n],r,s)}addResource(e,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,n];r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."),i=n,n=a[1]),this.addNamespaces(n),Ud(this.data,a,i),s.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(typeof r[s]=="string"||Object.prototype.toString.apply(r[s])==="[object Array]")&&this.addResource(e,n,s,r[s],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=po(this.data,a)||{};i?D0(l,r,s):l={...l,...r},Ud(this.data,a,l),o.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var R0={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(s=>{this.processors[s]&&(e=this.processors[s].process(e,n,r,i))}),e}};const Zd={};class bo extends aa{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),xx(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Wt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return r&&r.res!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Sx(e,r,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:s};const u=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(i)}return typeof s=="string"&&(s=[s]),{key:e,namespaces:s}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${b}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const d=this.resolve(e,n);let f=d&&d.res;const h=d&&d.usedKey||o,p=d&&d.exactUsedKey||o,g=Object.prototype.toString.apply(f),m=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&m.indexOf(g)<0&&!(typeof y=="string"&&g==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d.usedParams=this.getUsedParamsDetails(n),d):b}if(s){const b=g==="[object Array]",k=b?[]:{},w=b?p:h;for(const _ in f)if(Object.prototype.hasOwnProperty.call(f,_)){const N=`${w}${s}${_}`;k[_]=this.translate(N,{...n,joinArrays:!1,ns:a}),k[_]===N&&(k[_]=f[_])}f=k}}else if(v&&typeof y=="string"&&g==="[object Array]")f=f.join(y),f&&(f=this.extendTranslation(f,e,n,r));else{let b=!1,k=!1;const w=n.count!==void 0&&typeof n.count!="string",_=bo.hasDefaultValue(n),N=w?this.pluralResolver.getSuffix(u,n.count,n):"",M=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",I=n[`defaultValue${N}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(f)&&_&&(b=!0,f=I),this.isValidLookup(f)||(k=!0,f=o);const K=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&k?void 0:f,z=_&&I!==f&&this.options.updateMissing;if(k||b||z){if(this.logger.log(z?"updateKey":"missingKey",u,l,o,z?I:f),s){const E=this.resolve(o,{...n,keySeparator:!1});E&&E.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let j=[];const U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let E=0;E{const D=_&&O!==f?O:K;this.options.missingKeyHandler?this.options.missingKeyHandler(E,l,C,D,z,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(E,l,C,D,z,n),this.emit("missingKey",E,l,C,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?j.forEach(E=>{this.pluralResolver.getSuffixes(E,n).forEach(C=>{te([E],o+C,n[`defaultValue${C}`]||I)})}):te(j,o,I))}f=this.extendTranslation(f,e,n,d,r),k&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${o}`),(k||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(e,n,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof e=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=e.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,r.lng||this.language,r),u){const f=e.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,a;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",g=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(m=>{this.isValidLookup(r)||(a=m,!Zd[`${g[0]}-${m}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(Zd[`${g[0]}-${m}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(y=>{if(this.isValidLookup(r))return;o=y;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,y,m,n);else{let b;f&&(b=this.pluralResolver.getSuffix(y,n.count,n));const k=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+b),n.ordinal&&b.indexOf(w)===0&&v.push(c+b.replace(w,this.options.pluralSeparator)),h&&v.push(c+k)),p){const _=`${c}${this.options.contextSeparator}${n.context}`;v.push(_),f&&(v.push(_+b),n.ordinal&&b.indexOf(w)===0&&v.push(_+b.replace(w,this.options.pluralSeparator)),h&&v.push(_+k))}}let x;for(;x=v.pop();)this.isValidLookup(r)||(s=x,r=this.getResource(y,m,x,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&typeof e.replace!="string";let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of n)delete i[s]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}function Za(t){return t.charAt(0).toUpperCase()+t.slice(1)}class Kd{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Wt.create("languageUtils")}getScriptPartFromCode(e){if(e=mo(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=mo(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=e.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Za(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Za(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Za(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&s.indexOf(i)===0)return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):typeof e=="string"&&s(this.formatLanguageCode(e)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let Mx=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Ax={1:function(t){return+(t>1)},2:function(t){return+(t!=1)},3:function(t){return 0},4:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},5:function(t){return t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},6:function(t){return t==1?0:t>=2&&t<=4?1:2},7:function(t){return t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},8:function(t){return t==1?0:t==2?1:t!=8&&t!=11?2:3},9:function(t){return+(t>=2)},10:function(t){return t==1?0:t==2?1:t<7?2:t<11?3:4},11:function(t){return t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3},12:function(t){return+(t%10!=1||t%100==11)},13:function(t){return+(t!==0)},14:function(t){return t==1?0:t==2?1:t==3?2:3},15:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2},16:function(t){return t%10==1&&t%100!=11?0:t!==0?1:2},17:function(t){return t==1||t%10==1&&t%100!=11?0:1},18:function(t){return t==0?0:t==1?1:2},19:function(t){return t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3},20:function(t){return t==1?0:t==0||t%100>0&&t%100<20?1:2},21:function(t){return t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0},22:function(t){return t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3}};const Tx=["v1","v2","v3"],Ox=["v4"],Wd={zero:0,one:1,two:2,few:3,many:4,other:5};function Nx(){const t={};return Mx.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:Ax[e.fc]}})}),t}class Lx{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=Wt.create("pluralResolver"),(!this.options.compatibilityJSON||Ox.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Nx()}addRule(e,n){this.rules[e]=n}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(mo(e),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>Wd[i]-Wd[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(e,i,n)):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const r=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let i=e.numbers[r];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Tx.includes(this.options.compatibilityJSON)}}function jd(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=Ex(t,e,n);return!s&&i&&typeof n=="string"&&(s=go(t,n,r),s===void 0&&(s=go(e,n,r))),s}class Dx{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Wt.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const n=e.interpolation;this.escape=n.escape!==void 0?n.escape:Cx,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?_r(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?_r(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?_r(n.nestingPrefix):n.nestingPrefixEscaped||_r("$t("),this.nestingSuffix=n.nestingSuffix?_r(n.nestingSuffix):n.nestingSuffixEscaped||_r(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(e,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(e,n,r,i){let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=jd(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const g=p.split(this.formatSeparator),m=g.shift().trim(),y=g.join(this.formatSeparator).trim();return this.format(jd(n,l,m,this.options.keySeparator,this.options.ignoreJSONStructure),y,r,{...i,...n,interpolationkey:m})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(a=0;s=p.regex.exec(e);){const g=s[1].trim();if(o=c(g),o===void 0)if(typeof d=="function"){const y=d(e,s,i);o=typeof y=="string"?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else typeof o!="string"&&!this.useRawValueToEscape&&(o=zd(o));const m=p.safeValue(o);if(e=e.replace(s[0],m),f?(p.regex.lastIndex+=o.length,p.regex.lastIndex-=s[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;function a(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,o);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${c}${f}`}return delete o.defaultValue,l}for(;i=this.nestingRegexp.exec(e);){let l=[];o={...r},o=o.replace&&typeof o.replace!="string"?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(s=n(a.call(this,i[1].trim(),o),o),s&&i[0]===e&&typeof s!="string")return s;typeof s!="string"&&(s=zd(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),u&&(s=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}function Rx(t){let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(!o)return;const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[a.trim()]||(n[a.trim()]=u),u==="false"&&(n[a.trim()]=!1),u==="true"&&(n[a.trim()]=!0),isNaN(u)||(n[a.trim()]=parseInt(u,10))})}return{formatName:e,formatOptions:n}}function Sr(t){const e={};return function(r,i,s){const o=i+JSON.stringify(s);let a=e[o];return a||(a=t(mo(i),s),e[o]=a),a(r)}}class Ix{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Wt.create("formatter"),this.options=e,this.formats={number:Sr((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:Sr((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:Sr((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:Sr((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:Sr((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},this.init(e)}init(e){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Sr(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,l)=>{const{formatName:u,formatOptions:c}=Rx(l);if(this.formats[u]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](a,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},e)}}function Hx(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}class Bx extends aa{constructor(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Wt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(e,n,r,i){const s={},o={},a={},l={};return e.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,c=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,n,r){const i=e.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),r&&this.store.addResourceBundle(s,o,r),this.state[e]=n?-1:2;const a={};this.queue.forEach(l=>{wx(l.loaded,[s],o),Hx(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,e,n,r,i+1,s*2,o)},s);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(e,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(e,n,a)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof n=="string"&&(n=[n]);const s=this.queueLoad(e,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(e,n,r,i,l):c=u(e,n,r,i),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(e,n,r,i,a,l)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}function Gd(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let n={};if(typeof e[1]=="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(t,e,n,r)=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Jd(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Cs(){}function Px(t){Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}class Ui extends aa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Jd(e),this.services={},this.logger=Wt,this.modules={external:[]},Px(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Gd();this.options={...i,...this.options,...Jd(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function s(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Wt.init(s(this.modules.logger),this.options):Wt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Ix);const d=new Kd(this.options);this.store=new qd(this.options.resources,this.options);const f=this.services;f.logger=Wt,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Lx(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Dx(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Bx(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),m=1;m1?p-1:0),m=1;m{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Cs),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return e.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return e.store[c](...arguments),e}});const l=pi(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cs;const i=typeof e=="string"?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(e,n,r){const i=pi();return e||(e=this.languages),n||(n=this.options.ns),r||(r=Cs),this.services.backendConnector.reload(e,n,s=>{i.resolve(),r(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&R0.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,n){var r=this;this.isLanguageChangingTo=e;const i=pi();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{o(c,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),i}getFixedT(e,n,r){var i=this;const s=function(o,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${o}`:o,i.t(h,l)};return typeof e=="string"?s.lng=e:s.lngs=e,s.ns=n,s.keyPrefix=r,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}loadNamespaces(e,n){const r=pi();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=pi();typeof e=="string"&&(e=[e]);const i=this.options.preload||[],s=e.filter(o=>i.indexOf(o)<0);return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new Kd(Gd());return n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Ui(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cs;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new Ui(i);return(e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new qd(this.store.data,i),s.services.resourceStore=s.store),s.translator=new bo(s.services,i),s.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;cce(e)),this.dropDivHeight="265px",this.dropDivWith="fit-content"}onDropdownActive(e,n){return n==0?e.isActive("paragraph"):e.isActive("heading",{level:n})}onDropdownItemClick(e){e==0?this.editor.chain().setParagraph().run():this.editor.chain().setHeading({level:e}).run()}onDropdownItemRender(e){return e==0?this.menuData[e]:`${this.menuData[e]}`}onMenuTextRender(e){return this.menuData[e].replace(" ","")}};const Vx=[{name:"宋体",value:"SimSun"},{name:"仿宋",value:"FangSong"},{name:"黑体",value:"SimHei"},{name:"楷体",value:"KaiTi"},{name:"微软雅黑",value:"Microsoft YaHei"},{name:"方正仿宋简体_GBK",value:"FangSong_GB2312"},{name:"Arial",value:"Arial"}];let zx=class extends li{constructor(){super(),this.width="72px",this.menuTextWidth="60px",this.dropDivWith="150px"}onCreate(e,n){var r;super.onCreate(e,n),this.menuData=((r=n.fontFamily)==null?void 0:r.values)||Vx,this.menuData=[{name:ce("default-font-family"),value:""}].concat(this.menuData)}onDropdownActive(e,n){return e.isActive("textStyle",{fontFamily:this.menuData[n].value})}onDropdownItemClick(e){const n=this.menuData[e].value;n?this.editor.chain().setFontFamily(n).run():this.editor.chain().unsetFontFamily().run()}onDropdownItemRender(e){return this.menuData[e].name}onMenuTextRender(e){return this.menuData[e].name}};const Ux=[{name:"9",value:9},{name:"10",value:10},{name:"11",value:11},{name:"12",value:12},{name:"14",value:14},{name:"18",value:18},{name:"20",value:20},{name:"22",value:22},{name:"24",value:24},{name:"26",value:26},{name:"28",value:28},{name:"30",value:30},{name:"36",value:36},{name:"42",value:42},{name:"48",value:48},{name:"56",value:56},{name:"72",value:72}];class qx extends li{constructor(){super();B(this,"defaultValue",14);this.dropDivWith="134px"}onCreate(n,r){var i,s;super.onCreate(n,r),this.menuData=((i=r.fontSize)==null?void 0:i.values)||Ux,this.defaultValue=((s=r.fontSize)==null?void 0:s.defaultValue)||this.defaultValue;for(let o=0;o{const o=this.menuData[r];o.onClick?o.onClick(s)&&this.tippyInstance.hide():(this.onDropdownItemClick(r),this.tippyInstance.hide())}),this.showItemsTip){const s=this.menuData[r];De(i,{appendTo:()=>this.closest(".aie-container"),content:s.tip||s.title,theme:"aietip",arrow:!0,placement:"right"})}n.appendChild(i)}return this.tippyEl=n,n}onTransaction(n){var s,o;const r=(s=this.tippyEl)==null?void 0:s.querySelector(".red-dot");r&&r.classList.remove("red-dot");let i=this.defaultMenuIndex;for(let a=0;a1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||vx,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e]=this.observers[e].filter(r=>r!==n)}}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{o(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(o=>{o.apply(o,[e,...r])})}}function gi(){let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n}function Vd(t){return t==null?"":""+t}function xx(t,e,n){t.forEach(r=>{e[r]&&(n[r]=e[r])})}function Fu(t,e,n){function r(o){return o&&o.indexOf("###")>-1?o.replace(/###/g,"."):o}function i(){return!t||typeof t=="string"}const s=typeof e!="string"?[].concat(e):e.split(".");for(;s.length>1;){if(i())return{};const o=r(s.shift());!t[o]&&n&&(t[o]=new n),Object.prototype.hasOwnProperty.call(t,o)?t=t[o]:t={}}return i()?{}:{obj:t,k:r(s.shift())}}function zd(t,e,n){const{obj:r,k:i}=Fu(t,e,Object);r[i]=n}function wx(t,e,n,r){const{obj:i,k:s}=Fu(t,e,Object);i[s]=i[s]||[],i[s].push(n)}function po(t,e){const{obj:n,k:r}=Fu(t,e);if(n)return n[r]}function Ex(t,e,n){const r=po(t,n);return r!==void 0?r:po(e,n)}function D0(t,e,n){for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):D0(t[r],e[r],n):t[r]=e[r]);return t}function Sr(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var kx={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Cx(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,e=>kx[e]):t}const _x=[" ",",","?","!",";"];function Sx(t,e,n){e=e||"",n=n||"";const r=_x.filter(o=>e.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(t);if(!s){const o=t.indexOf(n);o>0&&!i.test(t.substring(0,o))&&(s=!0)}return s}function go(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const r=e.split(n);let i=t;for(let s=0;ss+o;)o++,a=r.slice(s,s+o).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const u=r.slice(s+o).join(n);return u?go(l,u,n):void 0}i=i[r[s]]}return i}function mo(t){return t&&t.indexOf("_")>0?t.replace("_","-"):t}class Ud extends aa{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[e,n];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(a=e.split("."));const l=po(this.data,a);return l||!o||typeof r!="string"?l:go(this.data&&this.data[e]&&this.data[e][n],r,s)}addResource(e,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let a=[e,n];r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."),i=n,n=a[1]),this.addNamespaces(n),zd(this.data,a,i),s.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(typeof r[s]=="string"||Object.prototype.toString.apply(r[s])==="[object Array]")&&this.addResource(e,n,s,r[s],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=po(this.data,a)||{};i?D0(l,r,s):l={...l,...r},zd(this.data,a,l),o.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var R0={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(s=>{this.processors[s]&&(e=this.processors[s].process(e,n,r,i))}),e}};const qd={};class bo extends aa{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),xx(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Wt.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return r&&r.res!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Sx(e,r,i);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:s};const u=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),e=u.join(i)}return typeof s=="string"&&(s=[s]),{key:e,namespaces:s}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],n),l=a[a.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${o}`,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${b}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:o}const d=this.resolve(e,n);let f=d&&d.res;const h=d&&d.usedKey||o,p=d&&d.exactUsedKey||o,g=Object.prototype.toString.apply(f),m=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject;if(v&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&m.indexOf(g)<0&&!(typeof y=="string"&&g==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d.usedParams=this.getUsedParamsDetails(n),d):b}if(s){const b=g==="[object Array]",k=b?[]:{},w=b?p:h;for(const _ in f)if(Object.prototype.hasOwnProperty.call(f,_)){const N=`${w}${s}${_}`;k[_]=this.translate(N,{...n,joinArrays:!1,ns:a}),k[_]===N&&(k[_]=f[_])}f=k}}else if(v&&typeof y=="string"&&g==="[object Array]")f=f.join(y),f&&(f=this.extendTranslation(f,e,n,r));else{let b=!1,k=!1;const w=n.count!==void 0&&typeof n.count!="string",_=bo.hasDefaultValue(n),N=w?this.pluralResolver.getSuffix(u,n.count,n):"",M=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",I=n[`defaultValue${N}`]||n[`defaultValue${M}`]||n.defaultValue;!this.isValidLookup(f)&&_&&(b=!0,f=I),this.isValidLookup(f)||(k=!0,f=o);const K=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&k?void 0:f,z=_&&I!==f&&this.options.updateMissing;if(k||b||z){if(this.logger.log(z?"updateKey":"missingKey",u,l,o,z?I:f),s){const E=this.resolve(o,{...n,keySeparator:!1});E&&E.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let j=[];const U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&U&&U[0])for(let E=0;E{const D=_&&O!==f?O:K;this.options.missingKeyHandler?this.options.missingKeyHandler(E,l,C,D,z,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(E,l,C,D,z,n),this.emit("missingKey",E,l,C,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?j.forEach(E=>{this.pluralResolver.getSuffixes(E,n).forEach(C=>{te([E],o+C,n[`defaultValue${C}`]||I)})}):te(j,o,I))}f=this.extendTranslation(f,e,n,d,r),k&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${o}`),(k||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${o}`:o,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(e,n,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof e=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=e.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,r.lng||this.language,r),u){const f=e.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,a;return typeof e=="string"&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",g=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(m=>{this.isValidLookup(r)||(a=m,!qd[`${g[0]}-${m}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(qd[`${g[0]}-${m}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(y=>{if(this.isValidLookup(r))return;o=y;const v=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,c,y,m,n);else{let b;f&&(b=this.pluralResolver.getSuffix(y,n.count,n));const k=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(c+b),n.ordinal&&b.indexOf(w)===0&&v.push(c+b.replace(w,this.options.pluralSeparator)),h&&v.push(c+k)),p){const _=`${c}${this.options.contextSeparator}${n.context}`;v.push(_),f&&(v.push(_+b),n.ordinal&&b.indexOf(w)===0&&v.push(_+b.replace(w,this.options.pluralSeparator)),h&&v.push(_+k))}}let x;for(;x=v.pop();)this.isValidLookup(r)||(s=x,r=this.getResource(y,m,x,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&typeof e.replace!="string";let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of n)delete i[s]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}function Za(t){return t.charAt(0).toUpperCase()+t.slice(1)}class Zd{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Wt.create("languageUtils")}getScriptPartFromCode(e){if(e=mo(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=mo(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(typeof e=="string"&&e.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=e.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Za(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Za(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Za(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&s.indexOf(i)===0)return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),typeof e=="string"&&(e=[e]),Object.prototype.toString.apply(e)==="[object Array]")return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return typeof e=="string"&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(e))):typeof e=="string"&&s(this.formatLanguageCode(e)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let Mx=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Ax={1:function(t){return+(t>1)},2:function(t){return+(t!=1)},3:function(t){return 0},4:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},5:function(t){return t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5},6:function(t){return t==1?0:t>=2&&t<=4?1:2},7:function(t){return t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2},8:function(t){return t==1?0:t==2?1:t!=8&&t!=11?2:3},9:function(t){return+(t>=2)},10:function(t){return t==1?0:t==2?1:t<7?2:t<11?3:4},11:function(t){return t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3},12:function(t){return+(t%10!=1||t%100==11)},13:function(t){return+(t!==0)},14:function(t){return t==1?0:t==2?1:t==3?2:3},15:function(t){return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2},16:function(t){return t%10==1&&t%100!=11?0:t!==0?1:2},17:function(t){return t==1||t%10==1&&t%100!=11?0:1},18:function(t){return t==0?0:t==1?1:2},19:function(t){return t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3},20:function(t){return t==1?0:t==0||t%100>0&&t%100<20?1:2},21:function(t){return t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0},22:function(t){return t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3}};const Tx=["v1","v2","v3"],Ox=["v4"],Kd={zero:0,one:1,two:2,few:3,many:4,other:5};function Nx(){const t={};return Mx.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:Ax[e.fc]}})}),t}class Lx{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=Wt.create("pluralResolver"),(!this.options.compatibilityJSON||Ox.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Nx()}addRule(e,n){this.rules[e]=n}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(mo(e),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,s)=>Kd[i]-Kd[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(e,i,n)):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const r=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let i=e.numbers[r];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Tx.includes(this.options.compatibilityJSON)}}function Wd(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=Ex(t,e,n);return!s&&i&&typeof n=="string"&&(s=go(t,n,r),s===void 0&&(s=go(e,n,r))),s}class Dx{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Wt.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const n=e.interpolation;this.escape=n.escape!==void 0?n.escape:Cx,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?Sr(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?Sr(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?Sr(n.nestingPrefix):n.nestingPrefixEscaped||Sr("$t("),this.nestingSuffix=n.nestingSuffix?Sr(n.nestingSuffix):n.nestingSuffixEscaped||Sr(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(e,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(e,n,r,i){let s,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const v=Wd(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(v,void 0,r,{...i,...n,interpolationkey:p}):v}const g=p.split(this.formatSeparator),m=g.shift().trim(),y=g.join(this.formatSeparator).trim();return this.format(Wd(n,l,m,this.options.keySeparator,this.options.ignoreJSONStructure),y,r,{...i,...n,interpolationkey:m})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(a=0;s=p.regex.exec(e);){const g=s[1].trim();if(o=c(g),o===void 0)if(typeof d=="function"){const y=d(e,s,i);o=typeof y=="string"?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,g))o="";else if(f){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else typeof o!="string"&&!this.useRawValueToEscape&&(o=Vd(o));const m=p.safeValue(o);if(e=e.replace(s[0],m),f?(p.regex.lastIndex+=o.length,p.regex.lastIndex-=s[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,s,o;function a(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,o);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),u&&(o={...u,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${c}${f}`}return delete o.defaultValue,l}for(;i=this.nestingRegexp.exec(e);){let l=[];o={...r},o=o.replace&&typeof o.replace!="string"?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(s=n(a.call(this,i[1].trim(),o),o),s&&i[0]===e&&typeof s!="string")return s;typeof s!="string"&&(s=Vd(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),s=""),u&&(s=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e}}function Rx(t){let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(!o)return;const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[a.trim()]||(n[a.trim()]=u),u==="false"&&(n[a.trim()]=!1),u==="true"&&(n[a.trim()]=!0),isNaN(u)||(n[a.trim()]=parseInt(u,10))})}return{formatName:e,formatOptions:n}}function Mr(t){const e={};return function(r,i,s){const o=i+JSON.stringify(s);let a=e[o];return a||(a=t(mo(i),s),e[o]=a),a(r)}}class Ix{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Wt.create("formatter"),this.options=e,this.formats={number:Mr((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:Mr((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:Mr((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:Mr((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:Mr((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},this.init(e)}init(e){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Mr(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,l)=>{const{formatName:u,formatOptions:c}=Rx(l);if(this.formats[u]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](a,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},e)}}function Hx(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}class Bx extends aa{constructor(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Wt.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(e,n,r,i){const s={},o={},a={},l={};return e.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,c=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,n,r){const i=e.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),r&&this.store.addResourceBundle(s,o,r),this.state[e]=n?-1:2;const a={};this.queue.forEach(l=>{wx(l.loaded,[s],o),Hx(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,e,n,r,i+1,s*2,o)},s);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(e,n);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(e,n,a)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof e=="string"&&(e=this.languageUtils.toResolveHierarchy(e)),typeof n=="string"&&(n=[n]);const s=this.queueLoad(e,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&a&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,a),this.loaded(e,o,a)})}saveMissing(e,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...o,isUpdate:s},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(e,n,r,i,l):c=u(e,n,r,i),c&&typeof c.then=="function"?c.then(d=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(e,n,r,i,a,l)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}}function jd(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let n={};if(typeof e[1]=="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(t,e,n,r)=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Gd(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Cs(){}function Px(t){Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}class qi extends aa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Gd(e),this.services={},this.logger=Wt,this.modules={external:[]},Px(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=jd();this.options={...i,...this.options,...Gd(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function s(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?Wt.init(s(this.modules.logger),this.options):Wt.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Ix);const d=new Zd(this.options);this.store=new Ud(this.options.resources,this.options);const f=this.services;f.logger=Wt,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Lx(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Dx(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Bx(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),m=1;m1?p-1:0),m=1;m{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Cs),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return e.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return e.store[c](...arguments),e}});const l=gi(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cs;const i=typeof e=="string"?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{u!=="cimode"&&s.indexOf(u)<0&&s.push(u)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>o(l)),this.options.preload&&this.options.preload.forEach(a=>o(a)),this.services.backendConnector.load(s,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(e,n,r){const i=gi();return e||(e=this.languages),n||(n=this.options.ns),r||(r=Cs),this.services.backendConnector.reload(e,n,s=>{i.resolve(),r(s)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&R0.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,n){var r=this;this.isLanguageChangingTo=e;const i=gi();this.emit("languageChanging",e);const s=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,u)=>{u?(s(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{o(c,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),i}getFixedT(e,n,r){var i=this;const s=function(o,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${o}`:o,i.t(h,l)};return typeof e=="string"?s.lng=e:s.lngs=e,s.ns=n,s.keyPrefix=r,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}loadNamespaces(e,n){const r=gi();return this.options.ns?(typeof e=="string"&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=gi();typeof e=="string"&&(e=[e]);const i=this.options.preload||[],s=e.filter(o=>i.indexOf(o)<0);return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),r):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new Zd(jd());return n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new qi(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cs;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},s=new qi(i);return(e.debug!==void 0||e.prefix!==void 0)&&(s.logger=s.logger.clone(e)),["store","services","language"].forEach(a=>{s[a]=this[a]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new Ud(this.store.data,i),s.services.resourceStore=s.store),s.translator=new bo(s.services,i),s.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;cce(e)),this.dropDivHeight="265px",this.dropDivWith="fit-content"}onDropdownActive(e,n){return n==0?e.isActive("paragraph"):e.isActive("heading",{level:n})}onDropdownItemClick(e){e==0?this.editor.chain().setParagraph().run():this.editor.chain().setHeading({level:e}).run()}onDropdownItemRender(e){return e==0?this.menuData[e]:`${this.menuData[e]}`}onMenuTextRender(e){return this.menuData[e].replace(" ","")}};const Vx=[{name:"宋体",value:"SimSun"},{name:"仿宋",value:"FangSong"},{name:"黑体",value:"SimHei"},{name:"楷体",value:"KaiTi"},{name:"微软雅黑",value:"Microsoft YaHei"},{name:"方正仿宋简体_GBK",value:"FangSong_GB2312"},{name:"Arial",value:"Arial"}];let zx=class extends ui{constructor(){super(),this.width="72px",this.menuTextWidth="60px",this.dropDivWith="150px"}onCreate(e,n){var r;super.onCreate(e,n),this.menuData=((r=n.fontFamily)==null?void 0:r.values)||Vx,this.menuData=[{name:ce("default-font-family"),value:""}].concat(this.menuData)}onDropdownActive(e,n){return e.isActive("textStyle",{fontFamily:this.menuData[n].value})}onDropdownItemClick(e){const n=this.menuData[e].value;n?this.editor.chain().setFontFamily(n).run():this.editor.chain().unsetFontFamily().run()}onDropdownItemRender(e){return this.menuData[e].name}onMenuTextRender(e){return this.menuData[e].name}};const Ux=[{name:"9",value:9},{name:"10",value:10},{name:"11",value:11},{name:"12",value:12},{name:"14",value:14},{name:"18",value:18},{name:"20",value:20},{name:"22",value:22},{name:"24",value:24},{name:"26",value:26},{name:"28",value:28},{name:"30",value:30},{name:"36",value:36},{name:"42",value:42},{name:"48",value:48},{name:"56",value:56},{name:"72",value:72}];class qx extends ui{constructor(){super();B(this,"defaultValue",14);this.dropDivWith="134px"}onCreate(n,r){var i,s;super.onCreate(n,r),this.menuData=((i=r.fontSize)==null?void 0:i.values)||Ux,this.defaultValue=((s=r.fontSize)==null?void 0:s.defaultValue)||this.defaultValue;for(let o=0;o
@@ -199,7 +199,7 @@ img.ProseMirror-separator {
- `,this.registerClickListener()}onClick(e){e.indent()}}const ow=[{icon:'
',title:"align-left",value:"left"},{icon:'
',title:"align-center",value:"center"},{icon:'
',title:"align-right",value:"right"},{icon:'
',title:"align-justify",value:"justify"}];class aw extends li{constructor(){super(),this.menuData=ow.map(e=>({...e,title:ce(e.title)})),this.dropDivHeight="112px",this.dropDivWith="60px",this.width="36px",this.menuTextWidth="20px",this.showItemsTip=!0}onDropdownActive(e,n){return e.isActive({textAlign:this.menuData[n].value})}onDropdownItemClick(e){this.editor.chain().focus().setTextAlign(this.menuData[e].value).run()}onDropdownItemRender(e){return this.menuData[e].icon}onMenuTextRender(e){return this.menuData[e].icon}}class Vu{constructor(){B(this,"tippyInstance");B(this,"content");B(this,"onConfirmClickFunc");B(this,"onShowFunc")}setContent(e){this.content=e}onConfirmClick(e){this.onConfirmClickFunc=e}onShow(e){this.onShowFunc=e}setTrigger(e,n="bottom",r="click"){this.tippyInstance=De(e,{content:this.createContentElement(),appendTo:e.closest(".aie-container"),placement:n,trigger:r,interactive:!0,arrow:!1,onShow:i=>{this.onShowFunc&&this.onShowFunc(i)}})}show(){var e;(e=this.tippyInstance)==null||e.show()}hide(){var e;(e=this.tippyInstance)==null||e.hide()}createContentElement(){const e=` + `,this.registerClickListener()}onClick(e){e.indent()}}const ow=[{icon:'
',title:"align-left",value:"left"},{icon:'
',title:"align-center",value:"center"},{icon:'
',title:"align-right",value:"right"},{icon:'
',title:"align-justify",value:"justify"}];class aw extends ui{constructor(){super(),this.menuData=ow.map(e=>({...e,title:ce(e.title)})),this.dropDivHeight="112px",this.dropDivWith="60px",this.width="36px",this.menuTextWidth="20px",this.showItemsTip=!0}onDropdownActive(e,n){return e.isActive({textAlign:this.menuData[n].value})}onDropdownItemClick(e){this.editor.chain().focus().setTextAlign(this.menuData[e].value).run()}onDropdownItemRender(e){return this.menuData[e].icon}onMenuTextRender(e){return this.menuData[e].icon}}class $u{constructor(){B(this,"tippyInstance");B(this,"content");B(this,"onConfirmClickFunc");B(this,"onShowFunc")}setContent(e){this.content=e}onConfirmClick(e){this.onConfirmClickFunc=e}onShow(e){this.onShowFunc=e}setTrigger(e,n="bottom",r="click"){this.tippyInstance=De(e,{content:this.createContentElement(),appendTo:e.closest(".aie-container"),placement:n,trigger:r,interactive:!0,arrow:!1,onShow:i=>{this.onShowFunc&&this.onShowFunc(i)}})}show(){var e;(e=this.tippyInstance)==null||e.show()}hide(){var e;(e=this.tippyInstance)==null||e.hide()}createContentElement(){const e=`
@@ -213,7 +213,7 @@ img.ProseMirror-separator {
- `}connectedCallback(){super.connectedCallback();const e=new Vu;e.setContent(` + `}connectedCallback(){super.connectedCallback();const e=new $u;e.setContent(`
${ce("link-address")}
@@ -230,7 +230,7 @@ img.ProseMirror-separator {
- `}connectedCallback(){super.connectedCallback();const e=new Vu;e.setContent(` + `}connectedCallback(){super.connectedCallback();const e=new $u;e.setContent(`
@@ -238,7 +238,7 @@ img.ProseMirror-separator {
- `,this.registerClickListener()}onClick(e){e.toggleTaskList()}onActive(e){return e.isActive("taskList")}}const dw=["1.0","1.25","1.5","2.0","2.5","3.0"];class fw extends li{constructor(){super(),this.refreshMenuText=!1,this.dropDivWith="70px",this.width="36px",this.menuTextWidth="20px"}onCreate(e,n){var r;super.onCreate(e,n),this.menuData=((r=n.lineHeight)==null?void 0:r.values)||dw}onDropdownActive(e,n){let r=null;return e.isActive("paragraph")?r=e.getAttributes("paragraph").lineHeight:e.isActive("heading")&&(r=e.getAttributes("heading").lineHeight),!!(r&&r===`${(Number(this.menuData[n])*100).toFixed(0)}%`)}onDropdownItemClick(e){const n=`${(Number(this.menuData[e])*100).toFixed(0)}%`;this.editor.chain().setLineHeight(n).run()}onDropdownItemRender(e){return this.menuData[e]}onMenuTextRender(e){return` + `,this.registerClickListener()}onClick(e){e.toggleTaskList()}onActive(e){return e.isActive("taskList")}}const dw=["1.0","1.25","1.5","2.0","2.5","3.0"];class fw extends ui{constructor(){super(),this.refreshMenuText=!1,this.dropDivWith="70px",this.width="36px",this.menuTextWidth="20px"}onCreate(e,n){var r;super.onCreate(e,n),this.menuData=((r=n.lineHeight)==null?void 0:r.values)||dw}onDropdownActive(e,n){let r=null;return e.isActive("paragraph")?r=e.getAttributes("paragraph").lineHeight:e.isActive("heading")&&(r=e.getAttributes("heading").lineHeight),!!(r&&r===`${(Number(this.menuData[n])*100).toFixed(0)}%`)}onDropdownItemClick(e){const n=`${(Number(this.menuData[e])*100).toFixed(0)}%`;this.editor.chain().setLineHeight(n).run()}onDropdownItemRender(e){return this.menuData[e]}onMenuTextRender(e){return`
@@ -300,11 +300,11 @@ img.ProseMirror-separator {
- `,this.registerClickListener()}onClick(e){let n=this.closest(".aie-container").querySelector(".aie-content").innerHTML;n=`
${n}
`;const i=Array.from(document.querySelectorAll("style, link")).map(l=>l.outerHTML).join("")+n,s=document.createElement("iframe");s.id="aie-print-iframe",s.setAttribute("style","position: absolute; width: 0; height: 0; top: -10px; left: -10px;"),document.body.appendChild(s);const o=s.contentWindow,a=s.contentDocument||s.contentWindow&&s.contentWindow.document;a&&(a.open(),a.write(i),a.close()),o&&(s.onload=function(){try{setTimeout(()=>{o.focus();try{o.document.execCommand("print",!1)||o.print()}catch{o.print()}o.close()},10)}catch(l){console.error(l)}setTimeout(function(){document.body.removeChild(s)},100)})}}const Yd=["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🤐","🤨","😐","😑","😶","😶‍🌫","😏","😒","🙄","😬","😮‍💨","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🤧","🥵","🥶","🥴","😵","😵‍💫","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","😟","🙁","😮","😲","😳","🥺","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿","💀","☠️","💩","🤡","👹","👺","👻","👽","👾","🤖","😺","😸","😹","😻","😼","😽","🙀","😿","😾","🙈","🙉","🙊","💌","💘","💝","💖","💗","💓","💞","💕","💟","❣️","💔","💋","💯","💢","💥","💫","💦","💨","💤"];class _w extends he{constructor(){super();B(this,"emojis",Yd);this.template=` + `,this.registerClickListener()}onClick(e){let n=this.closest(".aie-container").querySelector(".aie-content").innerHTML;n=`
${n}
`;const i=Array.from(document.querySelectorAll("style, link")).map(l=>l.outerHTML).join("")+n,s=document.createElement("iframe");s.id="aie-print-iframe",s.setAttribute("style","position: absolute; width: 0; height: 0; top: -10px; left: -10px;"),document.body.appendChild(s);const o=s.contentWindow,a=s.contentDocument||s.contentWindow&&s.contentWindow.document;a&&(a.open(),a.write(i),a.close()),o&&(s.onload=function(){try{setTimeout(()=>{o.focus();try{o.document.execCommand("print",!1)||o.print()}catch{o.print()}o.close()},10)}catch(l){console.error(l)}setTimeout(function(){document.body.removeChild(s)},100)})}}const Jd=["😀","😃","😄","😁","😆","😅","🤣","😂","🙂","🙃","😉","😊","😇","🥰","😍","🤩","😘","😗","😚","😙","🥲","😋","😛","😜","🤪","😝","🤑","🤗","🤭","🤫","🤔","🤐","🤨","😐","😑","😶","😶‍🌫","😏","😒","🙄","😬","😮‍💨","🤥","😌","😔","😪","🤤","😴","😷","🤒","🤕","🤢","🤮","🤧","🥵","🥶","🥴","😵","😵‍💫","🤯","🤠","🥳","🥸","😎","🤓","🧐","😕","😟","🙁","😮","😲","😳","🥺","😦","😧","😨","😰","😥","😢","😭","😱","😖","😣","😞","😓","😩","😫","🥱","😤","😡","😠","🤬","😈","👿","💀","☠️","💩","🤡","👹","👺","👻","👽","👾","🤖","😺","😸","😹","😻","😼","😽","🙀","😿","😾","🙈","🙉","🙊","💌","💘","💝","💖","💗","💓","💞","💕","💟","❣️","💔","💋","💯","💢","💥","💫","💦","💨","💤"];class _w extends he{constructor(){super();B(this,"emojis",Jd);this.template=`
- `}onCreate(n,r){var i;super.onCreate(n,r),this.emojis=((i=r.emoji)==null?void 0:i.values)||Yd}connectedCallback(){super.connectedCallback(),De(this.querySelector("svg"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const n=document.createElement("div");return n.style.maxWidth="450px",n.style.overflow="hidden",n.style.display="flex",n.style.justifyContent="center",n.classList.add("aie-dropdown-container"),n.innerHTML=` + `}onCreate(n,r){var i;super.onCreate(n,r),this.emojis=((i=r.emoji)==null?void 0:i.values)||Jd}connectedCallback(){super.connectedCallback(),De(this.querySelector("svg"),{content:this.createMenuElement(),appendTo:this.closest(".aie-container"),placement:"bottom",trigger:"click",interactive:!0,arrow:!1})}createMenuElement(){const n=document.createElement("div");return n.style.maxWidth="450px",n.style.overflow="hidden",n.style.display="flex",n.style.justifyContent="center",n.classList.add("aie-dropdown-container"),n.innerHTML=`
${this.emojis.map(r=>`
${r}
`).join("")}
@@ -313,19 +313,19 @@ img.ProseMirror-separator { ${this.svg}
`,this.registerClickListener()}onClick(n){var r;n.setPainter((r=this.editor)==null?void 0:r.state.selection.$head.marks())}}class cs{constructor(e,n,r){B(this,"editor");B(this,"globalConfig");B(this,"aiModelName");B(this,"aiModelConfig");this.editor=e,this.globalConfig=n,this.aiModelName=r,this.aiModelConfig=n.models[r]}chatWithPayload(e,n){const r=s=>{this.createAiClient(s,n).start(typeof e=="string"?e:JSON.stringify(e))},i=()=>{n==null||n.onStop()};this.globalConfig.onCreateClientUrl?this.globalConfig.onCreateClientUrl(this.aiModelName,this.aiModelConfig,r,i):r(this.createAiClientUrl())}chat(e,n,r){const i=o=>{const a=this.createAiClient(o,r),l=n.includes("{content}")?n.split("{content}").join(e):`${e} -${n}`,u=this.wrapPayload(l);a.start(typeof u=="string"?u:JSON.stringify(u))},s=()=>{r==null||r.onStop()};this.globalConfig.onCreateClientUrl?this.globalConfig.onCreateClientUrl(this.aiModelName,this.aiModelConfig,i,s):i(this.createAiClientUrl())}}class H0{constructor(e,n){B(this,"isStop",!1);B(this,"url");B(this,"webSocket");B(this,"isOpen",!1);B(this,"payload");B(this,"listener");this.url=e,this.listener=n}start(e){this.listener.onStart(this),this.payload=e,this.webSocket=new WebSocket(this.url),this.webSocket.onopen=n=>this.onOpen(n),this.webSocket.onmessage=n=>this.onMessage(n),this.webSocket.onclose=n=>this.onClose(n),this.webSocket.onerror=n=>this.onError(n)}stop(){this.webSocket&&(this.webSocket.close(),this.webSocket=void 0,this.isStop||(this.listener.onStop(),this.isStop=!0))}send(e){this.webSocket&&this.isOpen&&this.webSocket.send(e)}onOpen(e){this.isOpen=!0,this.send(this.payload)}onMessage(e){this.listener.onMessage(e.data)}onClose(e){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}onError(e){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}}var On=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function la(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Mw(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var B0={exports:{}};function Aw(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ka={exports:{}};const Tw={},Ow=Object.freeze(Object.defineProperty({__proto__:null,default:Tw},Symbol.toStringTag,{value:"Module"})),Nw=Mw(Ow);var Xd;function ua(){return Xd||(Xd=1,function(t,e){(function(n,r){t.exports=r()})(On,function(){var n=n||function(r,i){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof On<"u"&&On.crypto&&(s=On.crypto),!s&&typeof Aw=="function")try{s=Nw}catch{}var o=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function v(){}return function(x){var b;return v.prototype=x,b=new v,v.prototype=null,b}}(),l={},u=l.lib={},c=u.Base=function(){return{extend:function(v){var x=a(this);return v&&x.mixIn(v),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var x in v)v.hasOwnProperty(x)&&(this[x]=v[x]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=u.WordArray=c.extend({init:function(v,x){v=this.words=v||[],x!=i?this.sigBytes=x:this.sigBytes=v.length*4},toString:function(v){return(v||h).stringify(this)},concat:function(v){var x=this.words,b=v.words,k=this.sigBytes,w=v.sigBytes;if(this.clamp(),k%4)for(var _=0;_>>2]>>>24-_%4*8&255;x[k+_>>>2]|=N<<24-(k+_)%4*8}else for(var M=0;M>>2]=b[M>>>2];return this.sigBytes+=w,this},clamp:function(){var v=this.words,x=this.sigBytes;v[x>>>2]&=4294967295<<32-x%4*8,v.length=r.ceil(x/4)},clone:function(){var v=c.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var x=[],b=0;b>>2]>>>24-w%4*8&255;k.push((_>>>4).toString(16)),k.push((_&15).toString(16))}return k.join("")},parse:function(v){for(var x=v.length,b=[],k=0;k>>3]|=parseInt(v.substr(k,2),16)<<24-k%8*4;return new d.init(b,x/2)}},p=f.Latin1={stringify:function(v){for(var x=v.words,b=v.sigBytes,k=[],w=0;w>>2]>>>24-w%4*8&255;k.push(String.fromCharCode(_))}return k.join("")},parse:function(v){for(var x=v.length,b=[],k=0;k>>2]|=(v.charCodeAt(k)&255)<<24-k%4*8;return new d.init(b,x)}},g=f.Utf8={stringify:function(v){try{return decodeURIComponent(escape(p.stringify(v)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(v){return p.parse(unescape(encodeURIComponent(v)))}},m=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=g.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var x,b=this._data,k=b.words,w=b.sigBytes,_=this.blockSize,N=_*4,M=w/N;v?M=r.ceil(M):M=r.max((M|0)-this._minBufferSize,0);var I=M*_,$=r.min(I*4,w);if(I){for(var K=0;K>>7)^(M<<14|M>>>18)^M>>>3,$=d[N-2],K=($<<15|$>>>17)^($<<13|$>>>19)^$>>>10;d[N]=I+d[N-7]+K+d[N-16]}var z=b&k^~b&w,j=m&y^m&v^y&v,U=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),te=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),E=_+te+z+c[N]+d[N],C=U+j;_=w,w=k,k=b,b=x+E|0,x=v,v=y,y=m,m=E+C|0}g[0]=g[0]+m|0,g[1]=g[1]+y|0,g[2]=g[2]+v|0,g[3]=g[3]+x|0,g[4]=g[4]+b|0,g[5]=g[5]+k|0,g[6]=g[6]+w|0,g[7]=g[7]+_|0},_doFinalize:function(){var h=this._data,p=h.words,g=this._nDataBytes*8,m=h.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=r.floor(g/4294967296),p[(m+64>>>9<<4)+15]=g,h.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var h=a.clone.call(this);return h._hash=this._hash.clone(),h}});i.SHA256=a._createHelper(f),i.HmacSHA256=a._createHmacHelper(f)}(Math),n.SHA256})}(Wa)),Wa.exports}var ja={exports:{}},ef;function Dw(){return ef||(ef=1,function(t,e){(function(n,r){t.exports=r(ua())})(On,function(n){(function(){var r=n,i=r.lib,s=i.Base,o=r.enc,a=o.Utf8,l=r.algo;l.HMAC=s.extend({init:function(u,c){u=this._hasher=new u.init,typeof c=="string"&&(c=a.parse(c));var d=u.blockSize,f=d*4;c.sigBytes>f&&(c=u.finalize(c)),c.clamp();for(var h=this._oKey=c.clone(),p=this._iKey=c.clone(),g=h.words,m=p.words,y=0;y>>2]>>>24-h%4*8&255,g=u[h+1>>>2]>>>24-(h+1)%4*8&255,m=u[h+2>>>2]>>>24-(h+2)%4*8&255,y=p<<16|g<<8|m,v=0;v<4&&h+v*.75>>6*(3-v)&63));var x=d.charAt(64);if(x)for(;f.length%4;)f.push(x);return f.join("")},parse:function(l){var u=l.length,c=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f>>6-h%4*2,m=p|g;d[f>>>2]|=m<<24-f%4*8,f++}return s.create(d,f)}}(),n.enc.Base64})})(P0);var Hw=P0.exports;const Bw=la(Hw),ca=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16));class F0 extends cs{constructor(e,n){super(e,n,"spark"),this.aiModelConfig={version:"v3.5",protocol:"wss",...n.models.spark}}createAiClient(e,n){return new H0(e,{onStart:n.onStart,onStop:n.onStop,onMessage:r=>{var s,o,a,l,u;const i=JSON.parse(r);i.payload&&((o=(s=i.payload.usage)==null?void 0:s.text)!=null&&o.total_tokens&&this.globalConfig.onTokenConsume&&this.globalConfig.onTokenConsume(this.aiModelName,this.aiModelConfig,(l=(a=i.payload.usage)==null?void 0:a.text)==null?void 0:l.total_tokens),(u=i.payload.choices)!=null&&u.text&&i.payload.choices.text[0]&&n.onMessage({...i.payload.choices.text[0],status:i.payload.choices.status}))}})}wrapPayload(e){const n=this.aiModelConfig,r={header:{app_id:n.appId,uid:ca()},parameter:{chat:{domain:this.getDomain(n),temperature:.5,max_tokens:2048}},payload:{message:{text:[{role:"user",content:e}]}}};return JSON.stringify(r)}getDomain(e){switch(e.version){case"v4.0":return"4.0Ultra";case"v3.5":return"generalv3.5";case"v3.1":return"generalv3";case"v2.1":return"generalv2";default:return"general"}}createAiClientUrl(){const e=this.aiModelConfig,n=new Date().toUTCString().replace("GMT","+0000");let r=`host: spark-api.xf-yun.com +${n}`,u=this.wrapPayload(l);a.start(typeof u=="string"?u:JSON.stringify(u))},s=()=>{r==null||r.onStop()};this.globalConfig.onCreateClientUrl?this.globalConfig.onCreateClientUrl(this.aiModelName,this.aiModelConfig,i,s):i(this.createAiClientUrl())}}class H0{constructor(e,n){B(this,"isStop",!1);B(this,"url");B(this,"webSocket");B(this,"isOpen",!1);B(this,"payload");B(this,"listener");this.url=e,this.listener=n}start(e){this.listener.onStart(this),this.payload=e,this.webSocket=new WebSocket(this.url),this.webSocket.onopen=n=>this.onOpen(n),this.webSocket.onmessage=n=>this.onMessage(n),this.webSocket.onclose=n=>this.onClose(n),this.webSocket.onerror=n=>this.onError(n)}stop(){this.webSocket&&(this.webSocket.close(),this.webSocket=void 0,this.isStop||(this.listener.onStop(),this.isStop=!0))}send(e){this.webSocket&&this.isOpen&&this.webSocket.send(e)}onOpen(e){this.isOpen=!0,this.send(this.payload)}onMessage(e){this.listener.onMessage(e.data)}onClose(e){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}onError(e){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}}var On=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function la(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Mw(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var B0={exports:{}};function Aw(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ka={exports:{}};const Tw={},Ow=Object.freeze(Object.defineProperty({__proto__:null,default:Tw},Symbol.toStringTag,{value:"Module"})),Nw=Mw(Ow);var Yd;function ua(){return Yd||(Yd=1,function(t,e){(function(n,r){t.exports=r()})(On,function(){var n=n||function(r,i){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof On<"u"&&On.crypto&&(s=On.crypto),!s&&typeof Aw=="function")try{s=Nw}catch{}var o=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function v(){}return function(x){var b;return v.prototype=x,b=new v,v.prototype=null,b}}(),l={},u=l.lib={},c=u.Base=function(){return{extend:function(v){var x=a(this);return v&&x.mixIn(v),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var x in v)v.hasOwnProperty(x)&&(this[x]=v[x]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=u.WordArray=c.extend({init:function(v,x){v=this.words=v||[],x!=i?this.sigBytes=x:this.sigBytes=v.length*4},toString:function(v){return(v||h).stringify(this)},concat:function(v){var x=this.words,b=v.words,k=this.sigBytes,w=v.sigBytes;if(this.clamp(),k%4)for(var _=0;_>>2]>>>24-_%4*8&255;x[k+_>>>2]|=N<<24-(k+_)%4*8}else for(var M=0;M>>2]=b[M>>>2];return this.sigBytes+=w,this},clamp:function(){var v=this.words,x=this.sigBytes;v[x>>>2]&=4294967295<<32-x%4*8,v.length=r.ceil(x/4)},clone:function(){var v=c.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var x=[],b=0;b>>2]>>>24-w%4*8&255;k.push((_>>>4).toString(16)),k.push((_&15).toString(16))}return k.join("")},parse:function(v){for(var x=v.length,b=[],k=0;k>>3]|=parseInt(v.substr(k,2),16)<<24-k%8*4;return new d.init(b,x/2)}},p=f.Latin1={stringify:function(v){for(var x=v.words,b=v.sigBytes,k=[],w=0;w>>2]>>>24-w%4*8&255;k.push(String.fromCharCode(_))}return k.join("")},parse:function(v){for(var x=v.length,b=[],k=0;k>>2]|=(v.charCodeAt(k)&255)<<24-k%4*8;return new d.init(b,x)}},g=f.Utf8={stringify:function(v){try{return decodeURIComponent(escape(p.stringify(v)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(v){return p.parse(unescape(encodeURIComponent(v)))}},m=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=g.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var x,b=this._data,k=b.words,w=b.sigBytes,_=this.blockSize,N=_*4,M=w/N;v?M=r.ceil(M):M=r.max((M|0)-this._minBufferSize,0);var I=M*_,$=r.min(I*4,w);if(I){for(var K=0;K>>7)^(M<<14|M>>>18)^M>>>3,$=d[N-2],K=($<<15|$>>>17)^($<<13|$>>>19)^$>>>10;d[N]=I+d[N-7]+K+d[N-16]}var z=b&k^~b&w,j=m&y^m&v^y&v,U=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),te=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),E=_+te+z+c[N]+d[N],C=U+j;_=w,w=k,k=b,b=x+E|0,x=v,v=y,y=m,m=E+C|0}g[0]=g[0]+m|0,g[1]=g[1]+y|0,g[2]=g[2]+v|0,g[3]=g[3]+x|0,g[4]=g[4]+b|0,g[5]=g[5]+k|0,g[6]=g[6]+w|0,g[7]=g[7]+_|0},_doFinalize:function(){var h=this._data,p=h.words,g=this._nDataBytes*8,m=h.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=r.floor(g/4294967296),p[(m+64>>>9<<4)+15]=g,h.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var h=a.clone.call(this);return h._hash=this._hash.clone(),h}});i.SHA256=a._createHelper(f),i.HmacSHA256=a._createHmacHelper(f)}(Math),n.SHA256})}(Wa)),Wa.exports}var ja={exports:{}},Qd;function Dw(){return Qd||(Qd=1,function(t,e){(function(n,r){t.exports=r(ua())})(On,function(n){(function(){var r=n,i=r.lib,s=i.Base,o=r.enc,a=o.Utf8,l=r.algo;l.HMAC=s.extend({init:function(u,c){u=this._hasher=new u.init,typeof c=="string"&&(c=a.parse(c));var d=u.blockSize,f=d*4;c.sigBytes>f&&(c=u.finalize(c)),c.clamp();for(var h=this._oKey=c.clone(),p=this._iKey=c.clone(),g=h.words,m=p.words,y=0;y>>2]>>>24-h%4*8&255,g=u[h+1>>>2]>>>24-(h+1)%4*8&255,m=u[h+2>>>2]>>>24-(h+2)%4*8&255,y=p<<16|g<<8|m,v=0;v<4&&h+v*.75>>6*(3-v)&63));var x=d.charAt(64);if(x)for(;f.length%4;)f.push(x);return f.join("")},parse:function(l){var u=l.length,c=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f>>6-h%4*2,m=p|g;d[f>>>2]|=m<<24-f%4*8,f++}return s.create(d,f)}}(),n.enc.Base64})})(P0);var Hw=P0.exports;const Bw=la(Hw),ca=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16));class F0 extends cs{constructor(e,n){super(e,n,"spark"),this.aiModelConfig={version:"v3.5",protocol:"wss",...n.models.spark}}createAiClient(e,n){return new H0(e,{onStart:n.onStart,onStop:n.onStop,onMessage:r=>{var s,o,a,l,u;const i=JSON.parse(r);i.payload&&((o=(s=i.payload.usage)==null?void 0:s.text)!=null&&o.total_tokens&&this.globalConfig.onTokenConsume&&this.globalConfig.onTokenConsume(this.aiModelName,this.aiModelConfig,(l=(a=i.payload.usage)==null?void 0:a.text)==null?void 0:l.total_tokens),(u=i.payload.choices)!=null&&u.text&&i.payload.choices.text[0]&&n.onMessage({...i.payload.choices.text[0],status:i.payload.choices.status}))}})}wrapPayload(e){const n=this.aiModelConfig,r={header:{app_id:n.appId,uid:ca()},parameter:{chat:{domain:this.getDomain(n),temperature:.5,max_tokens:2048}},payload:{message:{text:[{role:"user",content:e}]}}};return JSON.stringify(r)}getDomain(e){switch(e.version){case"v4.0":return"4.0Ultra";case"v3.5":return"generalv3.5";case"v3.1":return"generalv3";case"v2.1":return"generalv2";default:return"general"}}createAiClientUrl(){const e=this.aiModelConfig,n=new Date().toUTCString().replace("GMT","+0000");let r=`host: spark-api.xf-yun.com `;r+="date: "+n+` -`,r+=`GET /${e.version}/chat HTTP/1.1`;const i=Iw(r,e.apiSecret),s=Bw.stringify(i),o=`api_key="${e.apiKey}", algorithm="hmac-sha256", headers="host date request-line", signature="${s}"`,a=btoa(o);return`${e.protocol}://spark-api.xf-yun.com/${e.version}/chat?authorization=${a}&date=${encodeURIComponent(n)}&host=spark-api.xf-yun.com`}}class Pw{constructor(e,n){B(this,"isStop",!1);B(this,"config");B(this,"fetch");B(this,"isOpen",!1);B(this,"payload");B(this,"listener");this.config=e,this.listener=n}start(e){this.payload=e,this.onOpen(),this.listener.onStart(this)}stop(){this.fetch&&(this.fetch=void 0,this.isStop||(this.listener.onStop(),this.isStop=!0))}async send(e){if(this.isOpen)try{this.fetch=await fetch(this.config.url,{method:this.config.method,body:e});const n=this.fetch;if(!n.body)throw new Error("response.body is none");const r=({done:o,value:a})=>{if(o){this.onClose();return}return this.onMessage(s.decode(a)),i.read().then(({done:l,value:u})=>r({done:l,value:u}))},i=n.body.getReader(),s=new TextDecoder("utf-8");i.read().then(({done:o,value:a})=>r({done:o,value:a}))}catch{this.onError()}}onOpen(){this.isOpen=!0,this.send(this.payload)}onMessage(e){this.listener.onMessage(e)}onClose(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}onError(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}}class $0 extends cs{constructor(e,n){super(e,n,"wenxin"),this.aiModelConfig={...n.models.wenxin}}createAiClient(e,n){return new Pw({url:e,method:"POST"},{onStart:n.onStart,onStop:n.onStop,onMessage:r=>{const i=r.match(/data:([\s\S]*)$/);if(!i)return;const s=JSON.parse(i[1]);n.onMessage({status:s.is_end?2:1,role:"assistant",content:s.result||"",index:s.sentence_id})}})}wrapPayload(e){const n={messages:[],stream:!0};return n.messages.push({role:"user",content:e}),JSON.stringify(n)}createAiClientUrl(){return`https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token=${this.aiModelConfig.access_token}`}}class zu{constructor(e,n){B(this,"isStop",!1);B(this,"config");B(this,"fetch");B(this,"isOpen",!1);B(this,"payload");B(this,"listener");B(this,"ctrl",new AbortController);this.config=e,this.listener=n}start(e){this.payload=e,this.onOpen(),this.listener.onStart(this)}stop(){this.fetch&&(this.ctrl.abort(),this.isStop||(this.listener.onStop(),this.isStop=!0))}async send(e){var n;if(this.isOpen)try{const r=await fetch(this.config.url,{method:this.config.method||"POST",headers:this.config.headers,body:e});if(!r.ok){this.onError();return}const i=(n=r.body)==null?void 0:n.getReader();if(!i){this.onError();return}const s=new TextDecoder("utf-8");for(;;){let{value:o,done:a}=await i.read();if(a){this.onClose();break}let l=s.decode(o);if(!l)return;const u=l.split(` +`,r+=`GET /${e.version}/chat HTTP/1.1`;const i=Iw(r,e.apiSecret),s=Bw.stringify(i),o=`api_key="${e.apiKey}", algorithm="hmac-sha256", headers="host date request-line", signature="${s}"`,a=btoa(o);return`${e.protocol}://spark-api.xf-yun.com/${e.version}/chat?authorization=${a}&date=${encodeURIComponent(n)}&host=spark-api.xf-yun.com`}}class Pw{constructor(e,n){B(this,"isStop",!1);B(this,"config");B(this,"fetch");B(this,"isOpen",!1);B(this,"payload");B(this,"listener");this.config=e,this.listener=n}start(e){this.payload=e,this.onOpen(),this.listener.onStart(this)}stop(){this.fetch&&(this.fetch=void 0,this.isStop||(this.listener.onStop(),this.isStop=!0))}async send(e){if(this.isOpen)try{this.fetch=await fetch(this.config.url,{method:this.config.method,body:e});const n=this.fetch;if(!n.body)throw new Error("response.body is none");const r=({done:o,value:a})=>{if(o){this.onClose();return}return this.onMessage(s.decode(a)),i.read().then(({done:l,value:u})=>r({done:l,value:u}))},i=n.body.getReader(),s=new TextDecoder("utf-8");i.read().then(({done:o,value:a})=>r({done:o,value:a}))}catch{this.onError()}}onOpen(){this.isOpen=!0,this.send(this.payload)}onMessage(e){this.listener.onMessage(e)}onClose(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}onError(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}}class $0 extends cs{constructor(e,n){super(e,n,"wenxin"),this.aiModelConfig={...n.models.wenxin}}createAiClient(e,n){return new Pw({url:e,method:"POST"},{onStart:n.onStart,onStop:n.onStop,onMessage:r=>{const i=r.match(/data:([\s\S]*)$/);if(!i)return;const s=JSON.parse(i[1]);n.onMessage({status:s.is_end?2:1,role:"assistant",content:s.result||"",index:s.sentence_id})}})}wrapPayload(e){const n={messages:[],stream:!0};return n.messages.push({role:"user",content:e}),JSON.stringify(n)}createAiClientUrl(){return`https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token=${this.aiModelConfig.access_token}`}}class Vu{constructor(e,n){B(this,"isStop",!1);B(this,"config");B(this,"fetch");B(this,"isOpen",!1);B(this,"payload");B(this,"listener");B(this,"ctrl",new AbortController);this.config=e,this.listener=n}start(e){this.payload=e,this.onOpen(),this.listener.onStart(this)}stop(){this.fetch&&(this.ctrl.abort(),this.isStop||(this.listener.onStop(),this.isStop=!0))}async send(e){var n;if(this.isOpen)try{const r=await fetch(this.config.url,{method:this.config.method||"POST",headers:this.config.headers,body:e});if(!r.ok){this.onError();return}const i=(n=r.body)==null?void 0:n.getReader();if(!i){this.onError();return}const s=new TextDecoder("utf-8");for(;;){let{value:o,done:a}=await i.read();if(a){this.onClose();break}let l=s.decode(o);if(!l)return;const u=l.split(` `);let c="",d=0;for(let f of u)f.indexOf("data:")==0?(c&&this.onMessage(c),c=f.substring(5)):(d!=u.length-1&&(c+=` -`),c+=f),d++;c&&this.onMessage(c)}}catch{this.onError()}}onOpen(){this.isOpen=!0,this.send(this.payload)}onMessage(e){this.listener.onMessage(e)}onClose(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}onError(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}}class V0 extends cs{constructor(e,n){super(e,n,"custom"),this.aiModelConfig={protocol:"sse",...n.models.custom}}createAiClient(e,n){var s;const r=this.aiModelConfig,i={onStart:n.onStart,onStop:n.onStop,onMessage:o=>{var u;const a=this.aiModelConfig,l=(u=a.parseMessage)==null?void 0:u.call(a,o);l&&n.onMessage(l)}};return r.protocol==="sse"?new zu({url:e,method:"post",headers:(s=r.headers)==null?void 0:s.call(r)},i):new H0(e,i)}wrapPayload(e){var r;const n=this.aiModelConfig;return(r=n.wrapPayload)==null?void 0:r.call(n,e)}createAiClientUrl(){var n;const e=this.aiModelConfig;return typeof e.url=="string"?e.url:(n=e.url)==null?void 0:n.call(e)}}class z0 extends cs{constructor(e,n){super(e,n,"openai"),this.aiModelConfig={endpoint:"https://api.openai.com",model:"gpt-3.5-turbo",...n.models.openai}}createAiClient(e,n){const r=this.aiModelConfig;return new zu({url:e,method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.apiKey}`}},{onStart:n.onStart,onStop:n.onStop,onMessage:i=>{var o,a;const s=JSON.parse(i);n.onMessage({status:s.choices[0].finish_reason==="stop"?2:1,role:"assistant",content:((o=s.choices[0].delta)==null?void 0:o.content)||"",index:s.choices[0].index}),this.globalConfig.onTokenConsume&&((a=s.choices[0].usage)!=null&&a.total_tokens)&&this.globalConfig.onTokenConsume(this.aiModelName,this.aiModelConfig,s.choices[0].usage.total_tokens)}})}wrapPayload(e){const r={model:this.aiModelConfig.model,messages:[{role:"user",content:e}],stream:!0};return JSON.stringify(r)}createAiClientUrl(){return`${this.aiModelConfig.endpoint}/v1/chat/completions`}}class Fw extends cs{constructor(e,n){super(e,n,"gitee"),this.aiModelConfig={max_tokens:4096,temperature:.7,top_p:.7,top_k:50,...n.models.gitee}}createAiClient(e,n){const r=this.aiModelConfig;let i="";return new zu({url:e,method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.apiKey}`}},{onStart:n.onStart,onStop:n.onStop,onMessage:s=>{var a,l;let o=null;try{i&&(s=i+s),o=JSON.parse(s),i=""}catch{i=i+s.trim();return}n.onMessage({status:o.choices[0].finish_reason==="stop"?2:1,role:"assistant",content:((a=o.choices[0].delta)==null?void 0:a.content)||"",index:o.choices[0].index}),this.globalConfig.onTokenConsume&&((l=o.usage)!=null&&l.total_tokens)&&this.globalConfig.onTokenConsume(this.aiModelName,this.aiModelConfig,o.usage.total_tokens)}})}wrapPayload(e){const n=this.aiModelConfig,r={messages:[{role:"user",content:e}],stream:!0,max_tokens:n.max_tokens,temperature:n.temperature,top_p:n.top_p,top_k:n.top_k};return JSON.stringify(r)}createAiClientUrl(){const{endpoint:e}=this.aiModelConfig;return e}}class gn{static init(e,n){var r;if(n&&n.models)for(let i of Object.keys(n.models))switch(i){case"spark":this.set(i,new F0(e,n));break;case"wenxin":this.set(i,new $0(e,n));break;case"openai":this.set(i,new z0(e,n));break;case"gitee":this.set(i,new Fw(e,n));break;case"custom":this.set(i,new V0(e,n));break;default:const s=(r=n.modelFactory)==null?void 0:r.create(i,e,n);s&&this.set(i,s)}}static get(e){return(!e||e==="auto")&&(e=Object.keys(this.models)[0]),this.models[e]}static set(e,n){this.models[e]=n}}B(gn,"models",{});const $w=t=>{let e="";return t.descendants(n=>{n.text&&(e+=n.text)}),e};class yo{constructor(e,n){B(this,"editor");B(this,"from");B(this,"options");this.editor=e,this.from=e.view.state.selection.from,this.options=n||{markdownParseEnable:!0}}onStart(){}onStop(){}onMessage(e){const{state:{tr:n},view:r}=this.editor;if(r.dispatch(n.insertText(e.content)),e.status==2&&this.options.markdownParseEnable){const i=this.editor.state.selection.to,s=this.editor.state.doc.textBetween(this.from,i),{state:{tr:o},view:a}=this.editor,l=this.editor.parseMarkdown(s);if(this.options.useMarkdownTextOnly){const u=$w(l),c=this.editor.schema.text(u);a.dispatch(o.replaceWith(this.from,i,c).scrollIntoView())}else a.dispatch(o.replaceWith(this.from,i,l).scrollIntoView())}this.editor.commands.scrollIntoView()}}const Vw=[{icon:'',name:"ai-continuation",prompt:`{content} +`),c+=f),d++;c&&this.onMessage(c)}}catch{this.onError()}}onOpen(){this.isOpen=!0,this.send(this.payload)}onMessage(e){this.listener.onMessage(e)}onClose(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}onError(){this.isOpen=!1,this.isStop||(this.listener.onStop(),this.isStop=!0)}}class V0 extends cs{constructor(e,n){super(e,n,"custom"),this.aiModelConfig={protocol:"sse",...n.models.custom}}createAiClient(e,n){var s;const r=this.aiModelConfig,i={onStart:n.onStart,onStop:n.onStop,onMessage:o=>{var u;const a=this.aiModelConfig,l=(u=a.parseMessage)==null?void 0:u.call(a,o);l&&n.onMessage(l)}};return r.protocol==="sse"?new Vu({url:e,method:"post",headers:(s=r.headers)==null?void 0:s.call(r)},i):new H0(e,i)}wrapPayload(e){var r;const n=this.aiModelConfig;return(r=n.wrapPayload)==null?void 0:r.call(n,e)}createAiClientUrl(){var n;const e=this.aiModelConfig;return typeof e.url=="string"?e.url:(n=e.url)==null?void 0:n.call(e)}}class z0 extends cs{constructor(e,n){super(e,n,"openai"),this.aiModelConfig={endpoint:"https://api.openai.com",model:"gpt-3.5-turbo",...n.models.openai}}createAiClient(e,n){const r=this.aiModelConfig;return new Vu({url:e,method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.apiKey}`}},{onStart:n.onStart,onStop:n.onStop,onMessage:i=>{var o,a;const s=JSON.parse(i);n.onMessage({status:s.choices[0].finish_reason==="stop"?2:1,role:"assistant",content:((o=s.choices[0].delta)==null?void 0:o.content)||"",index:s.choices[0].index}),this.globalConfig.onTokenConsume&&((a=s.choices[0].usage)!=null&&a.total_tokens)&&this.globalConfig.onTokenConsume(this.aiModelName,this.aiModelConfig,s.choices[0].usage.total_tokens)}})}wrapPayload(e){const r={model:this.aiModelConfig.model,messages:[{role:"user",content:e}],stream:!0};return JSON.stringify(r)}createAiClientUrl(){return`${this.aiModelConfig.endpoint}/v1/chat/completions`}}class Fw extends cs{constructor(e,n){super(e,n,"gitee"),this.aiModelConfig={max_tokens:4096,temperature:.7,top_p:.7,top_k:50,...n.models.gitee}}createAiClient(e,n){const r=this.aiModelConfig;let i="";return new Vu({url:e,method:"post",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.apiKey}`}},{onStart:n.onStart,onStop:n.onStop,onMessage:s=>{var a,l;let o=null;try{i&&(s=i+s),o=JSON.parse(s),i=""}catch{i=i+s.trim();return}n.onMessage({status:o.choices[0].finish_reason==="stop"?2:1,role:"assistant",content:((a=o.choices[0].delta)==null?void 0:a.content)||"",index:o.choices[0].index}),this.globalConfig.onTokenConsume&&((l=o.usage)!=null&&l.total_tokens)&&this.globalConfig.onTokenConsume(this.aiModelName,this.aiModelConfig,o.usage.total_tokens)}})}wrapPayload(e){const n=this.aiModelConfig,r={messages:[{role:"user",content:e}],stream:!0,max_tokens:n.max_tokens,temperature:n.temperature,top_p:n.top_p,top_k:n.top_k};return JSON.stringify(r)}createAiClientUrl(){const{endpoint:e}=this.aiModelConfig;return e}}class gn{static init(e,n){var r;if(n&&n.models)for(let i of Object.keys(n.models))switch(i){case"spark":this.set(i,new F0(e,n));break;case"wenxin":this.set(i,new $0(e,n));break;case"openai":this.set(i,new z0(e,n));break;case"gitee":this.set(i,new Fw(e,n));break;case"custom":this.set(i,new V0(e,n));break;default:const s=(r=n.modelFactory)==null?void 0:r.create(i,e,n);s&&this.set(i,s)}}static get(e){return(!e||e==="auto")&&(e=Object.keys(this.models)[0]),this.models[e]}static set(e,n){this.models[e]=n}}B(gn,"models",{});const $w=t=>{let e="";return t.descendants(n=>{n.text&&(e+=n.text)}),e};class yo{constructor(e,n){B(this,"editor");B(this,"from");B(this,"options");this.editor=e,this.from=e.view.state.selection.from,this.options=n||{markdownParseEnable:!0}}onStart(){}onStop(){}onMessage(e){const{state:{tr:n},view:r}=this.editor;if(r.dispatch(n.insertText(e.content)),e.status==2&&this.options.markdownParseEnable){const i=this.editor.state.selection.to,s=this.editor.state.doc.textBetween(this.from,i),{state:{tr:o},view:a}=this.editor,l=this.editor.parseMarkdown(s);if(this.options.useMarkdownTextOnly){const u=$w(l),c=this.editor.schema.text(u);a.dispatch(o.replaceWith(this.from,i,c).scrollIntoView())}else a.dispatch(o.replaceWith(this.from,i,l).scrollIntoView())}this.editor.commands.scrollIntoView()}}const Vw=[{icon:'',name:"ai-continuation",prompt:`{content} 请帮我继续扩展一些这段话的内容。 注意:你应该先判断一下这句话是中文还是英文,如果是中文,请给我返回中文的内容,如果是英文,请给我返回英文内容,只需要返回内容即可,不需要告知我是中文还是英文。`,text:"focusBefore",model:"auto"},{icon:'',name:"ai-optimization",prompt:`{content} 请帮我优化一下这段文字的内容,并返回结果 注意:你应该先判断一下这句话是中文还是英文,如果是中文,请给我返回中文的内容,如果是英文,请给我返回英文内容,只需要返回内容即可,不需要告知我是中文还是英文。`,text:"selected",model:"auto"},{icon:'',name:"ai-proofreading",prompt:`{content} 请帮我找出这段话的错别字,把错别字修改后,并返回结果,不要解释或其他多余的内容 -注意:你应该先判断一下这句话是中文还是英文,如果是中文,请给我返回中文的内容,如果是英文,请给我返回英文内容,只需要返回内容即可,不需要告知我是中文还是英文。`,text:"selected",model:"auto"},{icon:'',name:"ai-translation",prompt:"请帮我翻译以上内容,在翻译之前,想先判断一下这个内容是不是中文,如果是中文,则翻译问英文,如果是其他语言,则需要翻译为中文,注意,你只需要返回翻译的结果,不需要对此进行任何解释,不需要除了翻译结果以外的其他任何内容。",text:"selected",model:"auto"}];class zw extends li{constructor(){super();B(this,"aiMenus",Vw.map(n=>({...n,name:`${ce(n.name)}`})));this.dropDivHeight="auto",this.dropDivWith="fit-content",this.width="36px",this.menuTextWidth="20px"}onCreate(n,r){var i;super.onCreate(n,r),this.menuData=((i=r.ai)==null?void 0:i.menus)||this.aiMenus}renderTemplate(){this.template=` +注意:你应该先判断一下这句话是中文还是英文,如果是中文,请给我返回中文的内容,如果是英文,请给我返回英文内容,只需要返回内容即可,不需要告知我是中文还是英文。`,text:"selected",model:"auto"},{icon:'',name:"ai-translation",prompt:"请帮我翻译以上内容,在翻译之前,想先判断一下这个内容是不是中文,如果是中文,则翻译问英文,如果是其他语言,则需要翻译为中文,注意,你只需要返回翻译的结果,不需要对此进行任何解释,不需要除了翻译结果以外的其他任何内容。",text:"selected",model:"auto"}];class zw extends ui{constructor(){super();B(this,"aiMenus",Vw.map(n=>({...n,name:`${ce(n.name)}`})));this.dropDivHeight="auto",this.dropDivWith="fit-content",this.width="36px",this.menuTextWidth="20px"}onCreate(n,r){var i;super.onCreate(n,r),this.menuData=((i=r.ai)==null?void 0:i.menus)||this.aiMenus}renderTemplate(){this.template=`
`;const r=()=>{const a=document.createElement("div");return a.classList.add("aie-codeblock-langs"),a.innerHTML=` - ${this.options.languages.map(l=>`
${l.name}
`).join("")}`,a.addEventListener("click",l=>{const u=l.target.closest(".aie-codeblock-langs-item");if(u){const c=u.getAttribute("data-item");t.editor.chain().setCodeBlock({language:c}).run()}}),a},i=De(e.querySelector(".aie-codeblock-tools-lang"),{content:r(),appendTo:t.editor.options.element,placement:"bottom-end",trigger:"click",interactive:!0,arrow:!1,aria:{content:null,expanded:!1}});return(s=e.querySelector(".aie-codeblock-tools-comments"))==null||s.addEventListener("click",a=>{const l=t.editor.view.posAtCoords({left:a.clientX,top:a.clientY}),u=t.editor.state.doc.resolve(l.pos).parent;t.editor.chain().addCodeComments(u,l.pos)}),(o=e.querySelector(".aie-codeblock-tools-explain"))==null||o.addEventListener("click",a=>{const l=t.editor.view.posAtCoords({left:a.clientX,top:a.clientY}),u=t.editor.state.doc.resolve(l.pos).parent;t.editor.chain().addCodeExplain(u,l.pos)}),{dom:e,contentDOM:e.querySelector("code"),destroy:()=>{i.destroy()}}}}});function X4(t){const e=t.regex,n=t.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"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.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:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",p=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],m=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","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"],y=["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"],b={type:g,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:m},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},w=[k,d,a,n,t.C_BLOCK_COMMENT_MODE,c,u],_={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:w.concat([{begin:/\(/,end:/\)/,keywords:b,contains:w.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,c,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,c,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"",keywords:b,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Q4(t){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"]},n=X4(t),r=n.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,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function e5(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(o);const a={match:/\\"/},l={className:"string",begin:/'/,end:/'/},u={match:/\\'/},c={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},p=["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],g=["true","false"],m={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias"],x=["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"],b=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:p,literal:g,built_in:[...y,...v,"set","shopt",...x,...b]},contains:[f,t.SHEBANG(),h,c,t.HASH_COMMENT_MODE,s,m,o,a,l,u,n]}}function t5(t){const e=t.regex,n=t.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/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.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:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",m={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[d,a,n,t.C_BLOCK_COMMENT_MODE,c,u],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:m,contains:y.concat([{begin:/\(/,end:/\)/,keywords:m,contains:y.concat(["self"]),relevance:0}]),relevance:0},x={begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:m,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:m,relevance:0},{begin:h,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,c,a,{begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,c,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:m,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:d,strings:u,keywords:m}}}function n5(t){const e=t.regex,n=t.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"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.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:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",p=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],m=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","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"],y=["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"],b={type:g,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:m},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},w=[k,d,a,n,t.C_BLOCK_COMMENT_MODE,c,u],_={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:w.concat([{begin:/\(/,end:/\)/,keywords:b,contains:w.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,c,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,c,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"",keywords:b,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function r5(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["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","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=t.inherit(t.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},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},c=t.inherit(u,{illegal:/\n/}),d={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=t.inherit(d,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,f]},p={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},d]},g=t.inherit(p,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});d.contains=[p,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],f.contains=[g,h,c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const m={variants:[p,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},y={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},v=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",x={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},m,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,y,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,y,t.C_LINE_COMMENT_MODE,t.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:"("+v+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,y],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[m,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},x]}}const i5=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.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:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.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_-]*/}}),s5=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],o5=["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"],a5=["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"],l5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],u5=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function c5(t){const e=t.regex,n=i5(t),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=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+a5.join("|")+")"},{begin:":(:)?("+l5.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+u5.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.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}]},n.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:o5.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+s5.join("|")+")\\b"}]}}function d5(t){const e=t.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 f5(t){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:"N1(t,e,n-1))}function g5(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+N1("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},c={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[c,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Wf,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Wf,u]}}const jf="[A-Za-z$_][0-9A-Za-z$_]*",m5=["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"],b5=["true","false","null","undefined","NaN","Infinity"],L1=["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"],D1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],R1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],y5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],v5=[].concat(R1,L1,D1);function x5(t){const e=t.regex,n=(C,{after:O})=>{const D="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,O)=>{const D=C[0].length+C.index,V=C.input[D];if(V==="<"||V===","){O.ignoreMatch();return}V===">"&&(n(C,{after:D})||O.ignoreMatch());let G;const ue=C.input.substring(D);if(G=ue.match(/^\s*=/)){O.ignoreMatch();return}if((G=ue.match(/^\s+extends\s+/))&&G.index===0){O.ignoreMatch();return}}},a={$pattern:jf,keyword:m5,literal:b5,built_in:v5,"variable.language":y5},l="[0-9](_?[0-9])*",u=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},p={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={className:"comment",variants:[t.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}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},x=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,m,{match:/\$\d+/},d];f.contains=x.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(x)});const b=[].concat(v,f.contains),k=b.concat([{begin:/\(/,end:/\)/,keywords:a,contains:["self"].concat(b)}]),w={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},_={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"}}]},N={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:{_:[...L1,...D1]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},$={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function K(C){return e.concat("(?!",C.join("|"),")")}const z={match:e.concat(/\b/,K([...R1,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},j={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},te="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(te)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,m,v,{match:/\$\d+/},d,N,{className:"attr",begin:r+e.lookahead(":"),relevance:0},E,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:te,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k}]}]},{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"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},j,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},z,$,_,U,{match:/\$[(.]/}]}}function w5(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Hr="[0-9](_*[0-9])*",Hs=`\\.(${Hr})`,Bs="[0-9a-fA-F](_*[0-9a-fA-F])*",E5={className:"number",variants:[{begin:`(\\b(${Hr})((${Hs})|\\.)?|(${Hs}))[eE][+-]?(${Hr})[fFdD]?\\b`},{begin:`\\b(${Hr})((${Hs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Hs})[fFdD]?\\b`},{begin:`\\b(${Hr})[fFdD]\\b`},{begin:`\\b0[xX]((${Bs})\\.?|(${Bs})?\\.(${Bs}))[pP][+-]?(${Hr})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Bs})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function k5(t){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"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(o,{className:"string"}),"self"]}]},u=E5,c=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,c,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,t.C_LINE_COMMENT_MODE,c],relevance:0},t.C_LINE_COMMENT_MODE,c,a,l,o,t.C_NUMBER_MODE]},c]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin://,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:` + ${this.options.languages.map(l=>`
${l.name}
`).join("")}`,a.addEventListener("click",l=>{const u=l.target.closest(".aie-codeblock-langs-item");if(u){const c=u.getAttribute("data-item");t.editor.chain().setCodeBlock({language:c}).run()}}),a},i=De(e.querySelector(".aie-codeblock-tools-lang"),{content:r(),appendTo:t.editor.options.element,placement:"bottom-end",trigger:"click",interactive:!0,arrow:!1,aria:{content:null,expanded:!1}});return(s=e.querySelector(".aie-codeblock-tools-comments"))==null||s.addEventListener("click",a=>{const l=t.editor.view.posAtCoords({left:a.clientX,top:a.clientY}),u=t.editor.state.doc.resolve(l.pos).parent;t.editor.chain().addCodeComments(u,l.pos)}),(o=e.querySelector(".aie-codeblock-tools-explain"))==null||o.addEventListener("click",a=>{const l=t.editor.view.posAtCoords({left:a.clientX,top:a.clientY}),u=t.editor.state.doc.resolve(l.pos).parent;t.editor.chain().addCodeExplain(u,l.pos)}),{dom:e,contentDOM:e.querySelector("code"),destroy:()=>{i.destroy()}}}}});function X4(t){const e=t.regex,n=t.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"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.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:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",p=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],m=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","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"],y=["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"],b={type:g,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:m},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},w=[k,d,a,n,t.C_BLOCK_COMMENT_MODE,c,u],_={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:w.concat([{begin:/\(/,end:/\)/,keywords:b,contains:w.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,c,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,c,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"",keywords:b,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Q4(t){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"]},n=X4(t),r=n.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,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function e5(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const i={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,i]};i.contains.push(o);const a={match:/\\"/},l={className:"string",begin:/'/,end:/'/},u={match:/\\'/},c={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),h={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},p=["if","then","else","elif","fi","for","while","until","in","do","done","case","esac","function","select"],g=["true","false"],m={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias"],x=["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"],b=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:p,literal:g,built_in:[...y,...v,"set","shopt",...x,...b]},contains:[f,t.SHEBANG(),h,c,t.HASH_COMMENT_MODE,s,m,o,a,l,u,n]}}function t5(t){const e=t.regex,n=t.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/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.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:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",m={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[d,a,n,t.C_BLOCK_COMMENT_MODE,c,u],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:m,contains:y.concat([{begin:/\(/,end:/\)/,keywords:m,contains:y.concat(["self"]),relevance:0}]),relevance:0},x={begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:m,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:m,relevance:0},{begin:h,returnBegin:!0,contains:[t.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,c,a,{begin:/\(/,end:/\)/,keywords:m,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,c,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:m,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:d,strings:u,keywords:m}}}function n5(t){const e=t.regex,n=t.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"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.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:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:e.optional(i)+t.IDENT_RE,relevance:0},h=e.optional(i)+t.IDENT_RE+"\\s*\\(",p=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],m=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","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"],y=["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"],b={type:g,keyword:p,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:m},k={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},w=[k,d,a,n,t.C_BLOCK_COMMENT_MODE,c,u],_={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:w.concat([{begin:/\(/,end:/\)/,keywords:b,contains:w.concat(["self"]),relevance:0}]),relevance:0},N={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:h,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,u,c,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,u,c,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:b,illegal:"",keywords:b,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:b},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function r5(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["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","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(s),built_in:e,literal:r},a=t.inherit(t.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},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},c=t.inherit(u,{illegal:/\n/}),d={className:"subst",begin:/\{/,end:/\}/,keywords:o},f=t.inherit(d,{illegal:/\n/}),h={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,f]},p={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},d]},g=t.inherit(p,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});d.contains=[p,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],f.contains=[g,h,c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const m={variants:[p,h,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},y={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},v=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",x={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},m,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,y,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,y,t.C_LINE_COMMENT_MODE,t.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:"("+v+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,y],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[m,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},x]}}const i5=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.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:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.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_-]*/}}),s5=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],o5=["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"],a5=["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"],l5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],u5=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function c5(t){const e=t.regex,n=i5(t),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=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+a5.join("|")+")"},{begin:":(:)?("+l5.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+u5.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.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}]},n.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:o5.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+s5.join("|")+")\\b"}]}}function d5(t){const e=t.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 f5(t){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:"N1(t,e,n-1))}function g5(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+N1("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},c={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[c,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,Kf,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},Kf,u]}}const Wf="[A-Za-z$_][0-9A-Za-z$_]*",m5=["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"],b5=["true","false","null","undefined","NaN","Infinity"],L1=["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"],D1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],R1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],y5=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],v5=[].concat(R1,L1,D1);function x5(t){const e=t.regex,n=(C,{after:O})=>{const D="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,O)=>{const D=C[0].length+C.index,V=C.input[D];if(V==="<"||V===","){O.ignoreMatch();return}V===">"&&(n(C,{after:D})||O.ignoreMatch());let G;const ue=C.input.substring(D);if(G=ue.match(/^\s*=/)){O.ignoreMatch();return}if((G=ue.match(/^\s+extends\s+/))&&G.index===0){O.ignoreMatch();return}}},a={$pattern:Wf,keyword:m5,literal:b5,built_in:v5,"variable.language":y5},l="[0-9](_?[0-9])*",u=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},p={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={className:"comment",variants:[t.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}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},x=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,m,{match:/\$\d+/},d];f.contains=x.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(x)});const b=[].concat(v,f.contains),k=b.concat([{begin:/\(/,end:/\)/,keywords:a,contains:["self"].concat(b)}]),w={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},_={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"}}]},N={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:{_:[...L1,...D1]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},$={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function K(C){return e.concat("(?!",C.join("|"),")")}const z={match:e.concat(/\b/,K([...R1,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},j={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},te="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(te)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,m,v,{match:/\$\d+/},d,N,{className:"attr",begin:r+e.lookahead(":"),relevance:0},E,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:te,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k}]}]},{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"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},j,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},z,$,_,U,{match:/\$[(.]/}]}}function w5(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,i,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Br="[0-9](_*[0-9])*",Hs=`\\.(${Br})`,Bs="[0-9a-fA-F](_*[0-9a-fA-F])*",E5={className:"number",variants:[{begin:`(\\b(${Br})((${Hs})|\\.)?|(${Hs}))[eE][+-]?(${Br})[fFdD]?\\b`},{begin:`\\b(${Br})((${Hs})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Hs})[fFdD]?\\b`},{begin:`\\b(${Br})[fFdD]\\b`},{begin:`\\b0[xX]((${Bs})\\.?|(${Bs})?\\.(${Bs}))[pP][+-]?(${Br})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Bs})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function k5(t){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"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(o,{className:"string"}),"self"]}]},u=E5,c=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,c,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,t.C_LINE_COMMENT_MODE,c],relevance:0},t.C_LINE_COMMENT_MODE,c,a,l,o,t.C_NUMBER_MODE]},c]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin://,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:` `},u]}}const C5=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.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:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.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_-]*/}}),_5=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],S5=["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"],I1=["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"],H1=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],M5=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),A5=I1.concat(H1);function T5(t){const e=C5(t),n=A5,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",o=[],a=[],l=function(x){return{className:"string",begin:"~?"+x+".*?"+x}},u=function(x,b,k){return{className:x,begin:b,relevance:k}},c={$pattern:/[a-z-]+/,keyword:r,attribute:S5.join(" ")},d={begin:"\\(",end:"\\)",contains:a,keywords:c,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,d,u("variable","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("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}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},p={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+M5.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:c,returnEnd:!0,contains:a,relevance:0}},m={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:f}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,h,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+_5.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,u("selector-tag",s,0),u("selector-id","#"+s),u("selector-class","\\."+s,0),u("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+I1.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+H1.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},e.FUNCTION_DISPATCH]},v={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return o.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,m,v,p,y,h,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function O5(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},i=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",keywords:{$pattern:t.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:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function N5(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%",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}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},c={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=t.inherit(u,{contains:[]}),f=t.inherit(c,{contains:[]});u.contains.push(f),c.contains.push(d);let h=[n,l];return[u,c,d,f].forEach(m=>{m.contains=m.contains.concat(h)}),h=h.concat(u,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},n,s,u,c,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},i,r,l,o]}}function D5(t){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+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,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:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function R5(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","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","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","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:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},a={variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@][^\s\w{]/,relevance:0}]},l=[t.BACKSLASH_ESCAPE,s,a],u=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],c=(h,p,g="\\1")=>{const m=g==="\\1"?g:e.concat(g,p);return e.concat(e.concat("(?:",h,")"),p,/(?:\\.|[^\\\/])*?/,m,/(?:\\.|[^\\\/])*?/,g,r)},d=(h,p,g)=>e.concat(e.concat("(?:",h,")"),p,/(?:\\.|[^\\\/])*?/,g,r),f=[a,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:l,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:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number",begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",relevance:0},{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:c("s|tr|y",e.either(...u,{capture:!0}))},{begin:c("s|tr|y","\\(","\\)")},{begin:c("s|tr|y","\\[","\\]")},{begin:c("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:d("(?:m|qr)?",/\//,/\//)},{begin:d("m|qr",e.either(...u,{capture:!0}),/\1/)},{begin:d("m|qr",/\(/,/\)/)},{begin:d("m|qr",/\[/,/\]/)},{begin:d("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=f,o.contains=f,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:f}}function I5(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},a={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(a)}),c={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(a),"on:begin":(z,j)=>{j.data._beginMatch=z[1]||z[2]},"on:end":(z,j)=>{j.data._beginMatch!==z[1]&&j.ignoreMatch()}},d=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[ -]`,h={scope:"string",variants:[u,l,c,d]},p={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"],m=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],x={keyword:m,literal:(z=>{const j=[];return z.forEach(U=>{j.push(U),U.toLowerCase()===U?j.push(U.toUpperCase()):j.push(U.toLowerCase())}),j})(g),built_in:y},b=z=>z.map(j=>j.replace(/\|\d+$/,"")),k={variants:[{match:[/new/,e.concat(f,"+"),e.concat("(?!",b(y).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},w=e.concat(r,"\\b(?!\\()"),_={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),w],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,e.concat(/::/,e.lookahead(/(?!class\b)/)),w],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"}}]},N={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},M={relevance:0,begin:/\(/,end:/\)/,keywords:x,contains:[N,s,_,t.C_BLOCK_COMMENT_MODE,h,p,k]},I={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",b(m).join("\\b|"),"|",b(y).join("\\b|"),"\\b)"),r,e.concat(f,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[M]};M.contains.push(I);const $=[N,_,t.C_BLOCK_COMMENT_MODE,h,p,k],K={begin:e.concat(/#\[\s*/,i),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...$]},...$,{scope:"meta",match:i}]};return{case_insensitive:!1,keywords:x,contains:[K,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},o,{scope:"variable.language",match:/\$this\b/},s,I,_,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},k,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:x,contains:["self",s,_,t.C_BLOCK_COMMENT_MODE,h,p]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},h,p]}}function H5(t){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},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function B5(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function P5(t){const e=t.regex,n=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:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},c={begin:/\{\{/,relevance:0},d={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,c,u]},{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:[t.BACKSLASH_ESCAPE,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,c,u]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",h=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,p=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${h}))[eE][+-]?(${f})[jJ]?(?=${p})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${f})[jJ](?=${p})`}]},m={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,d,t.HASH_COMMENT_MODE]}]};return u.contains=[d,g,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,g,{begin:/\bself\b/},{beginKeywords:"if",relevance:0},d,m,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,y,d]}]}}function F5(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function $5(t){const e=t.regex,n=/(?:(?:[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:n,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:[t.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:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.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:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function V5(t){const e=t.regex,n="([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:">"},u=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[t.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,c]})]}]},f="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",p={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},w=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},p,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,c],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,u),relevance:0}].concat(l,u);c.contains=w,g.contains=w;const I=[{begin:/^\s*=>/,starts:{end:"$",contains:w}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:w}}];return u.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(I).concat(u).concat(w)}}function z5(t){const e=t.regex,n={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,t.IDENT_RE,e.lookahead(/\s*\(/))},r="([ui](8|16|32|64|128|size)|f(32|64))?",i=["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","unsafe","unsized","use","virtual","where","while","yield"],s=["true","false","Some","None","Ok","Err"],o=["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!"],a=["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:t.IDENT_RE+"!?",type:a,keyword:i,literal:s,built_in:o},illegal:""},n]}}const U5=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.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:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.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_-]*/}}),q5=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Z5=["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"],K5=["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"],W5=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],j5=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse();function G5(t){const e=U5(t),n=W5,r=K5,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:[t.C_LINE_COMMENT_MODE,t.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("+q5.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+j5.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,t.QUOTE_STRING_MODE,t.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:Z5.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function J5(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Y5(t){const e=t.regex,n=t.COMMENT("--","$"),r={className:"string",variants:[{begin:/'/,end:/'/,contains:[{begin:/''/}]}]},i={begin:/"/,end:/"/,contains:[{begin:/""/}]},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"],u=["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"],c=["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"],d=["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"],h=c,p=[...u,...l].filter(x=>!c.includes(x)),g={className:"variable",begin:/@[a-z0-9][a-z0-9_]*/},m={className:"operator",begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={begin:e.concat(/\b/,e.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function v(x,{exceptions:b,when:k}={}){const w=k;return b=b||[],x.map(_=>_.match(/\|\d+$/)||b.includes(_)?_:w(_)?`${_}|0`:_)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:v(p,{when:x=>x.length<3}),literal:s,type:a,built_in:d},contains:[{begin:e.either(...f),relevance:0,keywords:{$pattern:/[\w\.]+/,keyword:p.concat(f),literal:s,type:a}},{className:"type",begin:e.either(...o)},y,g,r,i,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,m]}}function B1(t){return t?typeof t=="string"?t:t.source:null}function Ps(t){return ke("(?=",t,")")}function ke(...t){return t.map(n=>B1(n)).join("")}function X5(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function ut(...t){return"("+(X5(t).capture?"":"?:")+t.map(r=>B1(r)).join("|")+")"}const nc=t=>ke(/\b/,t,/\w$/.test(t)?/\b/:/\B/),Q5=["Protocol","Type"].map(nc),Gf=["init","self"].map(nc),e6=["Any","Self"],rl=["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","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"],Jf=["false","nil","true"],t6=["assignment","associativity","higherThan","left","lowerThan","none","right"],n6=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Yf=["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"],P1=ut(/[/=\-+!*%<>&|^~?]/,/[\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]/),F1=ut(P1,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),il=ke(P1,F1,"*"),$1=ut(/[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]/),Ho=ut($1,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),un=ke($1,Ho,"*"),sl=ke(/[A-Z]/,Ho,"*"),r6=["attached","autoclosure",ke(/convention\(/,ut("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ke(/objc\(/,un,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],i6=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function s6(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],i={match:[/\./,ut(...Q5,...Gf)],className:{2:"keyword"}},s={match:ke(/\./,ut(...rl)),relevance:0},o=rl.filter(de=>typeof de=="string").concat(["_|0"]),a=rl.filter(de=>typeof de!="string").concat(e6).map(nc),l={variants:[{className:"keyword",match:ut(...a,...Gf)}]},u={$pattern:ut(/\b\w+/,/#\w+/),keyword:o.concat(n6),literal:Jf},c=[i,s,l],d={match:ke(/\./,ut(...Yf)),relevance:0},f={className:"built_in",match:ke(/\b/,ut(...Yf),/(?=\()/)},h=[d,f],p={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:il},{match:`\\.(\\.|${F1})+`}]},m=[p,g],y="([0-9]_*)+",v="([0-9a-fA-F]_*)+",x={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},b=(de="")=>({className:"subst",variants:[{match:ke(/\\/,de,/[0\\tnr"']/)},{match:ke(/\\/,de,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(de="")=>({className:"subst",match:ke(/\\/,de,/[\t ]*(?:[\r\n]|\r\n)/)}),w=(de="")=>({className:"subst",label:"interpol",begin:ke(/\\/,de,/\(/),end:/\)/}),_=(de="")=>({begin:ke(de,/"""/),end:ke(/"""/,de),contains:[b(de),k(de),w(de)]}),N=(de="")=>({begin:ke(de,/"/),end:ke(/"/,de),contains:[b(de),w(de)]}),M={className:"string",variants:[_(),_("#"),_("##"),_("###"),N(),N("#"),N("##"),N("###")]},I=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],$={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:I},K=de=>{const He=ke(de,/\//),Je=ke(/\//,de);return{begin:He,end:Je,contains:[...I,{scope:"comment",begin:`#(?!.*${Je})`,end:/$/}]}},z={scope:"regexp",variants:[K("###"),K("##"),K("#"),$]},j={match:ke(/`/,un,/`/)},U={className:"variable",match:/\$\d+/},te={className:"variable",match:`\\$${Ho}+`},E=[j,U,te],C={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:i6,contains:[...m,x,M]}]}},O={scope:"keyword",match:ke(/@/,ut(...r6))},D={scope:"meta",match:ke(/@/,un)},V=[C,O,D],G={match:Ps(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ke(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Ho,"+")},{className:"type",match:sl,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ke(/\s+&\s+/,Ps(sl)),relevance:0}]},ue={begin://,keywords:u,contains:[...r,...c,...V,p,G]};G.contains.push(ue);const Oe={match:ke(un,/\s*:/),keywords:"_|0",relevance:0},se={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",Oe,...r,z,...c,...h,...m,x,M,...E,...V,G]},pe={begin://,keywords:"repeat each",contains:[...r,G]},ot={begin:ut(Ps(ke(un,/\s*:/)),Ps(ke(un,/\s+/,un,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:un}]},Be={begin:/\(/,end:/\)/,keywords:u,contains:[ot,...r,...c,...m,x,M,...V,G,se],endsParent:!0,illegal:/["']/},at={match:[/(func|macro)/,/\s+/,ut(j.match,un,il)],className:{1:"keyword",3:"title.function"},contains:[pe,Be,e],illegal:[/\[/,/%/]},lt={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[pe,Be,e],illegal:/\[|%/},xt={match:[/operator/,/\s+/,il],className:{1:"keyword",3:"title"}},$t={begin:[/precedencegroup/,/\s+/,sl],className:{1:"keyword",3:"title"},contains:[G],keywords:[...t6,...Jf],end:/}/};for(const de of M.variants){const He=de.contains.find(xe=>xe.label==="interpol");He.keywords=u;const Je=[...c,...h,...m,x,M,...E];He.contains=[...Je,{begin:/\(/,end:/\)/,contains:["self",...Je]}]}return{name:"Swift",keywords:u,contains:[...r,at,lt,{beginKeywords:"struct protocol class extension enum actor",end:"\\{",excludeEnd:!0,keywords:u,contains:[t.inherit(t.TITLE_MODE,{className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...c]},xt,$t,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},z,...c,...h,...m,x,M,...E,...V,G,se]}}const Bo="[A-Za-z$_][0-9A-Za-z$_]*",V1=["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"],z1=["true","false","null","undefined","NaN","Infinity"],U1=["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"],q1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Z1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],K1=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],W1=[].concat(Z1,U1,q1);function o6(t){const e=t.regex,n=(C,{after:O})=>{const D="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,O)=>{const D=C[0].length+C.index,V=C.input[D];if(V==="<"||V===","){O.ignoreMatch();return}V===">"&&(n(C,{after:D})||O.ignoreMatch());let G;const ue=C.input.substring(D);if(G=ue.match(/^\s*=/)){O.ignoreMatch();return}if((G=ue.match(/^\s+extends\s+/))&&G.index===0){O.ignoreMatch();return}}},a={$pattern:Bo,keyword:V1,literal:z1,built_in:W1,"variable.language":K1},l="[0-9](_?[0-9])*",u=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},h={begin:"html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},p={begin:"css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:"gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,f]},v={className:"comment",variants:[t.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}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},x=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,m,{match:/\$\d+/},d];f.contains=x.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(x)});const b=[].concat(v,f.contains),k=b.concat([{begin:/\(/,end:/\)/,keywords:a,contains:["self"].concat(b)}]),w={className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k},_={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"}}]},N={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:{_:[...U1,...q1]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},I={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[w],illegal:/%/},$={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function K(C){return e.concat("(?!",C.join("|"),")")}const z={match:e.concat(/\b/,K([...Z1,"super","import"]),r,e.lookahead(/\(/)),className:"title.function",relevance:0},j={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},w]},te="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",E={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(te)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[w]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:N},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,h,p,g,m,v,{match:/\$\d+/},d,N,{className:"attr",begin:r+e.lookahead(":"),relevance:0},E,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,t.REGEXP_MODE,{className:"function",begin:te,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:k}]}]},{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"]}]}]},I,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[w,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},j,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[w]},z,$,_,U,{match:/\$[(.]/}]}}function a6(t){const e=o6(t),n=Bo,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={beginKeywords:"namespace",end:/\{/,excludeEnd:!0,contains:[e.exports.CLASS_REFERENCE]},s={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[e.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},a=["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"],l={$pattern:Bo,keyword:V1.concat(a),literal:z1,built_in:W1.concat(r),"variable.language":K1},u={className:"meta",begin:"@"+n},c=(f,h,p)=>{const g=f.contains.findIndex(m=>m.label===h);if(g===-1)throw new Error("can not find mode to replace");f.contains.splice(g,1,p)};Object.assign(e.keywords,l),e.exports.PARAMS_CONTAINS.push(u),e.contains=e.contains.concat([u,i,s]),c(e,"shebang",t.SHEBANG()),c(e,"use_strict",o);const d=e.contains.find(f=>f.label==="func.def");return d.relevance=0,Object.assign(e,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),e}function l6(t){const e=t.regex,n={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),/ *#/)}]},u={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])|[%&])?/}]},c={className:"label",begin:/^\w+:/},d=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=t.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:[n,r,l,u,c,d,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 u6(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.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"},u={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:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},s,o,i,t.QUOTE_STRING_MODE,l,u,a]}}function c6(t){const e=t.regex,n=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=t.inherit(s,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[s,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,o,l,a]}]}]},t.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function d6(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:"\\w[\\w :\\/.-]*:(?=[ ]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ ]|$)'},{begin:"'\\w[\\w :\\/.-]*':(?=[ ]|$)"}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,i]},o=t.inherit(s,{variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={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"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},h={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},p={begin:"\\[",end:"\\]",contains:[f],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+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},d,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},h,p,s],m=[...g];return m.pop(),m.push(o),f.contains=m,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:g}}const f6={arduino:Q4,bash:e5,c:t5,cpp:n5,csharp:r5,css:c5,diff:d5,go:f5,graphql:h5,ini:p5,java:g5,javascript:x5,json:w5,kotlin:k5,less:T5,lua:O5,makefile:N5,markdown:L5,objectivec:D5,perl:R5,php:I5,"php-template":H5,plaintext:B5,python:P5,"python-repl":F5,r:$5,ruby:V5,rust:z5,scss:G5,shell:J5,sql:Y5,swift:s6,typescript:a6,vbnet:l6,wasm:u6,xml:c6,yaml:d6};function j1(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&j1(n)}),t}class Xf{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function G1(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ln(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const h6="",Qf=t=>!!t.scope,p6=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class g6{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=G1(e)}openNode(e){if(!Qf(e))return;const n=p6(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Qf(e)&&(this.buffer+=h6)}value(){return this.buffer}span(e){this.buffer+=``}}const eh=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class rc{constructor(){this.rootNode=eh(),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 n=eh({scope:e});this.add(n),this.stack.push(n)}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,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{rc._collapse(n)}))}}class m6 extends rc{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new g6(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Gi(t){return t?typeof t=="string"?t:t.source:null}function J1(t){return vr("(?=",t,")")}function b6(t){return vr("(?:",t,")*")}function y6(t){return vr("(?:",t,")?")}function vr(...t){return t.map(n=>Gi(n)).join("")}function v6(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function ic(...t){return"("+(v6(t).capture?"":"?:")+t.map(r=>Gi(r)).join("|")+")"}function Y1(t){return new RegExp(t.toString()+"|").exec("").length-1}function x6(t,e){const n=t&&t.exec(e);return n&&n.index===0}const w6=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function sc(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let s=Gi(r),o="";for(;s.length>0;){const a=w6.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]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}const E6=/\b\B/,X1="[a-zA-Z]\\w*",oc="[a-zA-Z_]\\w*",Q1="\\b\\d+(\\.\\d+)?",eg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",tg="\\b(0b[01]+)",k6="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",C6=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=vr(e,/.*\b/,t.binary,/\b.*/)),Ln({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Ji={begin:"\\\\[\\s\\S]",relevance:0},_6={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Ji]},S6={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Ji]},M6={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/},pa=function(t,e,n={}){const r=Ln({scope:"comment",begin:t,end:e,contains:[]},n);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=ic("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:vr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},A6=pa("//","$"),T6=pa("/\\*","\\*/"),O6=pa("#","$"),N6={scope:"number",begin:Q1,relevance:0},L6={scope:"number",begin:eg,relevance:0},D6={scope:"number",begin:tg,relevance:0},R6={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Ji,{begin:/\[/,end:/\]/,relevance:0,contains:[Ji]}]},I6={scope:"title",begin:X1,relevance:0},H6={scope:"title",begin:oc,relevance:0},B6={begin:"\\.\\s*"+oc,relevance:0},P6=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})};var Fs=Object.freeze({__proto__:null,APOS_STRING_MODE:_6,BACKSLASH_ESCAPE:Ji,BINARY_NUMBER_MODE:D6,BINARY_NUMBER_RE:tg,COMMENT:pa,C_BLOCK_COMMENT_MODE:T6,C_LINE_COMMENT_MODE:A6,C_NUMBER_MODE:L6,C_NUMBER_RE:eg,END_SAME_AS_BEGIN:P6,HASH_COMMENT_MODE:O6,IDENT_RE:X1,MATCH_NOTHING_RE:E6,METHOD_GUARD:B6,NUMBER_MODE:N6,NUMBER_RE:Q1,PHRASAL_WORDS_MODE:M6,QUOTE_STRING_MODE:S6,REGEXP_MODE:R6,RE_STARTERS_RE:k6,SHEBANG:C6,TITLE_MODE:I6,UNDERSCORE_IDENT_RE:oc,UNDERSCORE_TITLE_MODE:H6});function F6(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function $6(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function V6(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=F6,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function z6(t,e){Array.isArray(t.illegal)&&(t.illegal=ic(...t.illegal))}function U6(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function q6(t,e){t.relevance===void 0&&(t.relevance=1)}const Z6=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=vr(n.beforeMatch,J1(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},K6=["of","and","for","in","not","or","if","then","parent","list","value"],W6="keyword";function ng(t,e,n=W6){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(s){Object.assign(r,ng(t[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,j6(l[0],l[1])]})}}function j6(t,e){return e?Number(e):G6(t)?0:1}function G6(t){return K6.includes(t.toLowerCase())}const th={},lr=t=>{console.error(t)},nh=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Tr=(t,e)=>{th[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),th[`${t}/${e}`]=!0)},Po=new Error;function rg(t,e,{key:n}){let r=0;const i=t[n],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=Y1(e[a-1]);t[n]=o,t[n]._emit=s,t[n]._multi=!0}function J6(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw lr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Po;if(typeof t.beginScope!="object"||t.beginScope===null)throw lr("beginScope must be object"),Po;rg(t,t.begin,{key:"beginScope"}),t.begin=sc(t.begin,{joinWith:""})}}function Y6(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw lr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Po;if(typeof t.endScope!="object"||t.endScope===null)throw lr("endScope must be object"),Po;rg(t,t.end,{key:"endScope"}),t.end=sc(t.end,{joinWith:""})}}function X6(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function Q6(t){X6(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),J6(t),Y6(t)}function e_(t){function e(o,a){return new RegExp(Gi(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{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+=Y1(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(sc(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const u=l.findIndex((d,f)=>f>0&&d!==void 0),c=this.matchIndexes[u];return l.splice(0,u),Object.assign(l,c)}}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 n;return this.rules.slice(a).forEach(([u,c])=>l.addRule(u,c)),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 u=l.exec(a);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(a)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}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;[$6,U6,Q6,Z6].forEach(c=>c(o,a)),t.compilerExtensions.forEach(c=>c(o,a)),o.__beforeBegin=null,[V6,z6,q6].forEach(c=>c(o,a)),o.isCompiled=!0;let u=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),u=o.keywords.$pattern,delete o.keywords.$pattern),u=u||/\w+/,o.keywords&&(o.keywords=ng(o.keywords,t.case_insensitive)),l.keywordPatternRe=e(u,!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=Gi(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(c){return t_(c==="self"?o:c)})),o.contains.forEach(function(c){s(c,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ln(t.classNameAliases||{}),s(t)}function ig(t){return t?t.endsWithParent||ig(t.starts):!1}function t_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ln(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:ig(t)?Ln(t,{starts:t.starts?Ln(t.starts):null}):Object.isFrozen(t)?Ln(t):t}var n_="11.9.0";class r_ extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const ol=G1,rh=Ln,ih=Symbol("nomatch"),i_=7,sg=function(t){const e=Object.create(null),n=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:m6};function l(E){return a.noHighlightRe.test(E)}function u(E){let C=E.className+" ";C+=E.parentNode?E.parentNode.className:"";const O=a.languageDetectRe.exec(C);if(O){const D=M(O[1]);return D||(nh(s.replace("{}",O[1])),nh("Falling back to no-highlight mode for this block.",E)),D?O[1]:"no-highlight"}return C.split(/\s+/).find(D=>l(D)||M(D))}function c(E,C,O){let D="",V="";typeof C=="object"?(D=E,O=C.ignoreIllegals,V=C.language):(Tr("10.7.0","highlight(lang, code, ...args) has been deprecated."),Tr("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),V=E,D=C),O===void 0&&(O=!0);const G={code:D,language:V};U("before:highlight",G);const ue=G.result?G.result:d(G.language,G.code,O);return ue.code=G.code,U("after:highlight",ue),ue}function d(E,C,O,D){const V=Object.create(null);function G(S,T){return S.keywords[T]}function ue(){if(!R.keywords){ie.addText(X);return}let S=0;R.keywordPatternRe.lastIndex=0;let T=R.keywordPatternRe.exec(X),P="";for(;T;){P+=X.substring(S,T.index);const Z=xe.case_insensitive?T[0].toLowerCase():T[0],fe=G(R,Z);if(fe){const[Le,di]=fe;if(ie.addText(P),P="",V[Z]=(V[Z]||0)+1,V[Z]<=i_&&(Ze+=di),Le.startsWith("_"))P+=T[0];else{const A=xe.classNameAliases[Le]||Le;pe(T[0],A)}}else P+=T[0];S=R.keywordPatternRe.lastIndex,T=R.keywordPatternRe.exec(X)}P+=X.substring(S),ie.addText(P)}function Oe(){if(X==="")return;let S=null;if(typeof R.subLanguage=="string"){if(!e[R.subLanguage]){ie.addText(X);return}S=d(R.subLanguage,X,!0,tt[R.subLanguage]),tt[R.subLanguage]=S._top}else S=h(X,R.subLanguage.length?R.subLanguage:null);R.relevance>0&&(Ze+=S.relevance),ie.__addSublanguage(S._emitter,S.language)}function se(){R.subLanguage!=null?Oe():ue(),X=""}function pe(S,T){S!==""&&(ie.startScope(T),ie.addText(S),ie.endScope())}function ot(S,T){let P=1;const Z=T.length-1;for(;P<=Z;){if(!S._emit[P]){P++;continue}const fe=xe.classNameAliases[S[P]]||S[P],Le=T[P];fe?pe(Le,fe):(X=Le,ue(),X=""),P++}}function Be(S,T){return S.scope&&typeof S.scope=="string"&&ie.openNode(xe.classNameAliases[S.scope]||S.scope),S.beginScope&&(S.beginScope._wrap?(pe(X,xe.classNameAliases[S.beginScope._wrap]||S.beginScope._wrap),X=""):S.beginScope._multi&&(ot(S.beginScope,T),X="")),R=Object.create(S,{parent:{value:R}}),R}function at(S,T,P){let Z=x6(S.endRe,P);if(Z){if(S["on:end"]){const fe=new Xf(S);S["on:end"](T,fe),fe.isMatchIgnored&&(Z=!1)}if(Z){for(;S.endsParent&&S.parent;)S=S.parent;return S}}if(S.endsWithParent)return at(S.parent,T,P)}function lt(S){return R.matcher.regexIndex===0?(X+=S[0],1):(kt=!0,0)}function xt(S){const T=S[0],P=S.rule,Z=new Xf(P),fe=[P.__beforeBegin,P["on:begin"]];for(const Le of fe)if(Le&&(Le(S,Z),Z.isMatchIgnored))return lt(T);return P.skip?X+=T:(P.excludeBegin&&(X+=T),se(),!P.returnBegin&&!P.excludeBegin&&(X=T)),Be(P,S),P.returnBegin?0:T.length}function $t(S){const T=S[0],P=C.substring(S.index),Z=at(R,S,P);if(!Z)return ih;const fe=R;R.endScope&&R.endScope._wrap?(se(),pe(T,R.endScope._wrap)):R.endScope&&R.endScope._multi?(se(),ot(R.endScope,S)):fe.skip?X+=T:(fe.returnEnd||fe.excludeEnd||(X+=T),se(),fe.excludeEnd&&(X=T));do R.scope&&ie.closeNode(),!R.skip&&!R.subLanguage&&(Ze+=R.relevance),R=R.parent;while(R!==Z.parent);return Z.starts&&Be(Z.starts,S),fe.returnEnd?0:T.length}function de(){const S=[];for(let T=R;T!==xe;T=T.parent)T.scope&&S.unshift(T.scope);S.forEach(T=>ie.openNode(T))}let He={};function Je(S,T){const P=T&&T[0];if(X+=S,P==null)return se(),0;if(He.type==="begin"&&T.type==="end"&&He.index===T.index&&P===""){if(X+=C.slice(T.index,T.index+1),!i){const Z=new Error(`0 width match regex (${E})`);throw Z.languageName=E,Z.badRule=He.rule,Z}return 1}if(He=T,T.type==="begin")return xt(T);if(T.type==="illegal"&&!O){const Z=new Error('Illegal lexeme "'+P+'" for mode "'+(R.scope||"")+'"');throw Z.mode=R,Z}else if(T.type==="end"){const Z=$t(T);if(Z!==ih)return Z}if(T.type==="illegal"&&P==="")return 1;if(Et>1e5&&Et>T.index*3)throw new Error("potential infinite loop, way more iterations than matches");return X+=P,P.length}const xe=M(E);if(!xe)throw lr(s.replace("{}",E)),new Error('Unknown language: "'+E+'"');const sn=e_(xe);let wt="",R=D||sn;const tt={},ie=new a.__emitter(a);de();let X="",Ze=0,Ne=0,Et=0,kt=!1;try{if(xe.__emitTokens)xe.__emitTokens(C,ie);else{for(R.matcher.considerAll();;){Et++,kt?kt=!1:R.matcher.considerAll(),R.matcher.lastIndex=Ne;const S=R.matcher.exec(C);if(!S)break;const T=C.substring(Ne,S.index),P=Je(T,S);Ne=S.index+P}Je(C.substring(Ne))}return ie.finalize(),wt=ie.toHTML(),{language:E,value:wt,relevance:Ze,illegal:!1,_emitter:ie,_top:R}}catch(S){if(S.message&&S.message.includes("Illegal"))return{language:E,value:ol(C),illegal:!0,relevance:0,_illegalBy:{message:S.message,index:Ne,context:C.slice(Ne-100,Ne+100),mode:S.mode,resultSoFar:wt},_emitter:ie};if(i)return{language:E,value:ol(C),illegal:!1,relevance:0,errorRaised:S,_emitter:ie,_top:R};throw S}}function f(E){const C={value:ol(E),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return C._emitter.addText(E),C}function h(E,C){C=C||a.languages||Object.keys(e);const O=f(E),D=C.filter(M).filter($).map(se=>d(se,E,!1));D.unshift(O);const V=D.sort((se,pe)=>{if(se.relevance!==pe.relevance)return pe.relevance-se.relevance;if(se.language&&pe.language){if(M(se.language).supersetOf===pe.language)return 1;if(M(pe.language).supersetOf===se.language)return-1}return 0}),[G,ue]=V,Oe=G;return Oe.secondBest=ue,Oe}function p(E,C,O){const D=C&&n[C]||O;E.classList.add("hljs"),E.classList.add(`language-${D}`)}function g(E){let C=null;const O=u(E);if(l(O))return;if(U("before:highlightElement",{el:E,language:O}),E.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",E);return}if(E.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(E)),a.throwUnescapedHTML))throw new r_("One of your code blocks includes unescaped HTML.",E.innerHTML);C=E;const D=C.textContent,V=O?c(D,{language:O,ignoreIllegals:!0}):h(D);E.innerHTML=V.value,E.dataset.highlighted="yes",p(E,O,V.language),E.result={language:V.language,re:V.relevance,relevance:V.relevance},V.secondBest&&(E.secondBest={language:V.secondBest.language,relevance:V.secondBest.relevance}),U("after:highlightElement",{el:E,result:V,text:D})}function m(E){a=rh(a,E)}const y=()=>{b(),Tr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){b(),Tr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function b(){if(document.readyState==="loading"){x=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function k(){x&&b()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",k,!1);function w(E,C){let O=null;try{O=C(t)}catch(D){if(lr("Language definition for '{}' could not be registered.".replace("{}",E)),i)lr(D);else throw D;O=o}O.name||(O.name=E),e[E]=O,O.rawDefinition=C.bind(null,t),O.aliases&&I(O.aliases,{languageName:E})}function _(E){delete e[E];for(const C of Object.keys(n))n[C]===E&&delete n[C]}function N(){return Object.keys(e)}function M(E){return E=(E||"").toLowerCase(),e[E]||e[n[E]]}function I(E,{languageName:C}){typeof E=="string"&&(E=[E]),E.forEach(O=>{n[O.toLowerCase()]=C})}function $(E){const C=M(E);return C&&!C.disableAutodetect}function K(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=C=>{E["before:highlightBlock"](Object.assign({block:C.el},C))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=C=>{E["after:highlightBlock"](Object.assign({block:C.el},C))})}function z(E){K(E),r.push(E)}function j(E){const C=r.indexOf(E);C!==-1&&r.splice(C,1)}function U(E,C){const O=E;r.forEach(function(D){D[O]&&D[O](C)})}function te(E){return Tr("10.7.0","highlightBlock will be removed entirely in v12.0"),Tr("10.7.0","Please use highlightElement now."),g(E)}Object.assign(t,{highlight:c,highlightAuto:h,highlightAll:b,highlightElement:g,highlightBlock:te,configure:m,initHighlighting:y,initHighlightingOnLoad:v,registerLanguage:w,unregisterLanguage:_,listLanguages:N,getLanguage:M,registerAliases:I,autoDetection:$,inherit:rh,addPlugin:z,removePlugin:j}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=n_,t.regex={concat:vr,lookahead:J1,either:ic,optional:y6,anyNumberOfTimes:b6};for(const E in Fs)typeof Fs[E]=="object"&&j1(Fs[E]);return Object.assign(t,Fs),t},ii=sg({});ii.newInstance=()=>sg({});var s_=ii;ii.HighlightJS=ii;ii.default=ii;const o_=la(s_),sh={},a_="hljs-";function l_(t){const e=o_.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function n(l,u,c){const d=c||sh,f=typeof d.prefix=="string"?d.prefix:a_;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:u_,classPrefix:f});const h=e.highlight(u,{ignoreIllegals:!0,language:l});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});const p=h._emitter.root,g=p.data;return g.language=h.language,g.relevance=h.relevance,p}function r(l,u){const d=(u||sh).subset||i();let f=-1,h=0,p;for(;++fh&&(h=m.data.relevance,p=m)}return p||{type:"root",children:[],data:{language:void 0,relevance:h}}}function i(){return e.listLanguages()}function s(l,u){if(typeof l=="string")e.registerLanguage(l,u);else{let c;for(c in l)Object.hasOwn(l,c)&&e.registerLanguage(c,l[c])}}function o(l,u){if(typeof l=="string")e.registerAliases(typeof u=="string"?u:[...u],{languageName:l});else{let c;for(c in l)if(Object.hasOwn(l,c)){const d=l[c];e.registerAliases(typeof d=="string"?d:[...d],{languageName:c})}}}function a(l){return!!e.getLanguage(l)}}class u_{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 n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.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 c_=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,oh=new Ce("aie-video-plugin"),bi="video_action",d_=ae.create({name:"video",group:"block",addAttributes(){return{src:{default:null,parseHTML:t=>{const e=t.getAttribute("src");if(e)return e;const n=t.querySelector("source");return n?n.getAttribute("src"):null},renderHTML:t=>({src:t.src})},poster:{default:null,parseHTML:t=>t.getAttribute("poster"),renderHTML:t=>({poster:t.poster})},width:{default:350,parseHTML:t=>`${t.getAttribute("width")??""}`},controls:{default:!0,parseHTML:t=>`${t.getAttribute("controls")??"true"}`}}},parseHTML(){return[{tag:"video",getAttrs:t=>({src:t.getAttribute("src"),poster:t.getAttribute("poster")})}]},renderHTML({HTMLAttributes:t}){return["video",{controls:"true",...t,src:null},["source",{src:t.src}]]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent(`",Xf=t=>!!t.scope,p6=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${e}${t}`};class g6{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=G1(e)}openNode(e){if(!Xf(e))return;const n=p6(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){Xf(e)&&(this.buffer+=h6)}value(){return this.buffer}span(e){this.buffer+=``}}const Qf=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class nc{constructor(){this.rootNode=Qf(),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 n=Qf({scope:e});this.add(n),this.stack.push(n)}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,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{nc._collapse(n)}))}}class m6 extends nc{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new g6(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Ji(t){return t?typeof t=="string"?t:t.source:null}function J1(t){return xr("(?=",t,")")}function b6(t){return xr("(?:",t,")*")}function y6(t){return xr("(?:",t,")?")}function xr(...t){return t.map(n=>Ji(n)).join("")}function v6(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function rc(...t){return"("+(v6(t).capture?"":"?:")+t.map(r=>Ji(r)).join("|")+")"}function Y1(t){return new RegExp(t.toString()+"|").exec("").length-1}function x6(t,e){const n=t&&t.exec(e);return n&&n.index===0}const w6=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ic(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const i=n;let s=Ji(r),o="";for(;s.length>0;){const a=w6.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]==="("&&n++)}return o}).map(r=>`(${r})`).join(e)}const E6=/\b\B/,X1="[a-zA-Z]\\w*",sc="[a-zA-Z_]\\w*",Q1="\\b\\d+(\\.\\d+)?",eg="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",tg="\\b(0b[01]+)",k6="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",C6=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=xr(e,/.*\b/,t.binary,/\b.*/)),Ln({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Yi={begin:"\\\\[\\s\\S]",relevance:0},_6={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Yi]},S6={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Yi]},M6={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/},pa=function(t,e,n={}){const r=Ln({scope:"comment",begin:t,end:e,contains:[]},n);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=rc("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:xr(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},A6=pa("//","$"),T6=pa("/\\*","\\*/"),O6=pa("#","$"),N6={scope:"number",begin:Q1,relevance:0},L6={scope:"number",begin:eg,relevance:0},D6={scope:"number",begin:tg,relevance:0},R6={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Yi,{begin:/\[/,end:/\]/,relevance:0,contains:[Yi]}]},I6={scope:"title",begin:X1,relevance:0},H6={scope:"title",begin:sc,relevance:0},B6={begin:"\\.\\s*"+sc,relevance:0},P6=function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})};var Fs=Object.freeze({__proto__:null,APOS_STRING_MODE:_6,BACKSLASH_ESCAPE:Yi,BINARY_NUMBER_MODE:D6,BINARY_NUMBER_RE:tg,COMMENT:pa,C_BLOCK_COMMENT_MODE:T6,C_LINE_COMMENT_MODE:A6,C_NUMBER_MODE:L6,C_NUMBER_RE:eg,END_SAME_AS_BEGIN:P6,HASH_COMMENT_MODE:O6,IDENT_RE:X1,MATCH_NOTHING_RE:E6,METHOD_GUARD:B6,NUMBER_MODE:N6,NUMBER_RE:Q1,PHRASAL_WORDS_MODE:M6,QUOTE_STRING_MODE:S6,REGEXP_MODE:R6,RE_STARTERS_RE:k6,SHEBANG:C6,TITLE_MODE:I6,UNDERSCORE_IDENT_RE:sc,UNDERSCORE_TITLE_MODE:H6});function F6(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function $6(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function V6(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=F6,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function z6(t,e){Array.isArray(t.illegal)&&(t.illegal=rc(...t.illegal))}function U6(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function q6(t,e){t.relevance===void 0&&(t.relevance=1)}const Z6=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=xr(n.beforeMatch,J1(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},K6=["of","and","for","in","not","or","if","then","parent","list","value"],W6="keyword";function ng(t,e,n=W6){const r=Object.create(null);return typeof t=="string"?i(n,t.split(" ")):Array.isArray(t)?i(n,t):Object.keys(t).forEach(function(s){Object.assign(r,ng(t[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,j6(l[0],l[1])]})}}function j6(t,e){return e?Number(e):G6(t)?0:1}function G6(t){return K6.includes(t.toLowerCase())}const eh={},lr=t=>{console.error(t)},th=(t,...e)=>{console.log(`WARN: ${t}`,...e)},Or=(t,e)=>{eh[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),eh[`${t}/${e}`]=!0)},Po=new Error;function rg(t,e,{key:n}){let r=0;const i=t[n],s={},o={};for(let a=1;a<=e.length;a++)o[a+r]=i[a],s[a+r]=!0,r+=Y1(e[a-1]);t[n]=o,t[n]._emit=s,t[n]._multi=!0}function J6(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw lr("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Po;if(typeof t.beginScope!="object"||t.beginScope===null)throw lr("beginScope must be object"),Po;rg(t,t.begin,{key:"beginScope"}),t.begin=ic(t.begin,{joinWith:""})}}function Y6(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw lr("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Po;if(typeof t.endScope!="object"||t.endScope===null)throw lr("endScope must be object"),Po;rg(t,t.end,{key:"endScope"}),t.end=ic(t.end,{joinWith:""})}}function X6(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function Q6(t){X6(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),J6(t),Y6(t)}function e_(t){function e(o,a){return new RegExp(Ji(o),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(a?"g":""))}class n{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+=Y1(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=e(ic(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const u=l.findIndex((d,f)=>f>0&&d!==void 0),c=this.matchIndexes[u];return l.splice(0,u),Object.assign(l,c)}}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 n;return this.rules.slice(a).forEach(([u,c])=>l.addRule(u,c)),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 u=l.exec(a);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(a)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}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;[$6,U6,Q6,Z6].forEach(c=>c(o,a)),t.compilerExtensions.forEach(c=>c(o,a)),o.__beforeBegin=null,[V6,z6,q6].forEach(c=>c(o,a)),o.isCompiled=!0;let u=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),u=o.keywords.$pattern,delete o.keywords.$pattern),u=u||/\w+/,o.keywords&&(o.keywords=ng(o.keywords,t.case_insensitive)),l.keywordPatternRe=e(u,!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=Ji(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(c){return t_(c==="self"?o:c)})),o.contains.forEach(function(c){s(c,l)}),o.starts&&s(o.starts,a),l.matcher=i(l),l}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=Ln(t.classNameAliases||{}),s(t)}function ig(t){return t?t.endsWithParent||ig(t.starts):!1}function t_(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return Ln(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:ig(t)?Ln(t,{starts:t.starts?Ln(t.starts):null}):Object.isFrozen(t)?Ln(t):t}var n_="11.9.0";class r_ extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const ol=G1,nh=Ln,rh=Symbol("nomatch"),i_=7,sg=function(t){const e=Object.create(null),n=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:m6};function l(E){return a.noHighlightRe.test(E)}function u(E){let C=E.className+" ";C+=E.parentNode?E.parentNode.className:"";const O=a.languageDetectRe.exec(C);if(O){const D=M(O[1]);return D||(th(s.replace("{}",O[1])),th("Falling back to no-highlight mode for this block.",E)),D?O[1]:"no-highlight"}return C.split(/\s+/).find(D=>l(D)||M(D))}function c(E,C,O){let D="",V="";typeof C=="object"?(D=E,O=C.ignoreIllegals,V=C.language):(Or("10.7.0","highlight(lang, code, ...args) has been deprecated."),Or("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),V=E,D=C),O===void 0&&(O=!0);const G={code:D,language:V};U("before:highlight",G);const ue=G.result?G.result:d(G.language,G.code,O);return ue.code=G.code,U("after:highlight",ue),ue}function d(E,C,O,D){const V=Object.create(null);function G(S,T){return S.keywords[T]}function ue(){if(!R.keywords){ie.addText(X);return}let S=0;R.keywordPatternRe.lastIndex=0;let T=R.keywordPatternRe.exec(X),P="";for(;T;){P+=X.substring(S,T.index);const Z=xe.case_insensitive?T[0].toLowerCase():T[0],fe=G(R,Z);if(fe){const[Le,fi]=fe;if(ie.addText(P),P="",V[Z]=(V[Z]||0)+1,V[Z]<=i_&&(Ze+=fi),Le.startsWith("_"))P+=T[0];else{const A=xe.classNameAliases[Le]||Le;pe(T[0],A)}}else P+=T[0];S=R.keywordPatternRe.lastIndex,T=R.keywordPatternRe.exec(X)}P+=X.substring(S),ie.addText(P)}function Oe(){if(X==="")return;let S=null;if(typeof R.subLanguage=="string"){if(!e[R.subLanguage]){ie.addText(X);return}S=d(R.subLanguage,X,!0,tt[R.subLanguage]),tt[R.subLanguage]=S._top}else S=h(X,R.subLanguage.length?R.subLanguage:null);R.relevance>0&&(Ze+=S.relevance),ie.__addSublanguage(S._emitter,S.language)}function se(){R.subLanguage!=null?Oe():ue(),X=""}function pe(S,T){S!==""&&(ie.startScope(T),ie.addText(S),ie.endScope())}function ot(S,T){let P=1;const Z=T.length-1;for(;P<=Z;){if(!S._emit[P]){P++;continue}const fe=xe.classNameAliases[S[P]]||S[P],Le=T[P];fe?pe(Le,fe):(X=Le,ue(),X=""),P++}}function Be(S,T){return S.scope&&typeof S.scope=="string"&&ie.openNode(xe.classNameAliases[S.scope]||S.scope),S.beginScope&&(S.beginScope._wrap?(pe(X,xe.classNameAliases[S.beginScope._wrap]||S.beginScope._wrap),X=""):S.beginScope._multi&&(ot(S.beginScope,T),X="")),R=Object.create(S,{parent:{value:R}}),R}function at(S,T,P){let Z=x6(S.endRe,P);if(Z){if(S["on:end"]){const fe=new Yf(S);S["on:end"](T,fe),fe.isMatchIgnored&&(Z=!1)}if(Z){for(;S.endsParent&&S.parent;)S=S.parent;return S}}if(S.endsWithParent)return at(S.parent,T,P)}function lt(S){return R.matcher.regexIndex===0?(X+=S[0],1):(kt=!0,0)}function xt(S){const T=S[0],P=S.rule,Z=new Yf(P),fe=[P.__beforeBegin,P["on:begin"]];for(const Le of fe)if(Le&&(Le(S,Z),Z.isMatchIgnored))return lt(T);return P.skip?X+=T:(P.excludeBegin&&(X+=T),se(),!P.returnBegin&&!P.excludeBegin&&(X=T)),Be(P,S),P.returnBegin?0:T.length}function $t(S){const T=S[0],P=C.substring(S.index),Z=at(R,S,P);if(!Z)return rh;const fe=R;R.endScope&&R.endScope._wrap?(se(),pe(T,R.endScope._wrap)):R.endScope&&R.endScope._multi?(se(),ot(R.endScope,S)):fe.skip?X+=T:(fe.returnEnd||fe.excludeEnd||(X+=T),se(),fe.excludeEnd&&(X=T));do R.scope&&ie.closeNode(),!R.skip&&!R.subLanguage&&(Ze+=R.relevance),R=R.parent;while(R!==Z.parent);return Z.starts&&Be(Z.starts,S),fe.returnEnd?0:T.length}function de(){const S=[];for(let T=R;T!==xe;T=T.parent)T.scope&&S.unshift(T.scope);S.forEach(T=>ie.openNode(T))}let He={};function Je(S,T){const P=T&&T[0];if(X+=S,P==null)return se(),0;if(He.type==="begin"&&T.type==="end"&&He.index===T.index&&P===""){if(X+=C.slice(T.index,T.index+1),!i){const Z=new Error(`0 width match regex (${E})`);throw Z.languageName=E,Z.badRule=He.rule,Z}return 1}if(He=T,T.type==="begin")return xt(T);if(T.type==="illegal"&&!O){const Z=new Error('Illegal lexeme "'+P+'" for mode "'+(R.scope||"")+'"');throw Z.mode=R,Z}else if(T.type==="end"){const Z=$t(T);if(Z!==rh)return Z}if(T.type==="illegal"&&P==="")return 1;if(Et>1e5&&Et>T.index*3)throw new Error("potential infinite loop, way more iterations than matches");return X+=P,P.length}const xe=M(E);if(!xe)throw lr(s.replace("{}",E)),new Error('Unknown language: "'+E+'"');const sn=e_(xe);let wt="",R=D||sn;const tt={},ie=new a.__emitter(a);de();let X="",Ze=0,Ne=0,Et=0,kt=!1;try{if(xe.__emitTokens)xe.__emitTokens(C,ie);else{for(R.matcher.considerAll();;){Et++,kt?kt=!1:R.matcher.considerAll(),R.matcher.lastIndex=Ne;const S=R.matcher.exec(C);if(!S)break;const T=C.substring(Ne,S.index),P=Je(T,S);Ne=S.index+P}Je(C.substring(Ne))}return ie.finalize(),wt=ie.toHTML(),{language:E,value:wt,relevance:Ze,illegal:!1,_emitter:ie,_top:R}}catch(S){if(S.message&&S.message.includes("Illegal"))return{language:E,value:ol(C),illegal:!0,relevance:0,_illegalBy:{message:S.message,index:Ne,context:C.slice(Ne-100,Ne+100),mode:S.mode,resultSoFar:wt},_emitter:ie};if(i)return{language:E,value:ol(C),illegal:!1,relevance:0,errorRaised:S,_emitter:ie,_top:R};throw S}}function f(E){const C={value:ol(E),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return C._emitter.addText(E),C}function h(E,C){C=C||a.languages||Object.keys(e);const O=f(E),D=C.filter(M).filter($).map(se=>d(se,E,!1));D.unshift(O);const V=D.sort((se,pe)=>{if(se.relevance!==pe.relevance)return pe.relevance-se.relevance;if(se.language&&pe.language){if(M(se.language).supersetOf===pe.language)return 1;if(M(pe.language).supersetOf===se.language)return-1}return 0}),[G,ue]=V,Oe=G;return Oe.secondBest=ue,Oe}function p(E,C,O){const D=C&&n[C]||O;E.classList.add("hljs"),E.classList.add(`language-${D}`)}function g(E){let C=null;const O=u(E);if(l(O))return;if(U("before:highlightElement",{el:E,language:O}),E.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",E);return}if(E.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(E)),a.throwUnescapedHTML))throw new r_("One of your code blocks includes unescaped HTML.",E.innerHTML);C=E;const D=C.textContent,V=O?c(D,{language:O,ignoreIllegals:!0}):h(D);E.innerHTML=V.value,E.dataset.highlighted="yes",p(E,O,V.language),E.result={language:V.language,re:V.relevance,relevance:V.relevance},V.secondBest&&(E.secondBest={language:V.secondBest.language,relevance:V.secondBest.relevance}),U("after:highlightElement",{el:E,result:V,text:D})}function m(E){a=nh(a,E)}const y=()=>{b(),Or("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){b(),Or("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function b(){if(document.readyState==="loading"){x=!0;return}document.querySelectorAll(a.cssSelector).forEach(g)}function k(){x&&b()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",k,!1);function w(E,C){let O=null;try{O=C(t)}catch(D){if(lr("Language definition for '{}' could not be registered.".replace("{}",E)),i)lr(D);else throw D;O=o}O.name||(O.name=E),e[E]=O,O.rawDefinition=C.bind(null,t),O.aliases&&I(O.aliases,{languageName:E})}function _(E){delete e[E];for(const C of Object.keys(n))n[C]===E&&delete n[C]}function N(){return Object.keys(e)}function M(E){return E=(E||"").toLowerCase(),e[E]||e[n[E]]}function I(E,{languageName:C}){typeof E=="string"&&(E=[E]),E.forEach(O=>{n[O.toLowerCase()]=C})}function $(E){const C=M(E);return C&&!C.disableAutodetect}function K(E){E["before:highlightBlock"]&&!E["before:highlightElement"]&&(E["before:highlightElement"]=C=>{E["before:highlightBlock"](Object.assign({block:C.el},C))}),E["after:highlightBlock"]&&!E["after:highlightElement"]&&(E["after:highlightElement"]=C=>{E["after:highlightBlock"](Object.assign({block:C.el},C))})}function z(E){K(E),r.push(E)}function j(E){const C=r.indexOf(E);C!==-1&&r.splice(C,1)}function U(E,C){const O=E;r.forEach(function(D){D[O]&&D[O](C)})}function te(E){return Or("10.7.0","highlightBlock will be removed entirely in v12.0"),Or("10.7.0","Please use highlightElement now."),g(E)}Object.assign(t,{highlight:c,highlightAuto:h,highlightAll:b,highlightElement:g,highlightBlock:te,configure:m,initHighlighting:y,initHighlightingOnLoad:v,registerLanguage:w,unregisterLanguage:_,listLanguages:N,getLanguage:M,registerAliases:I,autoDetection:$,inherit:nh,addPlugin:z,removePlugin:j}),t.debugMode=function(){i=!1},t.safeMode=function(){i=!0},t.versionString=n_,t.regex={concat:xr,lookahead:J1,either:rc,optional:y6,anyNumberOfTimes:b6};for(const E in Fs)typeof Fs[E]=="object"&&j1(Fs[E]);return Object.assign(t,Fs),t},si=sg({});si.newInstance=()=>sg({});var s_=si;si.HighlightJS=si;si.default=si;const o_=la(s_),ih={},a_="hljs-";function l_(t){const e=o_.newInstance();return t&&s(t),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:o,registered:a};function n(l,u,c){const d=c||ih,f=typeof d.prefix=="string"?d.prefix:a_;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:u_,classPrefix:f});const h=e.highlight(u,{ignoreIllegals:!0,language:l});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});const p=h._emitter.root,g=p.data;return g.language=h.language,g.relevance=h.relevance,p}function r(l,u){const d=(u||ih).subset||i();let f=-1,h=0,p;for(;++fh&&(h=m.data.relevance,p=m)}return p||{type:"root",children:[],data:{language:void 0,relevance:h}}}function i(){return e.listLanguages()}function s(l,u){if(typeof l=="string")e.registerLanguage(l,u);else{let c;for(c in l)Object.hasOwn(l,c)&&e.registerLanguage(c,l[c])}}function o(l,u){if(typeof l=="string")e.registerAliases(typeof u=="string"?u:[...u],{languageName:l});else{let c;for(c in l)if(Object.hasOwn(l,c)){const d=l[c];e.registerAliases(typeof d=="string"?d:[...d],{languageName:c})}}}function a(l){return!!e.getLanguage(l)}}class u_{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 n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],i=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.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 c_=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,sh=new ke("aie-video-plugin"),yi="video_action",d_=ae.create({name:"video",group:"block",addAttributes(){return{src:{default:null,parseHTML:t=>{const e=t.getAttribute("src");if(e)return e;const n=t.querySelector("source");return n?n.getAttribute("src"):null},renderHTML:t=>({src:t.src})},poster:{default:null,parseHTML:t=>t.getAttribute("poster"),renderHTML:t=>({poster:t.poster})},width:{default:350,parseHTML:t=>`${t.getAttribute("width")??""}`},controls:{default:!0,parseHTML:t=>`${t.getAttribute("controls")??"true"}`}}},parseHTML(){return[{tag:"video",getAttrs:t=>({src:t.getAttribute("src"),poster:t.getAttribute("poster")})}]},renderHTML({HTMLAttributes:t}){return["video",{controls:"true",...t,src:null},["source",{src:t.src}]]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent(`