lexxy 0.7.6.beta → 0.8.2.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r={exports:{}};var i=(n||(n=1,function(t){var n=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof o?new o(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var r,o;switch(n=n||{},i.util.type(t)){case"Object":if(o=i.util.objId(t),n[o])return n[o];for(var s in r={},n[o]=r,t)t.hasOwnProperty(s)&&(r[s]=e(t[s],n));return r;case"Array":return o=i.util.objId(t),n[o]?n[o]:(r=[],n[o]=r,t.forEach((function(t,i){r[i]=e(t,n)})),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){var o=(r=r||i.languages)[e],s={};for(var l in o)if(o.hasOwnProperty(l)){if(l==t)for(var a in n)n.hasOwnProperty(a)&&(s[a]=n[a]);n.hasOwnProperty(l)||(s[l]=o[l])}var c=r[e];return r[e]=s,i.languages.DFS(i.languages,(function(t,n){n===c&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,r,o){o=o||{};var s=i.util.objId;for(var l in t)if(t.hasOwnProperty(l)){n.call(t,l,t[l],r||l);var a=t[l],c=i.util.type(a);"Object"!==c||o[s(a)]?"Array"!==c||o[s(a)]||(o[s(a)]=!0,e(a,n,l,o)):(o[s(a)]=!0,e(a,n,null,o))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),i.hooks.run("before-all-elements-highlight",r);for(var o,s=0;o=r.elements[s++];)i.highlightElement(o,!0===t,r.callback)},highlightElement:function(t,n,r){var o=i.util.getLanguage(t),s=i.languages[o];i.util.setLanguage(t,o);var l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&i.util.setLanguage(l,o);var a={element:t,language:o,grammar:s,code:t.textContent};function c(e){a.highlightedCode=e,i.hooks.run("before-insert",a),a.element.innerHTML=a.highlightedCode,i.hooks.run("after-highlight",a),i.hooks.run("complete",a),r&&r.call(a.element)}if(i.hooks.run("before-sanity-check",a),(l=a.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!a.code)return i.hooks.run("complete",a),void(r&&r.call(a.element));if(i.hooks.run("before-highlight",a),a.grammar)if(n&&e.Worker){var u=new Worker(i.filename);u.onmessage=function(e){c(e.data)},u.postMessage(JSON.stringify({language:a.language,code:a.code,immediateClose:!0}))}else c(i.highlight(a.code,a.grammar,a.language));else c(i.util.encode(a.code))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(i.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=i.tokenize(r.code,r.grammar),i.hooks.run("after-tokenize",r),o.stringify(i.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new a;return c(i,i.head,e),l(e,i,t,i.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(n&&n.length)for(var r,o=0;r=n[o++];)r(t)}},Token:o};function o(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function s(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var o=i[1].length;i.index+=o,i[0]=i[0].slice(o)}return i}function l(e,t,n,r,a,d){for(var h in n)if(n.hasOwnProperty(h)&&n[h]){var g=n[h];g=Array.isArray(g)?g:[g];for(var p=0;p<g.length;++p){if(d&&d.cause==h+","+p)return;var f=g[p],m=f.inside,y=!!f.lookbehind,b=!!f.greedy,_=f.alias;if(b&&!f.pattern.global){var x=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,x+"g")}for(var S=f.pattern||f,C=r.next,w=a;C!==t.tail&&!(d&&w>=d.reach);w+=C.value.length,C=C.next){var v=C.value;if(t.length>e.length)return;if(!(v instanceof o)){var k,E=1;if(b){if(!(k=s(S,w,e,y))||k.index>=e.length)break;var T=k.index,N=k.index+k[0].length,A=w;for(A+=C.value.length;T>=A;)A+=(C=C.next).value.length;if(w=A-=C.value.length,C.value instanceof o)continue;for(var L=C;L!==t.tail&&(A<N||"string"==typeof L.value);L=L.next)E++,A+=L.value.length;E--,v=e.slice(w,A),k.index-=w}else if(!(k=s(S,0,v,y)))continue;T=k.index;var O=k[0],F=v.slice(0,T),R=v.slice(T+O.length),I=w+v.length;d&&I>d.reach&&(d.reach=I);var P=C.prev;if(F&&(P=c(t,P,F),w+=F.length),u(t,P,E),C=c(t,P,new o(h,m?i.tokenize(O,m):O,_,O)),R&&c(t,C,R),E>1){var M={cause:h+","+p,reach:I};l(e,t,n,C.prev,w,M),d&&M.reach>d.reach&&(d.reach=M.reach)}}}}}}function a(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function u(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}if(e.Prism=i,o.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach((function(t){r+=e(t,n)})),r}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(o.classes,s):o.classes.push(s)),i.hooks.run("wrap",o);var l="";for(var a in o.attributes)l+=" "+a+'="'+(o.attributes[a]||"").replace(/"/g,"&quot;")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+l+">"+o.content+"</"+o.tag+">"},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,o=n.code,s=n.immediateClose;e.postMessage(i.highlight(o,i.languages[r],r)),s&&e.close()}),!1),i):i;var d=i.util.currentScript();function h(){i.manual||i.highlightAll()}if(d&&(i.filename=d.src,d.hasAttribute("data-manual")&&(i.manual=!0)),!i.manual){var g=document.readyState;"loading"===g||"interactive"===g&&d&&d.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return i}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});
1
+ var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r={exports:{}};var i=(n||(n=1,function(t){var n=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof o?new o(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var r,o;switch(n=n||{},i.util.type(t)){case"Object":if(o=i.util.objId(t),n[o])return n[o];for(var s in r={},n[o]=r,t)t.hasOwnProperty(s)&&(r[s]=e(t[s],n));return r;case"Array":return o=i.util.objId(t),n[o]?n[o]:(r=[],n[o]=r,t.forEach((function(t,i){r[i]=e(t,n)})),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+n)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){var o=(r=r||i.languages)[e],s={};for(var l in o)if(o.hasOwnProperty(l)){if(l==t)for(var a in n)n.hasOwnProperty(a)&&(s[a]=n[a]);n.hasOwnProperty(l)||(s[l]=o[l])}var c=r[e];return r[e]=s,i.languages.DFS(i.languages,(function(t,n){n===c&&t!=e&&(this[t]=s)})),s},DFS:function e(t,n,r,o){o=o||{};var s=i.util.objId;for(var l in t)if(t.hasOwnProperty(l)){n.call(t,l,t[l],r||l);var a=t[l],c=i.util.type(a);"Object"!==c||o[s(a)]?"Array"!==c||o[s(a)]||(o[s(a)]=!0,e(a,n,l,o)):(o[s(a)]=!0,e(a,n,null,o))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};i.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),i.hooks.run("before-all-elements-highlight",r);for(var o,s=0;o=r.elements[s++];)i.highlightElement(o,!0===t,r.callback)},highlightElement:function(t,n,r){var o=i.util.getLanguage(t),s=i.languages[o];i.util.setLanguage(t,o);var l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&i.util.setLanguage(l,o);var a={element:t,language:o,grammar:s,code:t.textContent};function c(e){a.highlightedCode=e,i.hooks.run("before-insert",a),a.element.innerHTML=a.highlightedCode,i.hooks.run("after-highlight",a),i.hooks.run("complete",a),r&&r.call(a.element)}if(i.hooks.run("before-sanity-check",a),(l=a.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!a.code)return i.hooks.run("complete",a),void(r&&r.call(a.element));if(i.hooks.run("before-highlight",a),a.grammar)if(n&&e.Worker){var u=new Worker(i.filename);u.onmessage=function(e){c(e.data)},u.postMessage(JSON.stringify({language:a.language,code:a.code,immediateClose:!0}))}else c(i.highlight(a.code,a.grammar,a.language));else c(i.util.encode(a.code))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(i.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=i.tokenize(r.code,r.grammar),i.hooks.run("after-tokenize",r),o.stringify(i.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new a;return c(i,i.head,e),l(e,i,t,i.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(n&&n.length)for(var r,o=0;r=n[o++];)r(t)}},Token:o};function o(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function s(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var o=i[1].length;i.index+=o,i[0]=i[0].slice(o)}return i}function l(e,t,n,r,a,d){for(var h in n)if(n.hasOwnProperty(h)&&n[h]){var g=n[h];g=Array.isArray(g)?g:[g];for(var p=0;p<g.length;++p){if(d&&d.cause==h+","+p)return;var f=g[p],m=f.inside,y=!!f.lookbehind,b=!!f.greedy,_=f.alias;if(b&&!f.pattern.global){var x=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,x+"g")}for(var C=f.pattern||f,S=r.next,w=a;S!==t.tail&&!(d&&w>=d.reach);w+=S.value.length,S=S.next){var v=S.value;if(t.length>e.length)return;if(!(v instanceof o)){var k,E=1;if(b){if(!(k=s(C,w,e,y))||k.index>=e.length)break;var T=k.index,N=k.index+k[0].length,A=w;for(A+=S.value.length;T>=A;)A+=(S=S.next).value.length;if(w=A-=S.value.length,S.value instanceof o)continue;for(var L=S;L!==t.tail&&(A<N||"string"==typeof L.value);L=L.next)E++,A+=L.value.length;E--,v=e.slice(w,A),k.index-=w}else if(!(k=s(C,0,v,y)))continue;T=k.index;var O=k[0],F=v.slice(0,T),R=v.slice(T+O.length),I=w+v.length;d&&I>d.reach&&(d.reach=I);var P=S.prev;if(F&&(P=c(t,P,F),w+=F.length),u(t,P,E),S=c(t,P,new o(h,m?i.tokenize(O,m):O,_,O)),R&&c(t,S,R),E>1){var M={cause:h+","+p,reach:I};l(e,t,n,S.prev,w,M),d&&M.reach>d.reach&&(d.reach=M.reach)}}}}}}function a(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function u(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}if(e.Prism=i,o.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach((function(t){r+=e(t,n)})),r}var o={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(o.classes,s):o.classes.push(s)),i.hooks.run("wrap",o);var l="";for(var a in o.attributes)l+=" "+a+'="'+(o.attributes[a]||"").replace(/"/g,"&quot;")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+l+">"+o.content+"</"+o.tag+">"},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,o=n.code,s=n.immediateClose;e.postMessage(i.highlight(o,i.languages[r],r)),s&&e.close()}),!1),i):i;var d=i.util.currentScript();function h(){i.manual||i.highlightAll()}if(d&&(i.filename=d.src,d.hasAttribute("data-manual")&&(i.manual=!0)),!i.manual){var g=document.readyState;"loading"===g||"interactive"===g&&d&&d.defer?document.addEventListener("DOMContentLoaded",h):window.requestAnimationFrame?window.requestAnimationFrame(h):window.setTimeout(h,16)}return i}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});
2
2
  /**
3
3
  * Prism: Lightweight, robust, elegant syntax highlighting
4
4
  *
@@ -8,4 +8,4 @@ var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?windo
8
8
  * @public
9
9
  */t.exports&&(t.exports=n),void 0!==e&&(e.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i["language-"+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:i},n.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(e,t){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:n.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,function(){if(void 0!==n&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",r="loading",i="loaded",o="pre[data-src]:not(["+t+'="'+i+'"]):not(['+t+'="'+r+'"])';n.hooks.add("before-highlightall",(function(e){e.selector+=", "+o})),n.hooks.add("before-sanity-check",(function(s){var l=s.element;if(l.matches(o)){s.code="",l.setAttribute(t,r);var a=l.appendChild(document.createElement("CODE"));a.textContent="Loading…";var c=l.getAttribute("data-src"),u=s.language;if("none"===u){var d=(/\.(\w+)$/.exec(c)||[,"none"])[1];u=e[d]||d}n.util.setLanguage(a,u),n.util.setLanguage(l,u);var h=n.plugins.autoloader;h&&h.loadLanguages(u),function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?t(r.responseText):r.status>=400?n("✖ Error "+r.status+" while fetching file: "+r.statusText):n("✖ Error: File does not exist or is empty"))},r.send(null)}(c,(function(e){l.setAttribute(t,i);var r=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}(l.getAttribute("data-range"));if(r){var o=e.split(/\r\n?|\n/g),s=r[0],c=null==r[1]?o.length:r[1];s<0&&(s+=o.length),s=Math.max(0,Math.min(s-1,o.length)),c<0&&(c+=o.length),c=Math.max(0,Math.min(c,o.length)),e=o.slice(s,c).join("\n"),l.hasAttribute("data-start")||l.setAttribute("data-start",String(s+1))}a.textContent=e,n.highlightElement(a)}),(function(e){l.setAttribute(t,"failed"),a.textContent=e}))}})),n.plugins.fileHighlight={highlight:function(e){for(var t,r=(e||document).querySelectorAll(o),i=0;t=r[i++];)n.highlightElement(t)}};var s=!1;n.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}}}()}(r)),r.exports),o=t(i);o.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},o.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},o.languages.markup.tag.inside["attr-value"].inside.entity=o.languages.markup.entity,o.languages.markup.doctype.inside["internal-subset"].inside=o.languages.markup,o.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))})),Object.defineProperty(o.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:o.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:o.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},o.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(o.languages.markup.tag,"addAttribute",{value:function(e,t){o.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:o.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),o.languages.html=o.languages.markup,o.languages.mathml=o.languages.markup,o.languages.svg=o.languages.markup,o.languages.xml=o.languages.extend("markup",{}),o.languages.ssml=o.languages.xml,o.languages.atom=o.languages.xml,o.languages.rss=o.languages.xml,function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,i,o){if(n.language===r){var s=n.tokenStack=[];n.code=n.code.replace(i,(function(e){if("function"==typeof o&&!o(e))return e;for(var i,l=s.length;-1!==n.code.indexOf(i=t(r,l));)++l;return s[l]=e,i})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var i=0,o=Object.keys(n.tokenStack);!function s(l){for(var a=0;a<l.length&&!(i>=o.length);a++){var c=l[a];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[i],d=n.tokenStack[u],h="string"==typeof c?c:c.content,g=t(r,u),p=h.indexOf(g);if(p>-1){++i;var f=h.substring(0,p),m=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),y=h.substring(p+g.length),b=[];f&&b.push.apply(b,s([f])),b.push(m),y&&b.push.apply(b,s([y])),"string"==typeof c?l.splice.apply(l,[a,1].concat(b)):c.content=b}}else c.content&&s(c.content)}return l}(n.tokens)}}}})}(o);var s;s||(s=1,function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var n="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+n+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+n),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+n),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby}(o));var l;l||(l=1,function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,o=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:i,punctuation:o};var s={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:s}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:s}}];e.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:r,operator:i,punctuation:o}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",(function(t){/<\?/.test(t.code)&&e.languages["markup-templating"].buildPlaceholders(t,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"php")}))}(o)),o.languages.go=o.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),o.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete o.languages.go["class-name"],function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,s=0;s<i.length;s++)o[i[s]]=e.languages.bash[i[s]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(o),o.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},o.languages.webmanifest=o.languages.json,function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(o),window.Prism=window.Prism||{},window.Prism.manual=!0;
10
10
  /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
11
- const{entries:a,setPrototypeOf:c,isFrozen:u,getPrototypeOf:d,getOwnPropertyDescriptor:h}=Object;let{freeze:g,seal:p,create:f}=Object,{apply:m,construct:y}="undefined"!=typeof Reflect&&Reflect;g||(g=function(e){return e}),p||(p=function(e){return e}),m||(m=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),y||(y=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const b=R(Array.prototype.forEach),_=R(Array.prototype.lastIndexOf),x=R(Array.prototype.pop),S=R(Array.prototype.push),C=R(Array.prototype.splice),w=R(String.prototype.toLowerCase),v=R(String.prototype.toString),k=R(String.prototype.match),E=R(String.prototype.replace),T=R(String.prototype.indexOf),N=R(String.prototype.trim),A=R(Object.prototype.hasOwnProperty),L=R(RegExp.prototype.test),O=(F=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y(F,t)});var F;function R(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return m(e,t,r)}}function I(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:w;c&&c(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(u(t)||(t[r]=e),i=e)}e[i]=!0}return e}function P(e){for(let t=0;t<e.length;t++){A(e,t)||(e[t]=null)}return e}function M(e){const t=f(null);for(const[n,r]of a(e)){A(e,n)&&(Array.isArray(r)?t[n]=P(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=M(r):t[n]=r)}return t}function D(e,t){for(;null!==e;){const n=h(e,t);if(n){if(n.get)return R(n.get);if("function"==typeof n.value)return R(n.value)}e=d(e)}return function(){return null}}const B=g(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),z=g(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$=g(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),H=g(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),K=g(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),U=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),W=g(["#text"]),V=g(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),j=g(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),q=g(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),G=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),J=p(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Z=p(/<%[\w\W]*|[\w\W]*%>/gm),Y=p(/\$\{[\w\W]*/gm),X=p(/^data-[\-\w.\u00B7-\uFFFF]+$/),Q=p(/^aria-[\-\w]+$/),ee=p(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),te=p(/^(?:\w+script|data):/i),ne=p(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),re=p(/^html$/i),ie=p(/^[a-z][.\w]*(-[.\w]+)+$/i);var oe=Object.freeze({__proto__:null,ARIA_ATTR:Q,ATTR_WHITESPACE:ne,CUSTOM_ELEMENT:ie,DATA_ATTR:X,DOCTYPE_NAME:re,ERB_EXPR:Z,IS_ALLOWED_URI:ee,IS_SCRIPT_OR_DATA:te,MUSTACHE_EXPR:J,TMPLIT_EXPR:Y});const se=1,le=3,ae=7,ce=8,ue=9,de=function(){return"undefined"==typeof window?null:window};var he=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de();const n=t=>e(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||t.document.nodeType!==ue||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,o=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:l,Node:c,Element:u,NodeFilter:d,NamedNodeMap:h=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:y}=t,F=u.prototype,R=D(F,"cloneNode"),P=D(F,"remove"),J=D(F,"nextSibling"),Z=D(F,"childNodes"),Y=D(F,"parentNode");if("function"==typeof l){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let X,Q="";const{implementation:te,createNodeIterator:ne,createDocumentFragment:ie,getElementsByTagName:he}=r,{importNode:ge}=i;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof a&&"function"==typeof Y&&te&&void 0!==te.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:me,TMPLIT_EXPR:ye,DATA_ATTR:be,ARIA_ATTR:_e,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:Se,CUSTOM_ELEMENT:Ce}=oe;let{IS_ALLOWED_URI:we}=oe,ve=null;const ke=I({},[...B,...z,...$,...K,...W]);let Ee=null;const Te=I({},[...V,...j,...q,...G]);let Ne=Object.seal(f(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Le=null;const Oe=Object.seal(f(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Re=!0,Ie=!1,Pe=!0,Me=!1,De=!0,Be=!1,ze=!1,$e=!1,He=!1,Ke=!1,Ue=!1,We=!0,Ve=!1,je=!0,qe=!1,Ge={},Je=null;const Ze=I({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Xe=I({},["audio","video","img","source","image","track"]);let Qe=null;const et=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml";let it=rt,ot=!1,st=null;const lt=I({},[tt,nt,rt],v);let at=I({},["mi","mo","mn","ms","mtext"]),ct=I({},["annotation-xml"]);const ut=I({},["title","style","font","a","script"]);let dt=null;const ht=["application/xhtml+xml","text/html"];let gt=null,pt=null;const ft=r.createElement("form"),mt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!pt||pt!==e){if(e&&"object"==typeof e||(e={}),e=M(e),dt=-1===ht.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,gt="application/xhtml+xml"===dt?v:w,ve=A(e,"ALLOWED_TAGS")?I({},e.ALLOWED_TAGS,gt):ke,Ee=A(e,"ALLOWED_ATTR")?I({},e.ALLOWED_ATTR,gt):Te,st=A(e,"ALLOWED_NAMESPACES")?I({},e.ALLOWED_NAMESPACES,v):lt,Qe=A(e,"ADD_URI_SAFE_ATTR")?I(M(et),e.ADD_URI_SAFE_ATTR,gt):et,Ye=A(e,"ADD_DATA_URI_TAGS")?I(M(Xe),e.ADD_DATA_URI_TAGS,gt):Xe,Je=A(e,"FORBID_CONTENTS")?I({},e.FORBID_CONTENTS,gt):Ze,Ae=A(e,"FORBID_TAGS")?I({},e.FORBID_TAGS,gt):M({}),Le=A(e,"FORBID_ATTR")?I({},e.FORBID_ATTR,gt):M({}),Ge=!!A(e,"USE_PROFILES")&&e.USE_PROFILES,Fe=!1!==e.ALLOW_ARIA_ATTR,Re=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Me=e.SAFE_FOR_TEMPLATES||!1,De=!1!==e.SAFE_FOR_XML,Be=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,Ke=e.RETURN_DOM_FRAGMENT||!1,Ue=e.RETURN_TRUSTED_TYPE||!1,$e=e.FORCE_BODY||!1,We=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,qe=e.IN_PLACE||!1,we=e.ALLOWED_URI_REGEXP||ee,it=e.NAMESPACE||rt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,ct=e.HTML_INTEGRATION_POINTS||ct,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ne.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ne.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(Re=!1),Ke&&(He=!0),Ge&&(ve=I({},W),Ee=[],!0===Ge.html&&(I(ve,B),I(Ee,V)),!0===Ge.svg&&(I(ve,z),I(Ee,j),I(Ee,G)),!0===Ge.svgFilters&&(I(ve,$),I(Ee,j),I(Ee,G)),!0===Ge.mathMl&&(I(ve,K),I(Ee,q),I(Ee,G))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Oe.tagCheck=e.ADD_TAGS:(ve===ke&&(ve=M(ve)),I(ve,e.ADD_TAGS,gt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Oe.attributeCheck=e.ADD_ATTR:(Ee===Te&&(Ee=M(Ee)),I(Ee,e.ADD_ATTR,gt))),e.ADD_URI_SAFE_ATTR&&I(Qe,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Je===Ze&&(Je=M(Je)),I(Je,e.FORBID_CONTENTS,gt)),je&&(ve["#text"]=!0),Be&&I(ve,["html","head","body"]),ve.table&&(I(ve,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw O('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw O('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');X=e.TRUSTED_TYPES_POLICY,Q=X.createHTML("")}else void 0===X&&(X=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(y,o)),null!==X&&"string"==typeof Q&&(Q=X.createHTML(""));g&&g(e),pt=e}},bt=I({},[...z,...$,...H]),_t=I({},[...K,...U]),xt=function(e){S(n.removed,{element:e});try{Y(e).removeChild(e)}catch(t){P(e)}},St=function(e,t){try{S(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){S(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(He||Ke)try{xt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Ct=function(e){let t=null,n=null;if($e)e="<remove></remove>"+e;else{const t=k(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===dt&&it===rt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=X?X.createHTML(e):e;if(it===rt)try{t=(new m).parseFromString(i,dt)}catch(e){}if(!t||!t.documentElement){t=te.createDocument(it,"template",null);try{t.documentElement.innerHTML=ot?Q:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),it===rt?he.call(t,Be?"html":"body")[0]:Be?t.documentElement:o},wt=function(e){return ne.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},vt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},kt=function(e){return"function"==typeof c&&e instanceof c};function Et(e,t,r){b(e,(e=>{e.call(n,t,r,pt)}))}const Tt=function(e){let t=null;if(Et(pe.beforeSanitizeElements,e,null),vt(e))return xt(e),!0;const r=gt(e.nodeName);if(Et(pe.uponSanitizeElement,e,{tagName:r,allowedTags:ve}),De&&e.hasChildNodes()&&!kt(e.firstElementChild)&&L(/<[/\w!]/g,e.innerHTML)&&L(/<[/\w!]/g,e.textContent))return xt(e),!0;if(e.nodeType===ae)return xt(e),!0;if(De&&e.nodeType===ce&&L(/<[/\w]/g,e.data))return xt(e),!0;if(!(Oe.tagCheck instanceof Function&&Oe.tagCheck(r))&&(!ve[r]||Ae[r])){if(!Ae[r]&&At(r)){if(Ne.tagNameCheck instanceof RegExp&&L(Ne.tagNameCheck,r))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(r))return!1}if(je&&!Je[r]){const t=Y(e)||e.parentNode,n=Z(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=R(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,J(e))}}}return xt(e),!0}return e instanceof u&&!function(e){let t=Y(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});const n=w(e.tagName),r=w(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===rt?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===r||at[r]):Boolean(bt[n]):e.namespaceURI===tt?t.namespaceURI===rt?"math"===n:t.namespaceURI===nt?"math"===n&&ct[r]:Boolean(_t[n]):e.namespaceURI===rt?!(t.namespaceURI===nt&&!ct[r])&&!(t.namespaceURI===tt&&!at[r])&&!_t[n]&&(ut[n]||!bt[n]):!("application/xhtml+xml"!==dt||!st[e.namespaceURI]))}(e)?(xt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!L(/<\/no(script|embed|frames)/i,e.innerHTML)?(Me&&e.nodeType===le&&(t=e.textContent,b([fe,me,ye],(e=>{t=E(t,e," ")})),e.textContent!==t&&(S(n.removed,{element:e.cloneNode()}),e.textContent=t)),Et(pe.afterSanitizeElements,e,null),!1):(xt(e),!0)},Nt=function(e,t,n){if(We&&("id"===t||"name"===t)&&(n in r||n in ft))return!1;if(Re&&!Le[t]&&L(be,t));else if(Fe&&L(_e,t));else if(Oe.attributeCheck instanceof Function&&Oe.attributeCheck(t,e));else if(!Ee[t]||Le[t]){if(!(At(e)&&(Ne.tagNameCheck instanceof RegExp&&L(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&L(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t,e))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&L(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Qe[t]);else if(L(we,E(n,Se,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==T(n,"data:")||!Ye[e]){if(Ie&&!L(xe,E(n,Se,"")));else if(n)return!1}else;return!0},At=function(e){return"annotation-xml"!==e&&k(e,Ce)},Lt=function(e){Et(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||vt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:l,value:a}=o,c=gt(s),u=a;let d="value"===s?u:N(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Et(pe.uponSanitizeAttribute,e,r),d=r.attrValue,!Ve||"id"!==c&&"name"!==c||(St(s,e),d="user-content-"+d),De&&L(/((--!?|])>)|<\/(style|title|textarea)/i,d)){St(s,e);continue}if("attributename"===c&&k(d,"href")){St(s,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){St(s,e);continue}if(!Pe&&L(/\/>/i,d)){St(s,e);continue}Me&&b([fe,me,ye],(e=>{d=E(d,e," ")}));const h=gt(e.nodeName);if(Nt(h,c,d)){if(X&&"object"==typeof y&&"function"==typeof y.getAttributeType)if(l);else switch(y.getAttributeType(h,c)){case"TrustedHTML":d=X.createHTML(d);break;case"TrustedScriptURL":d=X.createScriptURL(d)}if(d!==u)try{l?e.setAttributeNS(l,s,d):e.setAttribute(s,d),vt(e)?xt(e):x(n.removed)}catch(t){St(s,e)}}else St(s,e)}Et(pe.afterSanitizeAttributes,e,null)},Ot=function e(t){let n=null;const r=wt(t);for(Et(pe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Et(pe.uponSanitizeShadowNode,n,null),Tt(n),Lt(n),n.content instanceof s&&e(n.content);Et(pe.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,l=null,a=null;if(ot=!e,ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!kt(e)){if("function"!=typeof e.toString)throw O("toString is not a function");if("string"!=typeof(e=e.toString()))throw O("dirty is not a string, aborting")}if(!n.isSupported)return e;if(ze||yt(t),n.removed=[],"string"==typeof e&&(qe=!1),qe){if(e.nodeName){const t=gt(e.nodeName);if(!ve[t]||Ae[t])throw O("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)r=Ct("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===se&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!He&&!Me&&!Be&&-1===e.indexOf("<"))return X&&Ue?X.createHTML(e):e;if(r=Ct(e),!r)return He?null:Ue?Q:""}r&&$e&&xt(r.firstChild);const u=wt(qe?e:r);for(;l=u.nextNode();)Tt(l),Lt(l),l.content instanceof s&&Ot(l.content);if(qe)return e;if(He){if(Ke)for(a=ie.call(r.ownerDocument);r.firstChild;)a.appendChild(r.firstChild);else a=r;return(Ee.shadowroot||Ee.shadowrootmode)&&(a=ge.call(i,a,!0)),a}let d=Be?r.outerHTML:r.innerHTML;return Be&&ve["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&L(re,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),Me&&b([fe,me,ye],(e=>{d=E(d,e," ")})),X&&Ue?X.createHTML(d):d},n.setConfig=function(){yt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ze=!0},n.clearConfig=function(){pt=null,ze=!1},n.isValidAttribute=function(e,t,n){pt||yt({});const r=gt(e),i=gt(t);return Nt(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&S(pe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=_(pe[e],t);return-1===n?void 0:C(pe[e],n,1)[0]}return x(pe[e])},n.removeHooks=function(e){pe[e]=[]},n.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function ge(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function pe(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const fe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,me=fe&&"documentMode"in document?document.documentMode:null,ye=fe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),be=fe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_e=!(!fe||!("InputEvent"in window)||me)&&"getTargetRanges"in new window.InputEvent("input"),xe=fe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Se=fe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ce=fe&&/Android/.test(navigator.userAgent),we=fe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ve=fe&&Ce&&we,ke=fe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ye&&!we;function Ee(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const Te=0,Ne=1,Ae=2,Le=1,Oe=2,Fe=3,Re=4,Ie=5,Pe=6,Me=xe||Se||ke?" ":"​",De="\n\n",Be=be?" ":Me,ze="֑-߿יִ-﷽ﹰ-ﻼ",$e="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",He=new RegExp("^[^"+$e+"]*["+ze+"]"),Ke=new RegExp("^[^"+ze+"]*["+$e+"]"),Ue={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},We={directionless:1,unmergeable:2},Ve={center:2,end:6,justify:4,left:1,right:3,start:5},je={[Oe]:"center",[Pe]:"end",[Re]:"justify",[Le]:"left",[Fe]:"right",[Ie]:"start"},qe={normal:0,segmented:2,token:1},Ge={[Te]:"normal",[Ae]:"segmented",[Ne]:"token"},Je="$config";function Ze(e,t,n,r,i,o){let s=e.getFirstChild();for(;null!==s;){const e=s.__key;s.__parent===t&&(fo(s)&&Ze(s,e,n,r,i,o),n.has(e)||o.delete(e),i.push(e)),s=s.getNextSibling()}}let Ye=!1,Xe=0;function Qe(e){Xe=e.timeStamp}function et(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==ls(e,n)}function tt(e,t,n){const r=Zs(Ks(n));let i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);const s=e.nodeValue;null!==s&&xs(t,s,i,o,!1)}function nt(e,t,n){if(pi(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Jo(t)&&n.isAttached()}function rt(e,t,n,r){for(let i=e;i&&!ul(i);i=Ds(i)){const e=ls(i,t);if(void 0!==e){const t=os(e,n);if(t)return bo(t)||!Xs(i)?void 0:[i,t]}else if(i===r)return[r,hs(n)]}}function it(e,t,n){Ye=!0;const r=performance.now()-Xe>100;try{uo(e,(()=>{const i=Oi()||function(e){return e.getEditorState().read((()=>{const e=Oi();return null!==e?e.clone():null}))}(e),o=new Map,s=e.getRootElement(),l=e._editorState,a=e._blockCursorElement;let c=!1,u="";for(let n=0;n<t.length;n++){const d=t[n],h=d.type,g=d.target,p=rt(g,e,l,s);if(!p)continue;const[f,m]=p;if("characterData"===h)r&&ii(m)&&Jo(g)&&nt(i,g,m)&&tt(g,m,e);else if("childList"===h){c=!0;const t=d.addedNodes;for(let n=0;n<t.length;n++){const r=t[n],i=ss(r),o=r.parentNode;if(null!=o&&r!==a&&null===i&&!et(r,o,e)){if(be){const e=(Xs(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}o.removeChild(r)}}const n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){const r=n[i];(et(r,g,e)||a===r)&&(g.appendChild(r),t++)}r!==t&&o.set(f,m)}}}if(o.size>0)for(const[t,n]of o)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){const n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){const n=r[t],o=n.parentNode;null==o||"BR"!==n.nodeName||et(n,i,e)||o.removeChild(n)}}n.takeRecords()}null!==i&&(c&&gs(i),be&&Rs(e)&&i.insertRawText(u))}))}finally{Ye=!1}}function ot(e){const t=e._observer;null!==t&&it(e,t.takeRecords(),t)}function st(e){!function(e){0===Xe&&Ks(e).addEventListener("textInput",Qe,!0)}(e),e._observer=new MutationObserver(((t,n)=>{it(e,t,n)}))}let lt=class{key;parse;unparse;isEqual;defaultValue;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||mt).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0)}};function at(e,t){return new lt(e,t)}function ct(e,t,n="latest"){const r=("latest"===n?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function ut(e,t,n){let r;if(Ji(),"function"==typeof n){const i=e.getLatest(),o=ct(i,t);if(r=n(o),t.isEqual(o,r))return i}else r=n;const i=e.getWritable();return gt(i).updateFromKnown(t,r),i}function dt(e){const t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:e}=hl(r);if(e&&e.stateConfigs)for(const r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}let ht=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(const i in t){const t=e.get(i);t&&n.has(t)||r++}return r}(o,n,r);this.size=s}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return ft(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;const{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=e.get(i);n?t.has(n)||t.set(n,n.parse(o)):(r=r||{},r[i]=o)}return r}(n.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){const n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=ft(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){const n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function gt(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new ht(t,pt(t));return t.__state=n,n}function pt(e){return e.__state?e.__state.sharedNodeState:Do(il(),e.getType()).sharedNodeState}function ft(e){if(e)for(const t in e)return e}function mt(e){return e}function yt(e,t,n){for(const[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);const t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function bt(e,t,n){const{unknownState:r}=t,i=n?n.unknownState:void 0;if(r)for(const[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0;return!1}function _t(e,t){const n=e.__state;return n&&n.node===e?n.getWritable(t):n}function xt(e,t){const n=e.__mode,r=e.__format,i=e.__style,o=t.__mode,s=t.__format,l=t.__style,a=e.__state,c=t.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===e.__state||a===c||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;const n=new Set;return!(e&&yt(n,e,t)||t&&yt(n,t,e)||e&&bt(n,e,t)||t&&bt(n,t,e))}(a,c))}function St(e,t){const n=e.mergeWithSibling(t),r=Xi()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Ct(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&ii(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(xt(t,r)){r=St(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&ii(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(xt(r,n)){r=St(r,n);break}break}n.remove()}}else r.remove()}function wt(e){return vt(e.anchor),vt(e.focus),e}function vt(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),ii(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!fo(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let kt,Et,Tt,Nt,At,Lt,Ot,Ft,Rt,It,Pt="",Mt=null,Dt="",Bt="",zt=!1,$t=!1;function Ht(e,t){const n=Ot.get(e);if(null!==t){const n=rn(e);n.parentNode===t&&t.removeChild(n)}if(Ft.has(e)||Et._keyToDOMMap.delete(e),fo(n)){const e=Qt(n,Ot);Kt(e,0,e.length-1,null)}void 0!==n&&Ls(It,Tt,Nt,n,"destroyed")}function Kt(e,t,n,r){let i=t;for(;i<=n;++i){const t=e[i];void 0!==t&&Ht(t,r)}}function Ut(e,t){e.setProperty("text-align",t)}const Wt="40px";function Vt(e,t){const n=kt.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||Wt;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function jt(e,t){const n=e.style;0===t?Ut(n,""):1===t?Ut(n,"left"):2===t?Ut(n,"center"):3===t?Ut(n,"right"):4===t?Ut(n,"justify"):5===t?Ut(n,"start"):6===t&&Ut(n,"end")}function qt(e,t){const n=function(e){const t=e.__dir;if(null!==t)return t;if(xo(e))return null;const n=e.getParentOrThrow();return xo(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function Gt(e,t){const n=Ft.get(e);void 0===n&&ge(60);const r=n.createDOM(kt,Et);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,Et),ii(n)?r.setAttribute("data-lexical-text","true"):bo(n)&&r.setAttribute("data-lexical-decorator","true"),fo(n)){const e=n.__indent,t=n.__size;if(qt(r,n),0!==e&&Vt(r,e),0!==t){const e=t-1;Jt(Qt(n,Ft),n,0,e,n.getDOMSlot(r))}const i=n.__format;0!==i&&jt(r,i),n.isInline()||Yt(null,n,r),Ps(n)&&(Pt+=De,Bt+=De)}else{const t=n.getTextContent();if(bo(n)){const t=n.decorate(Et,kt);null!==t&&tn(e,t),r.contentEditable="false"}Pt+=t,Bt+=t}return null!==t&&t.insertChild(r),Ls(It,Tt,Nt,n,"created"),r}function Jt(e,t,n,r,i){const o=Pt;Pt="";let s=n;for(;s<=r;++s){Gt(e[s],i);const t=Ft.get(e[s]);null!==t&&ii(t)&&(null===Mt&&(Mt=t.getFormat()),""===Dt&&(Dt=t.getStyle()))}Ps(t)&&(Pt+=De),i.element.__lexicalTextContent=Pt,Pt=o+Pt}function Zt(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return $r(e)?"line-break":bo(e)&&e.isInline()?"decorator":null}return"empty"}return null}function Yt(e,t,n){const r=Zt(e,Ot),i=Zt(t,Ft);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function Xt(e,t,n){var r;Mt=null,Dt="",function(e,t,n){const r=Pt,i=e.__size,o=t.__size;Pt="";const s=n.element;if(1===i&&1===o){const n=e.__first,i=t.__first;if(n===i)en(n,s);else{const e=rn(n),t=Gt(i,null);try{s.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const o=`${r.toString()} Parent: ${s.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(o)}throw r}Ht(n,null)}const o=Ft.get(i);ii(o)&&(null===Mt&&(Mt=o.getFormat()),""===Dt&&(Dt=o.getStyle()))}else{const r=Qt(e,Ot),l=Qt(t,Ft);if(r.length!==i&&ge(227),l.length!==o&&ge(228),0===i)0!==o&&Jt(l,t,0,o-1,n);else if(0===o){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;Kt(r,0,i-1,e?null:s),e&&(s.textContent="")}}else!function(e,t,n,r,i,o){const s=r-1,l=i-1;let a,c,u=o.getFirstChild(),d=0,h=0;for(;d<=s&&h<=l;){const e=t[d],r=n[h];if(e===r)u=nn(en(r,o.element)),d++,h++;else{void 0===a&&(a=new Set(t)),void 0===c&&(c=new Set(n));const i=c.has(e),s=a.has(r);if(i)if(s){const e=Ms(Et,r);e===u?u=nn(en(r,o.element)):(o.withBefore(u).insertChild(e),en(r,o.element)),d++,h++}else Gt(r,o.withBefore(u)),h++;else u=nn(rn(e)),Ht(e,o.element),d++}const i=Ft.get(r);null!==i&&ii(i)&&(null===Mt&&(Mt=i.getFormat()),""===Dt&&(Dt=i.getStyle()))}const g=d>s,p=h>l;if(g&&!p){const t=n[l+1],r=void 0===t?null:Et.getElementByKey(t);Jt(n,e,h,l,o.withBefore(r))}else p&&!g&&Kt(t,d,s,o.element)}(t,r,l,i,o,n)}Ps(t)&&(Pt+=De),s.__lexicalTextContent=Pt,Pt=r+Pt}(e,t,t.getDOMSlot(n)),r=t,null==Mt||Mt===r.__textFormat||$t||r.setTextFormat(Mt),function(e){""===Dt||Dt===e.__textStyle||$t||e.setTextStyle(Dt)}(t)}function Qt(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&ge(101),n.push(r),r=e.__next}return n}function en(e,t){const n=Ot.get(e);let r=Ft.get(e);void 0!==n&&void 0!==r||ge(61);const i=zt||Lt.has(e)||At.has(e),o=Ms(Et,e);if(n===r&&!i){if(fo(n)){const e=o.__lexicalTextContent;void 0!==e&&(Pt+=e,Bt+=e)}else{const e=n.getTextContent();Bt+=e,Pt+=e}return o}if(n!==r&&i&&Ls(It,Tt,Nt,r,"updated"),r.updateDOM(n,o,kt)){const n=Gt(e,null);return null===t&&ge(62),t.replaceChild(n,o),Ht(e,null),n}if(fo(n)&&fo(r)){const e=r.__indent;(zt||e!==n.__indent)&&Vt(o,e);const t=r.__format;if((zt||t!==n.__format)&&jt(o,t),i&&(Xt(n,r,o),xo(r)||r.isInline()||Yt(n,r,o)),Ps(r)&&(Pt+=De,Bt+=De),(zt||r.__dir!==n.__dir)&&(qt(o,r),xo(r)&&!zt))for(const e of r.getChildren())fo(e)&&qt(Ms(Et,e.getKey()),e)}else{const t=r.getTextContent();if(bo(r)){const t=r.decorate(Et,kt);null!==t&&tn(e,t)}Pt+=t,Bt+=t}if(!$t&&xo(r)&&r.__cachedText!==Bt){const e=r.getWritable();e.__cachedText=Bt,r=e}return o}function tn(e,t){let n=Et._pendingDecorators;const r=Et._decorators;if(null===n){if(r[e]===t)return;n=cs(Et)}n[e]=t}function nn(e){let t=e.nextSibling;return null!==t&&t===Et._blockCursorElement&&(t=t.nextSibling),t}function rn(e){const t=Rt.get(e);return void 0===t&&ge(75,e),t}function on(e){return{type:e}}const sn=on("SELECTION_CHANGE_COMMAND"),ln=on("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),an=on("CLICK_COMMAND"),cn=on("DELETE_CHARACTER_COMMAND"),un=on("INSERT_LINE_BREAK_COMMAND"),dn=on("INSERT_PARAGRAPH_COMMAND"),hn=on("CONTROLLED_TEXT_INSERTION_COMMAND"),gn=on("PASTE_COMMAND"),pn=on("REMOVE_TEXT_COMMAND"),fn=on("DELETE_WORD_COMMAND"),mn=on("DELETE_LINE_COMMAND"),yn=on("FORMAT_TEXT_COMMAND"),bn=on("UNDO_COMMAND"),_n=on("REDO_COMMAND"),xn=on("KEYDOWN_COMMAND"),Sn=on("KEY_ARROW_RIGHT_COMMAND"),Cn=on("MOVE_TO_END"),wn=on("KEY_ARROW_LEFT_COMMAND"),vn=on("MOVE_TO_START"),kn=on("KEY_ARROW_UP_COMMAND"),En=on("KEY_ARROW_DOWN_COMMAND"),Tn=on("KEY_ENTER_COMMAND"),Nn=on("KEY_SPACE_COMMAND"),An=on("KEY_BACKSPACE_COMMAND"),Ln=on("KEY_ESCAPE_COMMAND"),On=on("KEY_DELETE_COMMAND"),Fn=on("KEY_TAB_COMMAND"),Rn=on("INSERT_TAB_COMMAND"),In=on("INDENT_CONTENT_COMMAND"),Pn=on("OUTDENT_CONTENT_COMMAND"),Mn=on("DROP_COMMAND"),Dn=on("FORMAT_ELEMENT_COMMAND"),Bn=on("DRAGSTART_COMMAND"),zn=on("DRAGOVER_COMMAND"),$n=on("DRAGEND_COMMAND"),Hn=on("COPY_COMMAND"),Kn=on("CUT_COMMAND"),Un=on("SELECT_ALL_COMMAND"),Wn=on("CLEAR_EDITOR_COMMAND"),Vn=on("CLEAR_HISTORY_COMMAND"),jn=on("CAN_REDO_COMMAND"),qn=on("CAN_UNDO_COMMAND"),Gn=on("FOCUS_COMMAND"),Jn=on("BLUR_COMMAND"),Zn=on("KEY_MODIFIER_COMMAND"),Yn=Object.freeze({}),Xn=[["keydown",function(e,t){if(!(Qn=e.timeStamp,er=e.key,t.isComposing()||Is(t,xn,e)||null==e.key)){if(cr&&Es(e))return uo(t,(()=>{_r(t,ur)})),cr=!1,void(ur="");if(function(e){return ws(e,"ArrowRight",{shiftKey:"any"})}(e))Is(t,Sn,e);else if(function(e){return ws(e,"ArrowRight",vs)}(e))Is(t,Cn,e);else if(function(e){return ws(e,"ArrowLeft",{shiftKey:"any"})}(e))Is(t,wn,e);else if(function(e){return ws(e,"ArrowLeft",vs)}(e))Is(t,vn,e);else if(function(e){return ws(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))Is(t,kn,e);else if(function(e){return ws(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))Is(t,En,e);else if(function(e){return ws(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))lr=!0,Is(t,Tn,e);else if(function(e){return" "===e.key}(e))Is(t,Nn,e);else if(function(e){return ye&&ws(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),lr=!0,Is(t,un,!0);else if(function(e){return ws(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))lr=!1,Is(t,Tn,e);else if(function(e){return ws(e,"Backspace",{shiftKey:"any"})||ye&&ws(e,"h",{ctrlKey:!0})}(e))Es(e)?Is(t,An,e):(e.preventDefault(),Is(t,cn,!0));else if(function(e){return"Escape"===e.key}(e))Is(t,Ln,e);else if(function(e){return ws(e,"Delete",{})||ye&&ws(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),Is(t,cn,!1)):Is(t,On,e);else if(function(e){return ws(e,"Backspace",ks)}(e))e.preventDefault(),Is(t,fn,!0);else if(function(e){return ws(e,"Delete",ks)}(e))e.preventDefault(),Is(t,fn,!1);else if(function(e){return ye&&ws(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),Is(t,mn,!0);else if(function(e){return ye&&(ws(e,"Delete",{metaKey:!0})||ws(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),Is(t,mn,!1);else if(function(e){return ws(e,"b",vs)}(e))e.preventDefault(),Is(t,yn,"bold");else if(function(e){return ws(e,"u",vs)}(e))e.preventDefault(),Is(t,yn,"underline");else if(function(e){return ws(e,"i",vs)}(e))e.preventDefault(),Is(t,yn,"italic");else if(function(e){return ws(e,"Tab",{shiftKey:"any"})}(e))Is(t,Fn,e);else if(function(e){return ws(e,"z",vs)}(e))e.preventDefault(),Is(t,bn,void 0);else if(function(e){return ye?ws(e,"z",{metaKey:!0,shiftKey:!0}):ws(e,"y",{ctrlKey:!0})||ws(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),Is(t,_n,void 0);else{const n=t._editorState._selection;null===n||pi(n)?Ts(e)&&(e.preventDefault(),Is(t,Un,e)):function(e){return ws(e,"c",vs)}(e)?(e.preventDefault(),Is(t,Hn,e)):function(e){return ws(e,"x",vs)}(e)?(e.preventDefault(),Is(t,Kn,e)):Ts(e)&&(e.preventDefault(),Is(t,Un,e))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(e)&&Is(t,Zn,e)}}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;Qs(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&uo(t,(()=>{$o(n)||(sr=!0)}))}],["compositionstart",function(e,t){uo(t,(()=>{const n=Oi();if(pi(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();rs(r.key),(e.timeStamp<Qn+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||ii(i)&&i.getStyle()!==n.style)&&Is(t,hn,Be)}}))}],["compositionend",function(e,t){be?ar=!0:Se||!xe&&!ke?uo(t,(()=>{_r(t,e.data)})):(cr=!0,ur=e.data)}],["input",function(e,t){e.stopPropagation(),uo(t,(()=>{if(Xs(e.target)&&$o(e.target))return;const n=Oi(),r=e.data,i=br(e);if(null!=r&&pi(n)&&gr(n,i,r,e.timeStamp,!1)){ar&&(_r(t,r),ar=!1);const i=n.anchor.getNode(),o=Zs(Ks(t));if(null===o)return;const s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,a=s?n.focus.offset:n.anchor.offset;_e&&!n.isCollapsed()&&ii(i)&&null!==o.anchorNode&&i.getTextContent().slice(0,l)+r+i.getTextContent().slice(l+a)===bs(o.anchorNode)||Is(t,hn,r);const c=r.length;be&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),xe||Se||ke||!t.isComposing()||(Qn=0,rs(null))}else _s(!1,t,null!==r?r:void 0),ar&&(_r(t,r||void 0),ar=!1);!function(){Ji();ot(Xi())}()}),{event:e}),nr=null}],["click",function(e,t){uo(t,(()=>{const n=Oi(),r=Zs(Ks(t)),i=Fi();if(r)if(pi(n)){const t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!xo(o)&&1===ds().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&o!==n.focus.getNode()){const e=gl(o,(e=>fo(e)&&!e.isInline()));fo(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(Xs(n)||Jo(n))&&gs(Li(i,r,t,e))}Is(t,an,e)}))}],["cut",Yn],["copy",Yn],["dragstart",Yn],["dragover",Yn],["dragend",Yn],["paste",Yn],["focus",Yn],["blur",Yn],["drop",Yn]];_e&&Xn.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType,r=br(e);"deleteCompositionText"===n||be&&Rs(t)||"insertCompositionText"!==n&&uo(t,(()=>{const i=Oi();if("deleteContentBackward"===n){if(null===i){const e=Fi();if(!pi(e))return;gs(e.clone())}if(pi(i)){const n=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===er&&o<Qn+30&&t.isComposing()&&n){if(rs(null),Qn=0,setTimeout((()=>{uo(t,(()=>{rs(null)}))}),30),pi(i)){const e=i.anchor.getNode();e.markDirty(),ii(e)||ge(142),yr(i,e)}}else{rs(null),e.preventDefault();const r=i.anchor.getNode(),o=r.getTextContent(),s=r.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===o.length;let a=ve&&n&&!l&&s;if(a&&i.isCollapsed()&&(a=!bo(Fs(i.anchor,!0))),!a){Is(t,cn,!0);const e=Oi();ve&&pi(e)&&e.isCollapsed()&&(dr=e,setTimeout((()=>dr=null)))}}return}}var o;if(!pi(i))return;const s=e.data;null!==nr&&_s(!1,t,nr),i.dirty&&null===nr||!i.isCollapsed()||xo(i.anchor.getNode())||null===r||i.applyDOMRange(r),nr=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if("insertText"!==n&&"insertTranspose"!==n)switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Is(t,hn,e);break;case"insertFromComposition":rs(null),Is(t,hn,e);break;case"insertLineBreak":rs(null),Is(t,un,!1);break;case"insertParagraph":rs(null),lr&&!Se?(lr=!1,Is(t,un,!1)):Is(t,dn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Is(t,gn,e);break;case"deleteByComposition":(function(e,t){return e!==t||fo(e)||fo(t)||!qo(e)||!qo(t)})(c,u)&&Is(t,pn,e);break;case"deleteByDrag":case"deleteByCut":Is(t,pn,e);break;case"deleteContent":Is(t,cn,!1);break;case"deleteWordBackward":Is(t,fn,!0);break;case"deleteWordForward":Is(t,fn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Is(t,mn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Is(t,mn,!1);break;case"formatStrikeThrough":Is(t,yn,"strikethrough");break;case"formatBold":Is(t,yn,"bold");break;case"formatItalic":Is(t,yn,"italic");break;case"formatUnderline":Is(t,yn,"underline");break;case"historyUndo":Is(t,bn,void 0);break;case"historyRedo":Is(t,_n,void 0)}else{if("\n"===s)e.preventDefault(),Is(t,un,!1);else if(s===De)e.preventDefault(),Is(t,dn,void 0);else if(null==s&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=s&&gr(i,r,s,e.timeStamp,!0)?(e.preventDefault(),Is(t,hn,s)):nr=s;tr=e.timeStamp}}))}(e,t)]);let Qn=0,er=null,tr=0,nr=null;const rr=new WeakMap,ir=new WeakMap;let or=!1,sr=!1,lr=!1,ar=!1,cr=!1,ur="",dr=null,hr=[0,"",0,"root",0];function gr(e,t,n,r,i){const o=e.anchor,s=e.focus,l=o.getNode(),a=Xi(),c=Zs(Ks(a)),u=null!==c?c.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==s.key||!ii(l)||(!i&&(!_e||tr<r+50)||l.isDirty()&&g<2||fs(n))&&o.offset!==s.offset&&!l.isComposing()||Go(l)||l.isDirty()&&g>1||(i||!_e)&&null!==h&&!l.isComposing()&&u!==Yo(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||l.getFormat()!==e.format||l.getStyle()!==e.style||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=qo(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(ii(t)||fo(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,l)}function pr(e,t){return Jo(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function fr(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=e;or&&(or=!1,pr(r,i)&&pr(o,s)&&!dr)||uo(t,(()=>{if(!n)return void gs(null);if(!Ko(t,r,o))return;let l=Oi();if(dr&&pi(l)&&l.isCollapsed()){const e=l.anchor,t=dr.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(l=dr.clone(),gs(l))}if(dr=null,pi(l)){const n=l.anchor,r=n.getNode();if(l.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(l.dirty=!0);const i=Ks(t).event,o=i?i.timeStamp:performance.now(),[s,a,c,u,d]=hr,h=ds(),g=!1===t.isComposing()&&""===h.getTextContent();if(o<d+200&&n.offset===c&&n.key===u)mr(l,s,a);else if("text"===n.type)ii(r)||ge(141),yr(l,r);else if("element"===n.type&&!g){fo(r)||ge(259);const e=n.getNode();e.isEmpty()?function(e,t){mr(e,t.getTextFormat(),t.getTextStyle())}(l,e):mr(l,0,"")}}else{const e=n.key,t=l.focus.key,r=l.getNodes(),o=r.length,a=l.isBackward(),c=a?s:i,u=a?i:s,d=a?t:e,h=a?e:t;let g=2047,p=!1;for(let e=0;e<o;e++){const t=r[e],n=t.getTextContentSize();if(ii(t)&&0!==n&&!(0===e&&t.__key===d&&c===n||e===o-1&&t.__key===h&&0===u)&&(p=!0,g&=t.getFormat(),0===g))break}l.format=p?g:0}}Is(t,sn,void 0)}))}function mr(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function yr(e,t){mr(e,t.getFormat(),t.getStyle())}function br(e){if(!e.getTargetRanges)return null;const t=e.getTargetRanges();return 0===t.length?null:t[0]}function _r(e,t){const n=e._compositionKey;if(rs(null),null!==n&&null!=t){if(""===t){const t=os(n),r=Yo(e.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&ii(t)&&xs(t,r.nodeValue,null,null,!0))}if("\n"===t[t.length-1]){const t=Oi();if(pi(t)){const n=t.focus;return t.anchor.set(n.key,n.offset,n.type),void Is(e,Tn,null)}}}_s(!0,e,t)}function xr(e){let t=e.__lexicalEventHandles;return void 0===t&&(t=[],e.__lexicalEventHandles=t),t}const Sr=new Map;function Cr(e){const t=function(e){const t=Hs(e);return t?t.getSelection():null}(e.target);if(null===t)return;const n=Wo(t.anchorNode);if(null===n)return;sr&&(sr=!1,uo(n,(()=>{const r=Fi(),i=t.anchorNode;(Xs(i)||Jo(i))&&gs(Li(r,t,n,e))})));const r=ms(n),i=r[r.length-1],o=i._key,s=Sr.get(o),l=s||i;l!==n&&fr(t,l,!1),fr(t,n,!0),n!==i?Sr.set(o,n):s&&Sr.delete(o)}function wr(e){e._lexicalHandled=!0}function vr(e){return!0===e._lexicalHandled}function kr(e){const t=rr.get(e);if(void 0===t)return;const n=ir.get(t);if(void 0===n)return;const r=n-1;r>=0||ge(164),rr.delete(e),ir.set(t,r),0===r&&t.removeEventListener("selectionchange",Cr);const i=Vo(e);Uo(i)?(function(e){if(null!==e._parentEditor){const t=ms(e),n=t[t.length-1]._key;Sr.get(n)===e&&Sr.delete(n)}else Sr.delete(e._key)}(i),e.__lexicalEditor=null):i&&ge(198);const o=xr(e);for(let e=0;e<o.length;e++)o[e]();e.__lexicalEventHandles=[]}function Er(e,t,n){Ji();const r=e.__key,i=e.getParent();if(null===i)return;const o=function(e){const t=Oi();if(!pi(t)||!fo(e))return t;const{anchor:n,focus:r}=t,i=n.getNode(),o=r.getNode();return $s(i,e)&&n.set(e.__key,0,"element"),$s(o,e)&&r.set(e.__key,0,"element"),t}(e);let s=!1;if(pi(o)&&t){const t=o.anchor,n=o.focus;t.key===r&&(Pi(t,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0),n.key===r&&(Pi(n,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else mi(o)&&t&&e.isSelected()&&e.selectPrevious();if(pi(o)&&t&&!s){const t=e.getIndexWithinParent();ts(e),Ri(o,i,t,-1)}else ts(e);n||Ws(i)||i.canBeEmpty()||!i.isEmpty()||Er(i,t),t&&o&&xo(i)&&i.isEmpty()&&i.selectEnd()}const Tr=Symbol.for("ephemeral");function Nr(e){return e[Tr]||!1}class Ar{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=hl(this);return void 0===e&&ge(64,this.name),e}static clone(e){ge(65,this.name)}$config(){return{}}config(e,t){const n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),es(this,e)}getType(){return this.__type}isInline(){ge(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;const t=os(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){const t=e||Oi();if(null==t)return!1;const n=t.getNodes().some((e=>e.__key===this.__key));if(ii(this))return n;if(pi(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(bo(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:os(e)}getParentOrThrow(){const e=this.getParent();return null===e&&ge(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(Ws(t))return fo(e)||e===this&&bo(e)||ge(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&ge(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:os(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:os(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=fo(this)?this:this.getParent(),n=fo(e)?e:e.getParent(),r=t&&n?Wl(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=Wl(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Hl(t):("same"!==t.type&&"ancestor"!==t.type&&ge(279),!1)))}isParentOf(e){const t=Wl(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const o=i.__key;if(r.has(o)||(r.add(o),n.push(i)),i===e)break;const s=fo(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==s){i=s;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(null!==l){i=l;continue}const a=i.getParentOrThrow();if(r.has(a.__key)||n.push(a),a===e)break;let c=null,u=a;do{if(null===u&&ge(68),c=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==c||r.has(u.__key)||n.push(u)}while(null===c);i=c}return t||n.reverse(),n}isDirty(){const e=Xi()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(Nr(this))return this;const e=os(this.__key);return null===e&&ge(113),e}getWritable(){if(Nr(this))return this;Ji();const e=Yi(),t=Xi(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=Oi();if(null!==s&&s.setCachedNodes(null),o.has(r))return ns(i),i;const l=al(i);return o.add(r),ns(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){ge(70)}updateDOM(e,t,n){ge(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){ge(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable(),r=t.$;let i=r;for(const e of pt(n).flatKeys)e in t&&(void 0!==i&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&gt(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){Er(this,!0,e)}replace(e,t){Ji();let n=Oi();null!==n&&(n=n.clone()),qs(this,e);const r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),l=this.getParentOrThrow().getWritable(),a=l.__size;ts(s);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(Er(r,!1,!0),null===c?l.__first=o:c.getWritable().__next=o,s.__prev=d,null===u?l.__last=o:u.getWritable().__prev=o,s.__next=h,s.__parent=g,l.__size=a,t&&(fo(this)&&fo(s)||ge(139),this.getChildren().forEach((e=>{s.append(e)}))),pi(n)){gs(n);const e=n.anchor,t=n.focus;e.key===i&&hi(e,s),t.key===i&&hi(t,s)}return is()===i&&rs(o),s}insertAfter(e,t=!0){Ji(),qs(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),o=Oi();let s=!1,l=!1;if(null!==i){const t=e.getIndexWithinParent();if(ts(r),pi(o)){const e=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,l="element"===r.type&&r.key===e&&r.offset===t+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===a?c.__last=u:a.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&pi(o)){const e=this.getIndexWithinParent();Ri(o,c,e+1);const t=c.__key;s&&o.anchor.set(t,e+2,"element"),l&&o.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){Ji(),qs(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;ts(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,a=this.getIndexWithinParent();null===o?s.__first=i:o.getWritable().__next=i,s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const c=Oi();return t&&pi(c)&&Ri(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return No()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Ji();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(fo(n))return n.select();if(!ii(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){Ji();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(fo(n))return n.select(0,0);if(!ii(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}const Lr="historic",Or="history-merge",Fr="paste",Rr="collaboration",Ir="skip-scroll-into-view",Pr="skip-dom-selection",Mr="skip-selection-focus";class Dr extends Ar{static getType(){return"linebreak"}static clone(e){return new Dr(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&nl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Hr(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&Hr(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&nl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Hr(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&Hr(r))return!0}return!1}(e)?null:{conversion:Br,priority:0}}}static importJSON(e){return zr().updateFromJSON(e)}}function Br(e){return{node:zr()}}function zr(){return js(new Dr)}function $r(e){return e instanceof Dr}function Hr(e){return Jo(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Kr(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function Ur(e,t){return 1&t?"strong":2&t?"em":"span"}function Wr(e,t,n,r,i){const o=r.classList;let s=As(i,"base");void 0!==s&&o.add(...s),s=As(i,"underlineStrikethrough");let l=!1;const a=8&t&&4&t;void 0!==s&&(8&n&&4&n?(l=!0,a||o.add(...s)):a&&o.remove(...s));for(const e in Ue){const r=Ue[e];if(s=As(i,e),void 0!==s)if(n&r){if(l&&("underline"===e||"strikethrough"===e)){t&r&&o.remove(...s);continue}(0===(t&r)||a&&"underline"===e||"strikethrough"===e)&&o.add(...s)}else t&r&&o.remove(...s)}}function Vr(e,t,n){const r=t.firstChild,i=n.isComposing(),o=e+(i?Me:"");if(null==r)t.textContent=o;else{const e=r.nodeValue;if(e!==o)if(i||be){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,o=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;o+i<n&&o+i<r&&e[n-o-1]===t[r-o-1];)o++;return[i,n-i-o,t.slice(i,r-o)]}(e,o);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=o}}function jr(e,t,n,r,i,o){Vr(i,e,t);const s=o.theme.text;void 0!==s&&Wr(0,0,r,e,s)}function qr(e,t){const n=document.createElement(t);return n.appendChild(e),n}class Gr extends Ar{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(e){return new Gr(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Ge[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===is()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Ue[e];return 0!==(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Xo(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){const n=this.__format,r=Kr(0,n),i=Ur(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l)),jr(l,this,0,n,this.__text,e);const a=this.__style;return""!==a&&(s.style.cssText=a),s}updateDOM(e,t,n){const r=this.__text,i=e.__format,o=this.__format,s=Kr(0,i),l=Kr(0,o),a=Ur(0,i),c=Ur(0,o);if((null===s?a:s)!==(null===l?c:l))return!0;if(s===l&&a!==c){const e=t.firstChild;null==e&&ge(48);const i=document.createElement(c);return jr(i,this,0,o,r,n),t.replaceChild(i,e),!1}let u=t;null!==l&&null!==s&&(u=t.firstChild,null==u&&ge(49)),Vr(r,u,this);const d=n.theme.text;void 0!==d&&i!==o&&Wr(0,i,o,u,d);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Qr,priority:0}),b:()=>({conversion:Zr,priority:0}),code:()=>({conversion:ni,priority:0}),em:()=>({conversion:ni,priority:0}),i:()=>({conversion:ni,priority:0}),mark:()=>({conversion:ni,priority:0}),s:()=>({conversion:ni,priority:0}),span:()=>({conversion:Jr,priority:0}),strong:()=>({conversion:ni,priority:0}),sub:()=>({conversion:ni,priority:0}),sup:()=>({conversion:ni,priority:0}),u:()=>({conversion:ni,priority:0})}}static importJSON(e){return ri().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Xs(t)||ge(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=qr(t,"b")),this.hasFormat("italic")&&(t=qr(t,"i")),this.hasFormat("strikethrough")&&(t=qr(t,"s")),this.hasFormat("underline")&&(t=qr(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?Ue[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?We[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Xo(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=qe[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){Ji();let n=e,r=t;const i=Oi(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const e=o.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!pi(i))return Ti(s,n,s,r,"text","text");{const e=is();e!==i.anchor.key&&e!==i.focus.key||rs(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=e;l<0&&(l=s+l,l<0&&(l=0));const a=Oi();if(r&&pi(a)){const t=e+s;a.setTextNodeRange(i,t,i,t)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Ji();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=is(),o=n.length;e.sort(((e,t)=>e-t)),e.push(o);const s=[],l=e.length;for(let t=0,r=0;t<o&&r<=l;r++){const i=e[r];i>t&&(s.push(n.slice(t,i)),t=i)}const a=s.length;if(1===a)return[t];const c=s[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const b=Oi();if(pi(b)){const[e,t]=b.isBackward()?[b.focus,b.anchor]:[b.anchor,b.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=ri(c),d.__format=h,d.__style=g,d.__detail=p,d.__state=_t(t,d),f=!0):d=t.setTextContent(c);const _=[d];for(let e=1;e<a;e++){const n=ri(s[e]);n.__format=h,n.__style=g,n.__detail=p,n.__state=_t(t,n);const o=n.__key;i===r&&rs(o),_.push(n)}const x=m?m.offset:null,S=y?y.offset:null;let C=0;for(const e of _){if(!m&&!y)break;const t=C+e.getTextContentSize();if(null!==m&&null!==x&&x<=t&&x>=C&&(m.set(e.getKey(),x-C,"text"),x<t&&(m=null)),null!==y&&null!==S&&S<=t&&S>=C){y.set(e.getKey(),S-C,"text");break}C=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&ns(t),null!==n&&ns(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,_),this.remove()):e.splice(t,1,_),pi(b)&&Ri(b,u,t,a-1)}return _}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||ge(50);const n=this.__key,r=e.__key,i=this.__text,o=i.length;is()===r&&rs(n);const s=Oi();if(pi(s)){const i=s.anchor,l=s.focus;null!==i&&i.key===r&&Mi(i,t,n,e,o),null!==l&&l.key===r&&Mi(l,t,n,e,o)}const l=e.__text,a=t?l+i:i+l;this.setTextContent(a);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function Jr(e){return{forChild:oi(e.style),node:null}}function Zr(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:oi(t.style,n?void 0:"bold"),node:null}}const Yr=new WeakMap;function Xr(e){if(!Xs(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function Qr(e){const t=e;null===e.parentElement&&ge(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=Yr.get(n))&&!Xr(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e<r.length;e++)Yr.set(r[e],i);return i}(t)){const e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n];"\n"===r||"\r\n"===r?t.push(zr()):"\t"===r?t.push(li()):""!==r&&t.push(ri(r))}return{node:t}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===n)return{node:null};if(" "===n[0]){let e=t,r=!0;for(;null!==e&&null!==(e=ei(e,!1));){const t=e.textContent||"";if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=ei(e,!0));)if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:ri(n)}}function ei(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,Xs(n)){const e=n.style.display;if(""===e&&!tl(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(Jo(n))return n;if("BR"===n.nodeName)return null}}const ti={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function ni(e){const t=ti[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:oi(e.style,t),node:null}}function ri(e=""){return js(new Gr(e))}function ii(e){return e instanceof Gr}function oi(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===e.fontStyle,l=r.includes("underline"),a=e.verticalAlign;return e=>ii(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),o&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==a||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==a||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class si extends Gr{static getType(){return"tab"}static clone(e){return new si(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=As(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return li().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&pe(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||ge(286),this}setDetail(e){return 2!==e&&ge(127),this}setMode(e){return"normal"!==e&&ge(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function li(){return js(new si)}function ai(e){return e instanceof si}class ci{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:$l(ea(Vl(this,"next")),ea(Vl(e,"next")))<0}getNode(){const e=os(this.key);return null===e&&ge(20),e}set(e,t,n,r){const i=this._selection,o=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,Gi()||(is()===o&&rs(e),null!==i&&(i.setCachedNodes(null),i.dirty=!0)))}}function ui(e,t,n){return new ci(e,t,n)}function di(e,t){let n=t.__key,r=e.offset,i="element";if(ii(t)){i="text";const e=t.getTextContentSize();r>e&&(r=e)}else if(!fo(t)){const e=t.getNextSibling();if(ii(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function hi(e,t){if(fo(t)){const n=t.getLastDescendant();fo(n)||ii(n)?di(e,n):di(e,t)}else di(e,t)}class gi{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!mi(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new gi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(ii(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this._nodes,n=[];for(const e of t){const t=os(e);null!==t&&n.push(t)}return Gi()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){const e=this.getNodes();if((Oi()||Fi())===this&&e[0]){const t=Nl(e[0],"next");ql(Bl(t,t))}for(const t of e)t.remove()}}function pi(e){return e instanceof fi}class fi{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!pi(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=function(e){const t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);const i=new Set,o=new Set;for(const n of e)if(vl(n)){const{origin:e}=n;0===t.length?i.add(e):(o.add(e),t.push(e))}else{const{origin:e}=n;fo(e)&&o.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),wl(e.focus)&&fo(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=Fl(e.focus.origin,"previous");vl(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Rl(n))i.delete(n.origin),t.pop();for(;t.length>1;){const e=t[t.length-1];if(!fo(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=ea(e.anchor),r=ea(e.anchor.getFlipped()),i=e=>Cl(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(ra(Jl(this),"next"));return Gi()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=bi(this);let a="",c=!0;for(let u=0;u<e.length;u++){const d=e[u];if(fo(d)&&!d.isInline())c||(a+="\n"),c=!d.isEmpty();else if(c=!1,ii(d)){let e=d.getTextContent();d===t?d===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=s<l?e.slice(s,l):e.slice(l,s)):e=o?e.slice(s):e.slice(l):d===n&&(e=o?e.slice(0,l):e.slice(0,s)),a+=e}else!bo(d)&&!$r(d)||d===n&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=Xi(),n=t.getEditorState()._selection,r=ki(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;const[i,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),wt(this)}clone(){const e=this.anchor,t=this.focus;return new fi(ui(e.key,e.offset,e.type),ui(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Xo(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Ue[e];return 0!==(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){const r=t[e];"\n"===r||"\r\n"===r?n.push(zr()):"\t"===r?n.push(li()):n.push(ri(r))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,r=this.format,i=this.style;let o=t,s=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,s=t),"element"===o.type&&function(e,t,n,r){const i=e.getNode(),o=i.getChildAtIndex(e.offset),s=ri();if(s.setFormat(n),s.setStyle(r),Ao(o))o.splice(0,0,[s]);else{const e=xo(i)?No().append(s):s;null===o?i.append(e):o.insertBefore(e)}e.is(t)&&t.set(s.__key,0,"text"),e.set(s.__key,0,"text")}(o,s,r,i),"element"===s.type&&jl(s,ea(Vl(s,"next")));const l=o.offset;let a=s.offset;const c=this.getNodes(),u=c.length;let d=c[0];ii(d)||ge(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let p=c[u-1];if(1===u&&"element"===s.type&&(a=h,s.set(o.key,a,"text")),this.isCollapsed()&&l===h&&(Go(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(ii(t)&&t.canInsertTextBefore()&&!Go(t)||(t=ri(),t.setFormat(r),t.setStyle(i),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===l&&(Go(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(ii(t)&&!Go(t)||(t=ri(),t.setFormat(r),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&l!==h){const e=ri(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&""!==e){const t=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||fo(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),vi(this.anchor,this.focus,null),void this.insertText(e)}if(1===u){if(qo(d)){const t=ri(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(l!==a||t===r&&n===i){if(ai(d)){const t=ri(e);return t.setFormat(r),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=ri(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===l)d.insertBefore(t,!1);else{const[e]=d.splitText(l);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(r),d.setStyle(i)}const o=a-l;d=d.spliceText(l,o,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n))}else{const t=new Set([...d.getParentKeys(),...p.getParentKeys()]),n=fo(d)?d:d.getParentOrThrow();let r=fo(p)?p:p.getParentOrThrow(),i=p;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===s.type&&(0!==a||""===p.getTextContent())||"element"===s.type&&p.getIndexWithinParent()<a)if(ii(p)&&!qo(p)&&a!==p.getTextContentSize()){if(p.isSegmented()){const e=ri(p.getTextContent());p.replace(e),p=e}xo(s.getNode())||"text"!==s.type||(p=p.spliceText(0,a,"")),t.add(p.__key)}else{const e=p.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?p.remove():e.remove()}else t.add(p.__key);const o=r.getChildren(),g=new Set(c),f=n.is(r),m=n.isInline()&&null===d.getNextSibling()?n:d;for(let e=o.length-1;e>=0;e--){const t=o[e];if(t.is(d)||fo(t)&&t.isParentOf(d))break;t.isAttached()&&(!g.has(t)||t.is(i)?f||m.insertAfter(t,!1):t.remove())}if(!f){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(qo(d))if(l===h)d.select();else{const t=ri(e);t.select(),d.replace(t)}else d=d.spliceText(l,h-l,e,!0),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e<u;e++){const n=c[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const e=Oi()===this;Gl(this,Ql(Jl(this))),e&&Oi()!==this&&gs(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void rs(null);const n=this.getNodes(),r=[];for(const e of n)ii(e)&&r.push(e);const i=t=>{n.forEach((n=>{if(fo(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},o=r.length;if(0===o)return this.toggleFormat(e),rs(null),void i(t);const s=this.anchor,l=this.focus,a=this.isBackward(),c=a?l:s,u=a?s:l;let d=0,h=r[0],g="element"===c.type?0:c.offset;if("text"===c.type&&g===h.getTextContentSize()&&(d=1,h=r[1],g=0),null==h)return;const p=h.getFormatFlags(e,t);i(p);const f=o-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(Go(h)||0===g&&y===h.getTextContentSize())h.setFormat(p);else{const e=h.splitText(g,y),t=0===g?e[0]:e[1];t.setFormat(p),"text"===c.type&&c.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-g,"text")}return void(this.format=p)}0===g||Go(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const b=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||Go(m)||([m]=m.splitText(y)),m.setFormat(b));for(let t=d+1;t<f;t++){const n=r[t],i=n.getFormatFlags(e,b);n.setFormat(i)}"text"===c.type&&c.set(h.__key,g,"text"),"text"===u.type&&u.set(m.__key,y,"text"),this.format=p|b}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const t=Oi();return pi(t)||ge(134),t.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=gl(t,rl),r=e[e.length-1];if(fo(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=zi(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(fo(e)||bo(e))&&!e.isInline()))){fo(n)||ge(211,t.constructor.name,t.getType());const i=zi(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=No();let n=null;for(let r=0;r<e.length;r++){const i=e[r],o=$r(i);if(o||bo(i)&&i.isInline()||fo(i)&&i.isInline()||ii(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),o))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),o=i.getLastDescendant(),s=i.getChildren(),l=fo(n)&&n.isEmpty()?null:this.insertParagraph(),a=s[s.length-1];let c=s[0];var u;fo(u=c)&&rl(u)&&!u.isEmpty()&&fo(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(fo(n)||ge(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=s[1]),c&&(null===n&&ge(212,t.constructor.name,t.getType()),function(e,t){const n=t.getParentOrThrow().getLastChild();let r=t;const i=[t];for(;r!==n;)r.getNextSibling()||ge(140),r=r.getNextSibling(),i.push(r);let o=e;for(const e of i)o=o.insertAfter(e)}(n,c));const d=gl(o,rl);l&&fo(d)&&(l.canMergeWhenEmpty()||rl(a))&&(d.append(...l.getChildren()),l.remove()),fo(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=fo(n)?n.getLastChild():null;$r(h)&&d!==n&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const e=No();return ds().splice(this.anchor.offset,0,[e]),e.select(),e}const e=zi(this),t=gl(this.anchor.getNode(),rl);fo(t)||ge(213);const n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){const t=zr();if(this.insertNodes([t]),e){const e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){const e=[...this.getNodes()],t=e.length;let n=e[0],r=e[t-1];const[i,o]=bi(this),s=this.isBackward(),[l,a]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,u]=s?[o,i]:[i,o];if(0===t)return[];if(1===t){if(ii(n)&&!this.isCollapsed()){const e=n.splitText(c,u),t=0===c?e[0]:e[1];return t?(l.set(t.getKey(),0,"text"),a.set(t.getKey(),t.getTextContentSize(),"text"),[t]):[]}return[n]}if(ii(n)&&(c===n.getTextContentSize()?e.shift():0!==c&&([,n]=n.splitText(c),e[0]=n,l.set(n.getKey(),0,"text"))),ii(r)){const t=r.getTextContent().length;0===u?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,a.set(r.getKey(),r.getTextContentSize(),"text"))}return e}modify(e,t,n){if(Hi(this,e,t,n))return;const r="move"===e,i=Xi(),o=Zs(Ks(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,a=this.focus.getNode();if(null===l||null===s||!fo(a)||a.isInline()||a.canBeEmpty()||Js(s,i,l),this.dirty){let e=Ms(i,this.anchor.key),t=Ms(i,this.focus.key);"text"===this.anchor.type&&(e=Yo(e)),"text"===this.focus.type&&(t=Yo(t)),e&&t&&Di(o,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(o,e,t?"backward":"forward",n),o.rangeCount>0){const e=o.getRangeAt(0),n=this.anchor.getNode(),i=xo(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t;){if(Ws(t))return t;t=t.getParentOrThrow()}return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let e=0;e<n.length;e++){const t=n[e];$s(t,i)?r.push(t):s=!0}if(s&&r.length>0)if(t){const e=r[0];fo(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];fo(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}o.anchorNode===e.startContainer&&o.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,o=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,o,!0)}(this)}}"lineboundary"===n&&Hi(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&fo(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(fo(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let n=t.getNode();if(this.forwardDeletion(t,n,e))return;const r=Ml(Vl(t,e?"previous":"next"));if(r.getTextSlices().every((e=>null===e||0===e.distance))){let e={type:"initial"};for(const t of r.iterNodeCarets("shadowRoot"))if(vl(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(fo(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=ea(t);Gl(this,Bl(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(wl(t)){if(fo(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(bo(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&fo(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=Ai();e.add(t.origin.getKey()),gs(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return Gl(this,Bl(!t.origin.isEmpty()&&n.isEmpty()?Zl(Nl(n,t.direction)):r.anchor,t)),this.removeText()}}const i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&_i(this,t.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){const t=i.offset,o=r.getTextContentSize();if(r.is(n)||e&&t!==o||!e&&0!==t)return void Si(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,o=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==o)return void Si(n,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){const e=n.offset,o=r.offset,s=e<o,l=s?e:o,a=s?o:e,c=a-1;l!==c&&function(e){return!(fs(e)||xi(e))}(i.getTextContent().slice(l,a))&&(t?r.set(r.key,c,r.type):n.set(n.key,c,n.type))}}(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const e=this.anchor.getNode();e.isEmpty()&&xo(e.getParent())&&null===e.getPreviousSibling()&&_i(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function mi(e){return e instanceof gi}function yi(e){const t=e.offset;if("text"===e.type)return t;const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function bi(e){const t=e.getStartEndPoints();if(null===t)return[0,0];const[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[yi(n),yi(r)]}function _i(e,t){for(let n=t;n;n=n.getParent()){if(fo(n)){if(n.collapseAtStart(e))return!0;if(Ws(n))break}if(n.getPreviousSibling())break}return!1}const xi=(()=>{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Si(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let e=0;e<o;e++){const r=e===o-1;if(l=s,s+=i[e].length,t&&s===n||s>n||r){i.splice(e,1),r&&(l=void 0);break}}const a=i.join("").trim();""===a?r.remove():(r.setTextContent(a),r.select(l,l))}function Ci(e,t,n,r){let i,o=t;if(Xs(e)){let s=!1;const l=e.childNodes,a=l.length,c=r._blockCursorElement;o===a&&(s=!0,o=a-1);let u=l[o],d=!1;if(u===c)u=l[o+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&o--}if(i=ps(u),ii(i))o=Ll(i,s?"next":"previous");else{let l=ps(e);if(null===l)return null;if(fo(l)){const a=r.getElementByKey(l.getKey());null===a&&ge(214);const c=l.getDOMSlot(a);[l,o]=c.resolveChildIndex(l,a,e,t),fo(l)||ge(215),s&&o>=l.getChildrenSize()&&(o=Math.max(0,l.getChildrenSize()-1));let u=l.getChildAtIndex(o);if(fo(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=s?u.getLastDescendant():u.getFirstDescendant();null===e?l=u:(u=e,l=fo(u)?u:u.getParentOrThrow()),o=0}ii(u)?(i=u,l=null,o=Ll(u,s?"next":"previous")):u!==l&&s&&!d&&(fo(l)||ge(216),o=Math.min(l.getChildrenSize(),o+1))}else{const n=l.getIndexWithinParent();o=0===t&&bo(l)&&ps(e)===l?n:n+1,l=l.getParentOrThrow()}if(fo(l))return ui(l.__key,o,"element")}}else i=ps(e);return ii(i)?ui(i.__key,Ll(i,o,"clamp"),"text"):null}function wi(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(t){if((n||!t)&&null===r&&fo(o)&&o.isInline()){const t=o.getPreviousSibling();ii(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else fo(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):ii(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(t&&fo(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&fo(o)&&o.isInline()&&!o.canInsertTextAfter()){const t=o.getNextSibling();ii(t)&&e.set(t.__key,0,"text")}}}function vi(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),i=e.is(t);wi(e,r,i),wi(t,!r,i),i&&t.set(e.key,e.offset,e.type);const o=Xi();if(o.isComposing()&&o._compositionKey!==e.key&&pi(n)){const r=n.anchor,i=n.focus;e.set(r.key,r.offset,r.type,!0),t.set(i.key,i.offset,i.type,!0)}}}function ki(e,t,n,r,i,o){if(null===e||null===n||!Ko(i,e,n))return null;const s=Ci(e,t,pi(o)?o.anchor:null,i);if(null===s)return null;const l=Ci(n,r,pi(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const t=ps(e),r=ps(n);if(bo(t)&&bo(r))return null}return vi(s,l,o),[s,l]}function Ei(e){return fo(e)&&!e.isInline()}function Ti(e,t,n,r,i,o){const s=Yi(),l=new fi(ui(e,t,i),ui(n,r,o),0,"");return l.dirty=!0,s._selection=l,l}function Ni(){const e=ui("root",0,"element"),t=ui("root",0,"element");return new fi(e,t,0,"")}function Ai(){return new gi(new Set)}function Li(e,t,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,a=!Ye&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let c,u,d,h;if(pi(e)&&!a)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,(l||void 0===s)&&pi(e)&&!Ko(n,c,u))return e.clone();const g=ki(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;return new fi(p,f,pi(e)?e.format:0,pi(e)?e.style:"")}function Oi(){return Yi()._selection}function Fi(){return Xi()._editorState._selection}function Ri(e,t,n,r=1){const i=e.anchor,o=e.focus,s=i.getNode(),l=o.getNode();if(!t.is(s)&&!t.is(l))return;const a=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n<t&&r<0){const n=Math.max(0,t+r);i.set(a,n,"element"),o.set(a,n,"element"),Ii(e)}}else{const s=e.isBackward(),l=s?o:i,c=l.getNode(),u=s?i:o,d=u.getNode();if(t.is(c)){const e=l.offset;(n<=e&&r>0||n<e&&r<0)&&l.set(a,Math.max(0,e+r),"element")}if(t.is(d)){const e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(a,Math.max(0,e+r),"element")}}Ii(e)}function Ii(e){const t=e.anchor,n=t.offset,r=e.focus,i=r.offset,o=t.getNode(),s=r.getNode();if(e.isCollapsed()){if(!fo(o))return;const e=o.getChildrenSize(),i=n>=e,s=i?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(ii(s)){let e=0;i&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}}else{if(fo(o)){const e=o.getChildrenSize(),r=n>=e,i=r?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(ii(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(fo(s)){const e=s.getChildrenSize(),t=i>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(i);if(ii(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function Pi(e,t,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,ii(r)?(s=r.getTextContentSize(),l="text"):fo(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,ii(i)?l="text":fo(i)&&(l="element")),null!==o&&null!==l?e.set(o,s,l):(s=t.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function Mi(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function Di(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function Bi(e){let t=Oi()||Fi();null===t&&(t=ds().selectEnd()),t.insertNodes(e)}function zi(e){let t=e;e.isCollapsed()||t.removeText();const n=Oi();pi(n)&&(t=n),pi(t)||ge(161);const r=t.anchor;let i=r.getNode(),o=r.offset;for(;!rl(i);){const e=i;if([i,o]=$i(i,o),e.is(i))break}return o}function $i(e,t){const n=e.getParent();if(!n){const e=No();return ds().append(e),e.select(),[ds(),0]}if(ii(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!fo(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new fi(ui(e.__key,t,"element"),ui(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Hi(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){const[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}const o=Vl(e.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===t;let a=o,c="decorators-and-blocks"===i;if(!ta(a)){for(const e of a){c=!1;const{origin:t}=e;if(!bo(t)||t.isIsolated()||(a=e,!s||!t.isInline()))break}if(c)for(const e of Ml(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(vl(e))e.origin.isInline()||(a=e);else{if(fo(e.origin))continue;bo(e.origin)&&!e.origin.isInline()&&(a=e)}break}}if(a===o)return!1;if(l&&!s&&bo(a.origin)&&a.origin.isKeyboardSelectable()){const e=Ai();return e.add(a.origin.getKey()),gs(e),!0}return a=ea(a),l&&jl(e.anchor,a),jl(e.focus,a),c||!s}let Ki=null,Ui=null,Wi=!1,Vi=!1,ji=0;const qi={characterData:!0,childList:!0,subtree:!0};function Gi(){return Wi||null!==Ki&&Ki._readOnly}function Ji(){Wi&&ge(13)}function Zi(){ji>99&&ge(14)}function Yi(){return null===Ki&&ge(195,Qi()),Ki}function Xi(){return null===Ui&&ge(196,Qi()),Ui}function Qi(){let e=0;const t=new Set,n=Ro.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=Vo(r);if(Uo(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function eo(e,t,n){const r=t.__type,i=Do(e,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let e=0;e<s&&(o[e](t),t.isAttached());e++);}function to(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function no(e,t){if(!t)return;const n=e._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const e of r)n.add(e)}function ro(e){return io(e,Xi()._nodes)}function io(e,t){const n=e.type,r=t.get(n);void 0===r&&ge(17,n);const i=r.klass;e.type!==i.getType()&&ge(18,i.name);const o=i.importJSON(e),s=e.children;if(fo(o)&&Array.isArray(s))for(let e=0;e<s.length;e++){const n=io(s[e],t);o.append(n)}return o}function oo(e,t,n){const r=Ki,i=Wi,o=Ui;Ki=t,Wi=!0,Ui=e;try{return n()}finally{Ki=r,Wi=i,Ui=o}}function so(e,t){const n=e._pendingEditorState,r=e._rootElement,i=e._headless||null===r;if(null===n)return;const o=e._editorState,s=o._selection,l=n._selection,a=0!==e._dirtyType,c=Ki,u=Wi,d=Ui,h=e._updating,g=e._observer;let p=null;if(e._pendingEditorState=null,e._editorState=n,!i&&a&&null!==g){Ui=e,Ki=n,Wi=!1,e._updating=!0;try{const t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),p=function(e,t,n,r,i,o){Pt="",Bt="",zt=2===r,Et=n,kt=n._config,Tt=n._nodes,Nt=Et._listeners.mutation,At=i,Lt=o,Ot=e._nodeMap,Ft=t._nodeMap,$t=t._readOnly,Rt=new Map(n._keyToDOMMap);const s=new Map;return It=s,en("root",null),Et=void 0,Tt=void 0,At=void 0,Lt=void 0,Ot=void 0,Ft=void 0,kt=void 0,Rt=void 0,It=void 0,s}(o,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),Vi)throw t;return Lo(e,null,r,n),st(e),e._dirtyType=2,Vi=!0,so(e,o),void(Vi=!1)}finally{g.observe(r,qi),e._updating=h,Ki=c,Wi=u,Ui=d}}n._readOnly||(n._readOnly=!0);const f=e._dirtyLeaves,m=e._dirtyElements,y=e._normalizedNodes,b=e._updateTags,_=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){const n=e._decorators;let r=e._pendingDecorators||n;const i=t._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=cs(e)),delete r[o])}(e,n);const x=i?null:Zs(Ks(e));if(e._editable&&null!==x&&(a||null===l||l.dirty||!l.is(s))&&null!==r&&!b.has(Pr)){Ui=e,Ki=n;try{if(null!==g&&g.disconnect(),a||null===l||l.dirty){const t=e._blockCursorElement;null!==t&&Js(t,e,r),function(e,t,n,r,i,o){const s=r.anchorNode,l=r.focusNode,a=r.anchorOffset,c=r.focusOffset,u=document.activeElement;if(i.has(Rr)&&u!==o||null!==u&&Ho(u))return;if(!pi(t))return void(null!==e&&Ko(n,s,l)&&r.removeAllRanges());const d=t.anchor,h=t.focus,g=d.key,p=h.key,f=Ms(n,g),m=Ms(n,p),y=d.offset,b=h.offset,_=t.format,x=t.style,S=t.isCollapsed();let C=f,w=m,v=!1;if("text"===d.type){C=Yo(f);const e=d.getNode();v=e.getFormat()!==_||e.getStyle()!==x}else pi(e)&&"text"===e.anchor.type&&(v=!0);var k,E,T,N,A;if("text"===h.type&&(w=Yo(m)),null!==C&&null!==w&&(S&&(null===e||v||pi(e)&&(e.format!==_||e.style!==x))&&(k=_,E=x,T=y,N=g,A=performance.now(),hr=[k,E,T,N,A]),a!==y||c!==b||s!==C||l!==w||"Range"===r.type&&S||(null!==u&&o.contains(u)||i.has(Mr)||o.focus({preventScroll:!0}),"element"===d.type))){if(Di(r,C,y,w,b),!i.has(Ir)&&t.isCollapsed()&&null!==o&&o===document.activeElement){const e=pi(t)&&"element"===t.anchor.type?C.childNodes[y]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=Bs(n),i=Hs(r);if(null===r||null===i)return;let{top:o,bottom:s}=t,l=0,a=0,c=n;for(;null!==c;){const t=c===r.body;if(t)l=0,a=Ks(e).innerHeight;else{const e=c.getBoundingClientRect();l=e.top,a=e.bottom}let n=0;if(o<l?n=-(l-o):s>a&&(n=s-a),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;o-=t,s-=t}if(t)break;c=Ds(c)}}(n,t,o)}}or=!0}}(s,l,e,x,b,r)}!function(e,t,n){let r=e._blockCursorElement;if(pi(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,a=null;if(s===o.getChildrenSize())Gs(o.getChildAtIndex(s-1))&&(l=!0);else{const t=o.getChildAtIndex(s);if(null!==t&&Gs(t)){const n=t.getPreviousSibling();(null===n||Gs(n))&&(l=!0,a=e.getElementByKey(t.__key))}}if(l){const n=e.getElementByKey(o.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=Ee(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===a?n.appendChild(r):n.insertBefore(r,a))}}null!==r&&Js(r,e,t)}(e,r,l)}finally{null!==g&&g.observe(r,qi),Ui=d,Ki=c}}null!==p&&function(e,t,n,r,i){const o=Array.from(e._listeners.mutation),s=o.length;for(let e=0;e<s;e++){const[s,l]=o[e];for(const e of l){const o=t.get(e);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,p,b,f,o),pi(l)||null===l||null!==s&&s.is(l)||e.dispatchCommand(sn,void 0);const S=e._pendingDecorators;null!==S&&(e._decorators=S,e._pendingDecorators=null,lo("decorator",e,!0,S)),function(e,t,n){const r=us(t),i=us(n);r!==i&&lo("textcontent",e,!0,i)}(e,t||o,n),lo("update",e,!0,{dirtyElements:m,dirtyLeaves:f,editorState:n,mutatedNodes:p,normalizedNodes:y,prevEditorState:t||o,tags:b}),function(e,t){if(e._deferred=[],0!==t.length){const n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}(e,_),function(e){const t=e._updates;if(0!==t.length){const n=t.shift();if(n){const[t,r]=n;co(e,t,r)}}}(e)}function lo(e,t,n,...r){const i=t._updating;t._updating=n;try{const n=Array.from(t._listeners[e]);for(let e=0;e<n.length;e++)n[e].apply(null,r)}finally{t._updating=i}}function ao(e,t){const n=e._updates;let r=t||!1;for(;0!==n.length;){const t=n.shift();if(t){const[n,i]=t,o=e._pendingEditorState;let s;void 0!==i&&(s=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(null===o&&ge(191),o._flushSync=!0),s&&e._deferred.push(s),no(e,i.tag)),null==o?co(e,n,i):n()}}return r}function co(e,t,n){const r=e._updateTags;let i,o=!1,s=!1;void 0!==n&&(i=n.onUpdate,no(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),i&&e._deferred.push(i);const l=e._editorState;let a=e._pendingEditorState,c=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=So(a||l),c=!0),a._flushSync=s;const u=Ki,d=Wi,h=Ui,g=e._updating;Ki=a,Wi=!1,e._updating=!0,Ui=e;const p=e._headless||null===e.getRootElement();Po(null);try{c&&(p?null!==l._selection&&(a._selection=l._selection.clone()):a._selection=function(e,t){const n=e.getEditorState()._selection,r=Zs(Ks(e));return pi(n)||null==n?Li(n,r,e,t):n.clone()}(e,n&&n.event||null));const r=e._compositionKey;t(),o=ao(e,o),function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(pi(r)){const e=r.anchor,t=r.focus;let i;if("text"===e.type&&(i=e.getNode(),i.selectionTransform(n,r)),"text"===t.type){const e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(a,e),0!==e._dirtyType&&(o?function(e,t){const n=t._dirtyLeaves,r=e._nodeMap;for(const e of n){const t=r.get(e);ii(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Ct(t)}}(a,e):function(e,t){const n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,o=is(),s=new Map;let l=n,a=l.size,c=r,u=c.size;for(;a>0||u>0;){if(a>0){t._dirtyLeaves=new Set;for(const e of l){const r=i.get(e);ii(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Ct(r),void 0!==r&&to(r,o)&&eo(t,r,s),n.add(e)}if(l=t._dirtyLeaves,a=l.size,a>0){ji++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,c.delete("root")&&c.set("root",!0);for(const e of c){const n=e[0],l=e[1];if(r.set(n,l),!l)continue;const a=i.get(n);void 0!==a&&to(a,o)&&eo(t,a,s)}l=t._dirtyLeaves,a=l.size,c=t._dirtyElements,u=c.size,ji++}t._dirtyLeaves=n,t._dirtyElements=r}(a,e),ao(e),function(e,t,n,r){const i=e._nodeMap,o=t._nodeMap,s=[];for(const[e]of r){const t=o.get(e);void 0!==t&&(t.isAttached()||(fo(t)&&Ze(t,e,i,o,s,r),i.has(e)||r.delete(e),s.push(e)))}for(const e of s)o.delete(e);for(const e of n){const t=o.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),o.delete(e))}}(l,a,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(a._flushSync=!0);const i=a._selection;if(pi(i)){const e=a._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||ge(19)}else mi(i)&&0===i._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=l,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void so(e)}finally{Ki=u,Wi=d,Ui=h,e._updating=g,ji=0}const f=0!==e._dirtyType||e._deferred.length>0||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);f?a._flushSync?(a._flushSync=!1,so(e)):c&&zo((()=>{so(e)})):(a._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function uo(e,t,n){Ui===e&&void 0===n?t():co(e,t,n)}class ho{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new ho(this.element,e,this.after)}withAfter(e){return new ho(this.element,this.before,e)}withElement(e){return this.element===e?this:new ho(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&ge(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&ge(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&ge(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(ke||Se||xe);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=go(t,n);i.push(r);const o=go(t,this.element);let s=e.getIndexWithinParent();for(let e=0;e<o.length;e++){const t=i[e],n=o[e];if(void 0===t||t<n)break;if(t>n){s+=1;break}}return[e.getParentOrThrow(),s]}}function go(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&ge(225),n.reverse()}class po extends Ar{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return je[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=Xi()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(ii(t)&&e.push(t),fo(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;fo(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;fo(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return fo(e)&&e.getLastDescendant()||e||null}const r=t[e];return fo(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:os(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&ge(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:os(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&ge(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;null!==n&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContent(),fo(i)&&r!==n-1&&!i.isInline()&&(e+=De)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContentSize(),fo(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(""!==e){const t=Ve[e];return 0!==(this.getFormat()&t)}return!1}hasTextFormat(e){const t=Ue[e];return 0!==(this.getTextFormat()&t)}getFormatFlags(e,t){return Xo(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Ji();const n=Oi();let r=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===e&&0===t){const e=this.getFirstChild();if(ii(e)||fo(e))return e.select(0,0)}else if(!(void 0!==e&&e!==o||void 0!==t&&t!==o)){const e=this.getLastChild();if(ii(e)||fo(e))return e.select()}void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return pi(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):Ti(s,r,s,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach((e=>e.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e?Ve[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){Nr(this)&&ge(324,this.__key,this.__type);const r=this.getChildrenSize(),i=this.getWritable();e+t<=r||ge(226,String(e),String(t),String(r));const o=i.__key,s=[],l=[],a=this.getChildAtIndex(e+t);let c=null,u=r-t+n.length;if(0!==e)if(e===r)c=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(c=t.getPreviousSibling())}if(t>0){let e=null===c?this.getFirstChild():c.getNextSibling();for(let n=0;n<t;n++){null===e&&ge(100);const t=e.getNextSibling(),n=e.__key;ts(e.getWritable()),l.push(n),e=t}}let d=c;for(const e of n){null!==d&&e.is(d)&&(c=d=d.getPreviousSibling());const t=e.getWritable();t.__parent===o&&u--,ts(t);const n=e.__key;if(null===d)i.__first=n,t.__prev=null;else{const e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===o&&ge(76),t.__parent=o,s.push(n),d=e}if(e+t===r)null!==d&&(d.getWritable().__next=null,i.__last=d.__key);else if(null!==a){const e=a.getWritable();if(null!==d){const t=d.getWritable();e.__prev=d.__key,t.__next=a.__key}else e.__prev=null}if(i.__size=u,l.length){const e=Oi();if(pi(e)){const t=new Set(l),n=new Set(s),{anchor:r,focus:i}=e;mo(r,t,n)&&Pi(r,r.getNode(),this,c,a),mo(i,t,n)&&Pi(i,i.getNode(),this,c,a),0!==u||this.canBeEmpty()||Ws(this)||this.remove()}}return i}getDOMSlot(e){return new ho(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(Xs(t)){const e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function fo(e){return e instanceof po}function mo(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class yo extends Ar{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function bo(e){return e instanceof yo}class _o extends po{__cachedText;static getType(){return"root"}static clone(){return new _o}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ge(51)}getTextContent(){const e=this.__cachedText;return!Gi()&&0!==Xi()._dirtyType||null===e?super.getTextContent():e}remove(){ge(52)}replace(e){ge(53)}insertBefore(e){ge(54)}insertAfter(e){ge(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)fo(e)||bo(e)||ge(282);return super.splice(e,t,n)}static importJSON(e){return ds().updateFromJSON(e)}collapseAtStart(){return!0}}function xo(e){return e instanceof _o}function So(e){return new vo(new Map(e._nodeMap))}function Co(){return new vo(new Map([["root",new _o]]))}function wo(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ge(130,n.name),fo(e)){const r=t.children;Array.isArray(r)||ge(59,n.name);const i=e.getChildren();for(let e=0;e<i.length;e++){const t=wo(i[e]);r.push(t)}}return t}class vo{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return oo(t&&t.editor||null,this,e)}clone(e){const t=new vo(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return oo(null,this,(()=>({root:wo(ds())})))}}class ko extends po{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Eo extends po{static getType(){return"paragraph"}static clone(e){return new Eo(e.__key)}createDOM(e){const t=document.createElement("p"),n=As(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:To,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Xs(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return No().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,t){const n=No();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||ii(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function To(e){const t=No();return e.style&&(t.setFormat(e.style.textAlign),cl(e,t)),{node:t}}function No(){return js(new Eo)}function Ao(e){return e instanceof Eo}function Lo(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Co(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const o=e._observer;null!==o&&(o.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function Oo(e){const t=new Set,n=new Set;let r=e;for(;r;){const{ownNodeConfig:e}=hl(r),i=r.transform;if(!n.has(i)){n.add(i);const e=r.transform();e&&t.add(e)}if(e){const n=e.$transform;n&&t.add(n),r=e.extends}else{const e=Object.getPrototypeOf(r);r=e.prototype instanceof Ar&&e!==Ar?e:void 0}}return t}function Fo(e){const t=e||{},n=Ui,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,o=t.disableEvents||!1,s=Co(),l=t.namespace||(null!==i?i._config.namespace:ys()),a=t.editorState,c=[_o,Gr,Dr,si,Eo,ko,...t.nodes||[]],{onError:u,html:d}=t,h=void 0===t.editable||t.editable;let g;if(void 0===e&&null!==n)g=n._nodes;else{g=new Map;for(let e=0;e<c.length;e++){let t=c[e],n=null,r=null;if("function"!=typeof t){const e=t;t=e.replace,n=e.with,r=e.withKlass||null}hl(t);const i=t.getType(),o=Oo(t);g.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:dt(c[e]),transforms:o})}}const p=new Ro(s,i,g,{disableEvents:o,namespace:l,theme:r},u||console.error,function(e,t){const n=new Map,r=new Set,i=e=>{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(g,d?d.import:void 0),h,e);return void 0!==a&&(p._pendingEditorState=a,p._dirtyType=2),p}class Ro{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=ys(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){void 0===n&&ge(35);const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=r.get(e);void 0===i&&ge(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let o=i.get(t);void 0===o&&(o=new Set,i.set(t,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{o.delete(r),0===o.size&&i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&ge(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=ll(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){const n=ll(e.getEditorState()),r=[];for(const e of t){const t=n.get(e);t&&r.push(t)}0!==r.length&&e.update((()=>{for(const e of r)for(const t of e.keys()){const e=os(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:Or}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return Is(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=As(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Lo(this,t,e,r),null!==t&&(this._config.disableEvents||kr(t),null!=n&&t.classList.remove(...n)),null!==e){const t=Hs(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,st(this),this._updateTags.add(Or),so(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument;rr.set(e,n);const r=ir.get(n)??0;r<1&&n.addEventListener("selectionchange",Cr),ir.set(n,r+1),e.__lexicalEditor=t;const i=xr(e);for(let n=0;n<Xn.length;n++){const[r,o]=Xn[n],s="function"==typeof o?e=>{vr(e)||(wr(e),(t.isEditable()||"click"===r)&&o(e,t))}:e=>{if(vr(e))return;wr(e);const n=t.isEditable();switch(r){case"cut":return n&&Is(t,Kn,e);case"copy":return Is(t,Hn,e);case"paste":return n&&Is(t,gn,e);case"dragstart":return n&&Is(t,Bn,e);case"dragover":return n&&Is(t,zn,e);case"dragend":return n&&Is(t,$n,e);case"focus":return n&&Is(t,Gn,e);case"blur":return n&&Is(t,Jn,e);case"drop":return n&&Is(t,Mn,e)}};e.addEventListener(r,s),i.push((()=>{e.removeEventListener(r,s)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Or),so(this);lo("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&ge(38);let n=e;n._readOnly&&(n=So(e),n._selection=e._selection?e._selection.clone():null),ot(this);const r=this._pendingEditorState,i=this._updateTags,o=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=o&&i.add(o),so(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||so(this)}parseEditorState(e,t){return function(e,t,n){const r=Co(),i=Ki,o=Wi,s=Ui,l=t._dirtyElements,a=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,Ki=r,Wi=!1,Ui=t,Po(null);try{const i=t._nodes;io(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=l,t._dirtyLeaves=a,t._cloneNotNeeded=c,t._dirtyType=u,Ki=i,Wi=o,Ui=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return so(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):co(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),uo(this,(()=>{const r=Oi(),i=ds();null!==r?r.dirty||gs(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),zs("focus"),function(e){Ji(),Xi()._deferred.push(e)}((()=>{n.removeAttribute("autocapitalize"),e&&e()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=Zs(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,lo("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ro.version="0.38.2+prod.esm";let Io=null;function Po(e){Io=e}let Mo=1;function Do(e,t){const n=Bo(e,t);return void 0===n&&ge(30,t),n}function Bo(e,t){return e._nodes.get(t)}const zo="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function $o(e){return bo(as(e))}function Ho(e){const t=document.activeElement;if(!Xs(t))return!1;const n=t.nodeName;return bo(as(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==Vo(t))}function Ko(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!Ho(t)&&Wo(t)===e}catch(e){return!1}}function Uo(e){return e instanceof Ro}function Wo(e){let t=e;for(;null!=t;){const e=Vo(t);if(Uo(e))return e;t=Ds(t)}return null}function Vo(e){return e?e.__lexicalEditor:null}function jo(e){return He.test(e)?"rtl":Ke.test(e)?"ltr":null}function qo(e){return ai(e)||e.isToken()}function Go(e){return qo(e)||e.isSegmented()}function Jo(e){return Qs(e)&&3===e.nodeType}function Zo(e){return Qs(e)&&9===e.nodeType}function Yo(e){let t=e;for(;null!=t;){if(Jo(t))return t;t=t.firstChild}return null}function Xo(e,t,n){const r=Ue[t];if(null!==n&&(e&r)===(n&r))return e;let i=e^r;return"subscript"===t?i&=-65:"superscript"===t?i&=-33:"lowercase"===t?(i&=-513,i&=-1025):"uppercase"===t?(i&=-257,i&=-1025):"capitalize"===t&&(i&=-257,i&=-513),i}function Qo(e){return ii(e)||$r(e)||bo(e)}function es(e,t){const n=function(){const e=Io;return Io=null,e}();if(null!=(t=t||n&&n.__key))return void(e.__key=t);Ji(),Zi();const r=Xi(),i=Yi(),o=""+Mo++;i._nodeMap.set(o,e),fo(e)?r._dirtyElements.set(o,!0):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,e.__key=o}function ts(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),o=e.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,a=null!==i?i.getWritable():null,c=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==a&&(a.__next=s),null!==c&&(c.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function ns(e){Zi(),Nr(e)&&ge(323,e.__key,e.__type);const t=e.getLatest(),n=t.__parent,r=Yi(),i=Xi(),o=r._nodeMap,s=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,o,s);const l=t.__key;i._dirtyType=1,fo(e)?s.set(l,!0):i._dirtyLeaves.add(l)}function rs(e){Ji();const t=Xi(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=os(n);null!==e&&e.getWritable()}if(null!==e){const t=os(e);null!==t&&t.getWritable()}}}function is(){return Gi()?null:Xi()._compositionKey}function os(e,t){const n=(t||Yi())._nodeMap.get(e);return void 0===n?null:n}function ss(e,t){const n=ls(e,Xi());return void 0!==n?os(n,t):null}function ls(e,t){return e[`__lexicalKey_${t._key}`]}function as(e,t){let n=e;for(;null!=n;){const e=ss(n,t);if(null!==e)return e;n=Ds(n)}return null}function cs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function us(e){return e.read((()=>ds().getTextContent()))}function ds(){return hs(Yi())}function hs(e){return e._nodeMap.get("root")}function gs(e){Ji();const t=Yi();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function ps(e){const t=Xi(),n=function(e,t){let n=e;for(;null!=n;){const e=ls(n,t);if(void 0!==e)return e;n=Ds(n)}return null}(e,t);return null===n?e===t.getRootElement()?os("root"):null:os(n)}function fs(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function ms(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function ys(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function bs(e){return Jo(e)?e.nodeValue:null}function _s(e,t,n){const r=Zs(Ks(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=bs(i);const r=as(i);if(null!==t&&ii(r)){if(t===Me&&n){const e=n.length;t=n,o=e,s=e}null!==t&&xs(r,t,o,s,e)}}}function xs(e,t,n,r,i){let o=e;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let l=t;(s||i)&&t[t.length-1]===Me&&(l=t.slice(0,-1));const a=o.getTextContent();if(i||l!==a){if(""===l){if(rs(null),xe||Se||ke)o.remove();else{const e=Xi();setTimeout((()=>{e.update((()=>{o.isAttached()&&o.remove()}))}),20)}return}const t=o.getParent(),i=Fi(),a=o.getTextContentSize(),c=is(),u=o.getKey();if(o.isToken()||null!==c&&u===c&&!s||pi(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===e.__key&&i.focus.offset===a&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const d=Oi();if(!pi(d)||null===n||null===r)return void Ss(o,l,d);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){const e=ri(o.getTextContent());o.replace(e),o=e}Ss(o,l,d)}}}function Ss(e,t,n){if(e.setTextContent(t),pi(n)){const t=e.getKey();for(const r of["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===t&&(i.offset=Ll(e,i.offset,"clamp"))}}}function Cs(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function ws(e,t,n){return function(e,t){return Cs(e,t,"altKey")&&Cs(e,t,"ctrlKey")&&Cs(e,t,"shiftKey")&&Cs(e,t,"metaKey")}(e,n)&&e.key.toLowerCase()===t.toLowerCase()}const vs={ctrlKey:!ye,metaKey:ye},ks={altKey:ye,ctrlKey:!ye};function Es(e){return"Backspace"===e.key}function Ts(e){return ws(e,"a",vs)}function Ns(e){const t=ds();if(pi(e)){const t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),wt(e),e}{const e=t.select(0,t.getChildrenSize());return gs(wt(e)),e}}function As(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=Ee(i);return n[t]=e,e}return i}function Ls(e,t,n,r,i){if(0===n.size)return;const o=r.__type,s=r.__key,l=t.get(o);void 0===l&&ge(33,o);const a=l.klass;let c=e.get(a);void 0===c&&(c=new Map,e.set(a,c));const u=c.get(s),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(s,d?"updated":i)}function Os(e,t,n){const r=e.getParent();let i=n,o=e;return null!==r&&(t&&0===n?(i=o.getIndexWithinParent(),o=r):t||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(t?i-1:i)}function Fs(e,t){const n=e.offset;if("element"===e.type)return Os(e.getNode(),t,n);{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?Os(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function Rs(e){const t=Ks(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Is(e,t,n){return function(e,t,n){const r=ms(e);for(let i=4;i>=0;i--)for(let o=0;o<r.length;o++){const s=r[o],l=s._commands.get(t);if(void 0!==l){const t=l[i];if(void 0!==t){const r=Array.from(t),i=r.length;let o=!1;if(uo(s,(()=>{for(let t=0;t<i;t++)if(r[t](n,e))return void(o=!0)})),o)return o}}}return!1}(e,t,n)}function Ps(e){return!xo(e)&&!e.isLastChild()&&!e.isInline()}function Ms(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&ge(75,t),n}function Ds(e){const t=e.assignedSlot||e.parentElement;return el(t)?t.host:t}function Bs(e){return Zo(e)?e:Xs(e)?e.ownerDocument:null}function zs(e){Ji(),Xi()._updateTags.add(e)}function $s(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function Hs(e){const t=Bs(e);return t?t.defaultView:null}function Ks(e){const t=e._window;return null===t&&ge(78),t}function Us(e){return fo(e)&&e.isInline()||bo(e)&&e.isInline()}function Ws(e){return xo(e)||fo(e)&&e.isShadowRoot()}function Vs(e){const t=e.constructor.clone(e);return es(t,null),t.afterCloneFrom(e),t}function js(e){const t=Xi(),n=e.getType(),r=Bo(t,n);void 0===r&&ge(200,e.constructor.name,n);const{replace:i,replaceWithKlass:o}=r;if(null!==i){const t=i(e),r=t.constructor;return null!==o?t instanceof o||ge(201,o.name,o.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||ge(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&ge(203,e.constructor.name,n,r.name,r.getType()),t}return e}function qs(e,t){!xo(e.getParent())||fo(t)||bo(t)||ge(99)}function Gs(e){return(bo(e)||fo(e)&&!e.canBeEmpty())&&!e.isInline()}function Js(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;null!==r&&r.removeChild(e)}function Zs(e){return fe?(e||window).getSelection():null}function Ys(e){return Xs(e)&&"A"===e.tagName}function Xs(e){return Qs(e)&&1===e.nodeType}function Qs(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function el(e){return Qs(e)&&11===e.nodeType}function tl(e){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function nl(e){const t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function rl(e){if(bo(e)&&!e.isInline())return!0;if(!fo(e)||Ws(e))return!1;const t=e.getFirstChild(),n=null===t||$r(t)||ii(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function il(){return Xi()}const ol=new WeakMap,sl=new Map;function ll(e){if(!e._readOnly&&e.isEmpty())return sl;e._readOnly||ge(192);let t=ol.get(e);return t||(t=function(e){const t=new Map;for(const[n,r]of e._nodeMap){const e=r.__type;let i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),ol.set(e,t)),t}function al(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function cl(e,t){const n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function ul(e){return!0===e.__lexicalUnmanaged}function dl(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Ar[t]}function hl(e){const t=Je in e.prototype?e.prototype[Je]():void 0,n=function(e){if(!(e===Ar||e.prototype instanceof Ar)){let t="<unknown>",n="<unknown>";try{t=e.getType()}catch(e){}try{Ro.version&&(n=JSON.parse(Ro.version))}catch(e){}ge(290,e.name,t,n)}return e===yo||e===po||e===Ar}(e),r=!n&&dl(e,"getType")?e.getType():void 0;let i,o=r;if(t)if(r)i=t[r];else for(const[e,n]of Object.entries(t))o=e,i=n;if(!n&&o&&(dl(e,"getType")||(e.getType=()=>o),dl(e,"clone")||(e.clone=t=>(Po(t),new e)),dl(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!dl(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}const gl=(e,t)=>{let n=e;for(;null!=n&&!xo(n);){if(t(n))return n;n=n.getParent()}return null},pl={next:"previous",previous:"next"};class fl{origin;constructor(e){this.origin=e}[Symbol.iterator](){return zl({hasNext:wl,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Nl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Nl(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){const r=n===this.direction?t:Array.from(t).reverse();let i=this;const o=this.getParentAtCaret(),s=new Map;for(let t=i.getAdjacentCaret();null!==t&&s.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();s.set(e.getKey(),e)}for(const e of r){if(s.size>0){const t=i.getNodeAtCaret();if(t)if(s.delete(t.getKey()),s.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(o)&&e.remove(),t.replace(e)}else null===t&&ge(263,Array.from(s).join(" "))}else i.insert(e);i=Nl(e,this.direction)}for(const e of s.values())e.remove();return this}}class ml extends fl{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Fl(e,this.direction)}getParentCaret(e="root"){return Nl(_l(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=bl(this.direction);return Nl(this.getNodeAtCaret(),e)||Fl(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof ml&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const yl={root:xo,shadowRoot:Ws};function bl(e){return pl[e]}function _l(e,t="root"){return yl[t](e)?null:e}class xl extends fl{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Nl(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return fo(this.origin)?Fl(this.origin,this.direction):null}getParentCaret(e="root"){return Nl(_l(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=bl(this.direction);return Nl(this.getNodeAtCaret(),e)||Fl(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof xl&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof xl||e instanceof Sl)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Sl extends fl{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Al(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Nl(_l(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Al(this.origin,bl(this.direction),this.offset)}isSamePointCaret(e){return e instanceof Sl&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof xl||e instanceof Sl)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Nl(this.origin,this.direction)}}function Cl(e){return e instanceof Sl}function wl(e){return e instanceof xl}function vl(e){return e instanceof ml}const kl={next:class extends Sl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Sl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},El={next:class extends xl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends xl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Tl={next:class extends ml{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends ml{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Nl(e,t){return e?new El[t](e):null}function Al(e,t,n){return e?new kl[t](e,Ll(e,n)):null}function Ll(e,t,n="error"){const r=e.getTextContentSize();let i="next"===t?r:"previous"===t?0:t;return(i<0||i>r)&&("clamp"!==n&&pe(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function Ol(e,t){return new Pl(e,t)}function Fl(e,t){return fo(e)?new Tl[t](e):null}function Rl(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class Il{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new Il(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Cl(t)?function(e,t){const{direction:n,origin:r}=e;return Ol(e,Ll(r,"focus"===t?bl(n):n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){const{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[Ol(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Cl(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Cl(n),i=t=>t.isSameNodeCaret(n)?null:Rl(t)||t.getParentCaret(e);return zl({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Pl{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return Al(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function Ml(e){return Bl(e,Nl(ds(),e.direction))}function Dl(e){return Bl(e,e)}function Bl(e,t){return e.direction!==t.direction&&ge(265),new Il(e,t,e.direction)}function zl(e){const{initial:t,hasNext:n,step:r,map:i}=e;let o=t;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};const e={done:!1,value:i(o)};return o=r(o),e}}}function $l(e,t){const n=Wl(e.origin,t.origin);switch(null===n&&ge(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{const n="text"===e.type,r="text"===t.type;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===t.type?1:-1;case"branch":return Hl(n)}}function Hl(e){const{a:t,b:n}=e,r=t.__key,i=n.__key;let o=t,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return-1;if(s.__key===r)return 1}return null===o?1:-1}function Kl(e,t){return t.is(e)}function Ul(e){return fo(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function Wl(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};const n=new Map;for(let[t,r]=Ul(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=Ul(t);r;i=r,r=r.getParent()){const o=n.get(r);if(void 0!==o)return null===o?(Kl(e,r)||ge(276),{commonAncestor:r,type:"ancestor"}):null===i?(Kl(t,r)||ge(277),{commonAncestor:r,type:"descendant"}):((fo(o)||Kl(e,o))&&(fo(i)||Kl(t,i))&&r.is(o.getParent())&&r.is(i.getParent())||ge(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function Vl(e,t){const{type:n,key:r,offset:i}=e,o=function(e){const t=os(e);return null===t&&ge(63,e),t}(e.key);return"text"===n?(ii(o)||ge(266,o.getType(),r),Al(o,t,i)):(fo(o)||ge(267,o.getType(),r),function(e,t,n){let r=Fl(e,"next");for(let e=0;e<t;e++){const e=r.getAdjacentCaret();if(null===e)break;r=e}return na(r,n)}(o,e.offset,t))}function jl(e,t){const{origin:n,direction:r}=t,i="next"===r;Cl(t)?e.set(n.getKey(),t.offset,"text"):wl(t)?ii(n)?e.set(n.getKey(),Ll(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),"element"):(vl(t)&&fo(n)||ge(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function ql(e){const t=Oi(),n=pi(t)?t:Ni();return Gl(n,e),gs(n),n}function Gl(e,t){jl(e.anchor,t.anchor),jl(e.focus,t.focus)}function Jl(e){const{anchor:t,focus:n}=e,r=Vl(t,"next"),i=Vl(n,"next"),o=$l(r,i)<=0?"next":"previous";return Bl(na(r,o),na(i,o))}function Zl(e){const{direction:t,origin:n}=e,r=Nl(n,bl(t)).getNodeAtCaret();return r?Nl(r,t):Fl(n.getParentOrThrow(),t)}function Yl(e,t="root"){const n=[e];for(let r=vl(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(Zl(r));return n}function Xl(e){return!!e&&e.origin.isAttached()}function Ql(e,t="removeEmptySlices"){if(e.isCollapsed())return e;const n="root",r="next";let i=t;const o=ra(e,r),s=Yl(o.anchor,n),l=Yl(o.focus.getFlipped(),n),a=new Set,c=[];for(const e of o.iterNodeCarets(n))if(vl(e))a.add(e.origin.getKey());else if(wl(e)){const{origin:t}=e;fo(t)&&!a.has(t.getKey())||c.push(t)}for(const e of c)e.remove();for(const e of o.getTextSlices()){if(!e)continue;const{origin:t}=e.caret,n=t.getTextContentSize(),o=Zl(Nl(t,r)),a=t.getMode();if(Math.abs(e.distance)===n&&"removeEmptySlices"===i||"token"===a&&0!==e.distance)o.remove();else if(0!==e.distance){i="removeEmptySlices";let t=e.removeTextSlice();const n=e.caret.origin;if("segmented"===a){const e=t.origin,n=ri(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());o.replaceOrInsert(n),t=Al(n,r,t.offset)}n.is(s[0].origin)&&(s[0]=t),n.is(l[0].origin)&&(l[0]=t.getFlipped())}}let u,d;for(const e of s)if(Xl(e)){u=ea(e);break}for(const e of l)if(Xl(e)){d=ea(e);break}const h=function(e,t,n){if(!e||!t)return null;const r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let a;for(a=0;a<l&&o[a]===s[a];a++);const c=(e,t)=>{let n;for(let r=a;r<e.length;r++){const i=e[r];if(Ws(i))return;!n&&t(i)&&(n=i)}return n},u=c(o,rl),d=u&&c(s,(e=>n.has(e.getKey())&&rl(e)));return u&&d?[u,d]:null}(u,d,a);if(h){const[e,t]=h;Fl(e,"previous").splice(0,t.getChildren()),t.remove()}const g=[u,d,...s,...l].find(Xl);if(g)return Dl(na(ea(g),e.direction));ge(269,JSON.stringify(s.map((e=>e.origin.__key))))}function ea(e){const t=function(e){let t=e;for(;vl(t);){const e=Rl(t);if(!vl(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(ii(t.origin))return Cl(t)?t:Al(t.origin,n,n);const r=t.getAdjacentCaret();return wl(r)&&ii(r.origin)?Al(r.origin,n,bl(n)):t}function ta(e){return Cl(e)&&e.offset!==Ll(e.origin,e.direction)}function na(e,t){return e.direction===t?e:e.getFlipped()}function ra(e,t){return e.direction===t?e:Bl(na(e.focus,t),na(e.anchor,t))}function ia(e){const{origin:t,offset:n,direction:r}=e;if(n===Ll(t,r))return e.getSiblingCaret();if(n===Ll(t,bl(r)))return Zl(e.getSiblingCaret());const[i]=t.splitText(n);return ii(i)||ge(281),na(Nl(i,"next"),r)}function oa(e,t){return!0}function sa(e,{$copyElementNode:t=Vs,$splitTextPointCaretNext:n=ia,rootMode:r="shadowRoot",$shouldSplit:i=oa}={}){if(Cl(e))return n(e);const o=e.getParentCaret(r);if(o){const{origin:n}=o;if(vl(e)&&(!n.canBeEmpty()||!i(n,"first")))return Zl(o);const r=function(e){const t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||n.canBeEmpty()&&i(n,"last"))&&o.insert(t(n).splice(0,0,r))}return o}function la(e,t){if(!t||e===t)return e;for(const n in t)if(e[n]!==t[n])return{...e,...t};return e}const aa=new Map;function ca(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,r]=e.split(/:([^]+)/);n&&r&&(t[n.trim()]=r.trim())}return t}function ua(e){let t=aa.get(e);return void 0===t&&(t=ca(e),aa.set(e,t)),t}function da(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function ha(e){const t=il().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function ga(e){return ha(xo(e)?e:e.getParentOrThrow())}function pa(e){const t=ga(e);return null!==t&&"rtl"===t.direction}function fa(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!Go(t)&&null!==r){const[i,o]=r,s=e.isBackward(),l=i.getNode(),a=o.getNode(),c=t.is(l),u=t.is(a);if(c||u){const[r,i]=bi(e),o=l.is(a),c=t.is(s?a:l),u=t.is(s?l:a);let d,h=0;o?(h=r>i?i:r,d=r>i?r:i):c?(h=s?i:r,d=void 0):u&&(h=0,d=s?r:i);const g=t.__text.slice(h,d);g!==t.__text&&("clone"===n&&(t=function(e){return(t=al(e))[Tr]=!0,t;var t}(t)),t.__text=g)}}return t}function ma(e){const t=e.getStyle(),n=ca(t);aa.set(t,n)}function ya(e,t){(pi(e)?e.isCollapsed():ii(e)||fo(e))||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(280);const n=ua(pi(e)?e.style:ii(e)?e.getStyle():e.getTextStyle()),r=Object.entries(t).reduce(((t,[r,i])=>("function"==typeof i?t[r]=i(n[r],e):null===i?delete t[r]:t[r]=i,t)),{...n}),i=da(r);pi(e)||ii(e)?e.setStyle(i):e.setTextStyle(i),aa.set(i,r)}function ba(e,t){if(pi(e)&&e.isCollapsed()){ya(e,t);const n=e.anchor.getNode();fo(n)&&n.isEmpty()&&ya(n,t)}!function(e){const t=Oi();if(!t)return;const n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(pi(t))for(const e of Jl(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const i=t.getNodes();for(const t of i){if(!ii(t)||!t.canHaveFormat())continue;const[n,i]=r(t);i!==n&&(Go(t)||0===n&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[0===n?0:1]))}pi(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&function(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:r,offset:i,type:o}=t;t.set(n.key,n.offset,n.type),n.set(r,i,o)}}(t)}((e=>{ya(e,t)}))}function _a(e){const t=xa(e);return null!==t&&"vertical-rl"===t.writingMode}function xa(e){const t=e.anchor.getNode();return fo(t)?ha(t):ga(t)}function Sa(e,t){let n=_a(e)?!t:t;Ca(e)&&(n=!n);const r=Vl(e.focus,n?"previous":"next");if(ta(r))return!1;for(const e of Ml(r)){if(vl(e))return!e.origin.isInline();if(!fo(e.origin)){if(bo(e.origin))return!0;break}}return!1}function Ca(e){const t=xa(e);return null!==t&&"rtl"===t.direction}function wa(e,t,n){const r=Ca(e);let i;i=_a(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}function va(e,t,n){const r=ua(e.getStyle());return null!==r&&r[t]||n}function ka(e,t,n=""){let r=null;const i=e.getNodes(),o=e.anchor,s=e.focus,l=e.isBackward(),a=l?s.offset:o.offset,c=l?s.getNode():o.getNode();if(pi(e)&&e.isCollapsed()&&""!==e.style){const n=ua(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e<i.length;e++){const o=i[e];if((0===e||0!==a||!o.is(c))&&ii(o)){const e=va(o,t,n);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?n:r}function Ea(e,t){const n={...e,...t};for(const[r,i]of Object.entries(t))Ta(e[r],i)&&(n[r]=Ea(e[r],i));return n}function Ta(...e){return e.every((e=>e&&e.constructor==Object))}class Na{#e={};constructor(...e){this.merge(...e)}merge(...e){return this.#e=e.reduce(Ea,this.#e)}get(e){return e.split(".").reduce(((e,t)=>e[t]),this.#e)}}function Aa(e,t){return[...Array(1+t-e).keys()].map((t=>t+e))}const La=new Na({attachmentTagName:"action-text-attachment",attachmentContentTypeNamespace:"actiontext",authenticatedUploads:!1,extensions:[]}),Oa=new Na({default:{attachments:!0,markdown:!0,multiLine:!0,richText:!0,toolbar:!0,highlight:{buttons:{color:Aa(1,9).map((e=>`var(--highlight-${e})`)),"background-color":Aa(1,9).map((e=>`var(--highlight-bg-${e})`))},permit:{color:[],"background-color":[]}}}});var Fa={global:La,presets:Oa,configure({global:e,...t}){e&&La.merge(e),Oa.merge(t)}};const Ra=["a","b","blockquote","br","code","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","li","mark","ol","p","pre","q","s","strong","ul","table","tbody","tr","th","td"],Ia=["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","style","title","url","width"],Pa=["color","background-color"];function Ma(){const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content}function Da(e,t){const n=document.activeElement;if(e.includes(n)){new Ba(e,t.key).selectNext(n)&&t.preventDefault()}}he.addHook("uponSanitizeAttribute",(function(e,t){if("style"===t.attrName&&t.attrValue){const e={...ua(t.attrValue)},n={};for(const t in e)Pa.includes(t)&&(n[t]=e[t]);Object.keys(n).length?t.attrValue=da(n):t.keepAttr=!1}})),he.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));class Ba{constructor(e,t){this.elements=e,this.key=t}selectNext(e){const t=this.#t(e);if(t){const e=this.elements.filter((e=>e!==t));return this.#n(e),this.#r(t),!0}return!1}#t(e){switch(this.key){case"ArrowRight":case"ArrowDown":return this.#i(e);case"ArrowLeft":case"ArrowUp":return this.#o(e);case"Home":return this.#s();case"End":return this.#l()}}#s(e=this.elements){return e.find(za)}#l(e=this.elements){return e.findLast(za)}#i(e){const t=this.elements.slice(this.#a(e)+1);return this.#s(t)}#o(e){const t=this.elements.slice(0,this.#a(e));return this.#l(t)}#a(e){return this.elements.indexOf(e)}#r(e){za(e)&&(e.tabIndex=0,e.focus())}#n(e){e.forEach((e=>e.tabIndex=-1))}}function za(e){return e&&!e.disabled&&e.checkVisibility()}class $a extends HTMLElement{static observedAttributes=["connected"];constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar",this.#c()}connectedCallback(){requestAnimationFrame((()=>this.#u())),this.setAttribute("role","toolbar"),this.#d()}disconnectedCallback(){this.#h(),this.#g(),this.#p()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#f()))}setEditor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.#m(),this.#y(),this.#b(),this.#_(),this.#x(),this.#S(),this.#u(),this.#C(),this.resolveEditorPromise(e),this.toggleAttribute("connected",!0)}async getEditorElement(){return this.editorElement||await this.editorPromise}#f(){this.disconnectedCallback(),this.connectedCallback()}#c(){this.editorPromise=new Promise((e=>{this.resolveEditorPromise=e}))}#d(){this.resizeObserver=new ResizeObserver((()=>this.#u())),this.resizeObserver.observe(this)}#h(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}#m(){this.addEventListener("click",this.#w.bind(this))}#w(e){this.#v(e,"[data-command]",this.#k.bind(this))}#v(e,t,n){const r=e.target.closest(t);r&&n(e,r)}#k(e,{dataset:{command:t,payload:n}}){const r=e instanceof PointerEvent&&-1===e.pointerId;this.editor.update((()=>{this.editor.dispatchCommand(t,n)}),{tag:r?Pr:void 0})}#y(){this.editorElement.addEventListener("keydown",this.#E)}#g(){this.editorElement?.removeEventListener("keydown",this.#E)}#E=e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#T(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))};#T(e){const t=e.key.toLowerCase();return[...[e.ctrlKey?"ctrl":null,e.metaKey?"cmd":null,e.altKey?"alt":null,e.shiftKey?"shift":null].filter(Boolean),t].join("+")}#C(){this.editorElement.addEventListener("lexxy:focus",this.#N),this.editorElement.addEventListener("lexxy:blur",this.#A),this.addEventListener("keydown",this.#L)}#p(){this.editorElement.removeEventListener("lexxy:focus",this.#N),this.editorElement.removeEventListener("lexxy:blur",this.#A),this.removeEventListener("keydown",this.#L)}#N=()=>{this.#O[0].tabIndex=0};#A=()=>{this.#b(),this.#F()};#L=e=>{Da(this.#O,e)};#b(){this.#O.forEach((e=>{e.tabIndex=-1}))}#x(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#R(),this.#F()}))}))}#S(){this.editor.registerUpdateListener((()=>{this.#I()}))}#I(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#P("undo",0===e.undoStack.length),this.#P("redo",0===e.redoStack.length))}))}#R(){const e=Oi();if(!pi(e))return;if(!e.anchor.getNode().getParent())return;const{isBold:t,isItalic:n,isStrikethrough:r,isHighlight:i,isInLink:o,isInQuote:s,isInHeading:l,isInCode:a,isInList:c,listType:u,isInTable:d}=this.selection.getFormat();this.#M("bold",t),this.#M("italic",n),this.#M("strikethrough",r),this.#M("highlight",i),this.#M("link",o),this.#M("quote",s),this.#M("heading",l),this.#M("code",a),this.#M("unordered-list",c&&"bullet"===u),this.#M("ordered-list",c&&"number"===u),this.#M("table",d),this.#I()}#M(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#P(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#D(){return this.scrollWidth-this.#B.clientWidth>this.clientWidth+1}#u=()=>{this.#z(),this.#$(),this.#B.style.display=this.#H.children.length?"block":"none",this.#B.setAttribute("nonce",Ma());const e=this.#H.children.length>0;this.toggleAttribute("overflowing",e),this.#H.toggleAttribute("disabled",!e)};#$(){const e=this.#K.reverse();let t=!1;for(const n of e){if(!this.#D()){t&&this.#H.prepend(n);break}this.#H.prepend(n),t=!0}}#z(){const e=Array.from(this.#H.children);e.sort(((e,t)=>this.#U(t)-this.#U(e))),e.forEach((e=>{const t=this.querySelector(`[data-position="${this.#U(e)+1}"]`)??this.#B;this.insertBefore(e,t)}))}#U(e){return parseInt(e.dataset.position??"999")}#_(){this.#W.forEach(((e,t)=>{void 0===e.dataset.position&&(e.dataset.position=t)}))}#F(){this.#V.forEach((e=>{e.open=!1}))}get#V(){return this.querySelectorAll("details")}get#B(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#H(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}get#K(){return Array.from(this.querySelectorAll(":scope > button"))}get#O(){return Array.from(this.querySelectorAll(":scope button, :scope > details > summary"))}get#W(){return Array.from(this.querySelectorAll(":scope > *:not(.lexxy-editor__toolbar-overflow)"))}static get defaultTemplate(){return'\n <button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5 22V2h8.183c1.764 0 3.174.435 4.228 1.304 1.055.87 1.582 2.076 1.582 3.62 0 .8-.148 1.503-.445 2.109a3.94 3.94 0 01-1.194 1.465 4.866 4.866 0 01-1.726.806v.176c.786.078 1.51.312 2.172.703a4.293 4.293 0 011.596 1.627c.403.693.604 1.543.604 2.549 0 1.192-.292 2.207-.877 3.048-.585.84-1.39 1.484-2.416 1.934-1.026.44-2.206.659-3.538.659H5zM8.854 4.974v5.348h2.56c.873 0 1.582-.107 2.129-.322.556-.215.963-.523 1.222-.923.269-.41.403-.904.403-1.48 0-.82-.254-1.46-.762-1.92-.499-.468-1.204-.703-2.115-.703H8.854zm0 8.103v5.949h2.877c1.534 0 2.636-.245 3.307-.733.671-.498 1.007-1.221 1.007-2.168 0-.635-.134-1.178-.403-1.627-.268-.459-.666-.81-1.193-1.055-.518-.244-1.156-.366-1.913-.366H8.854z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17.1 4h-1.5l-3.2 16h1.5l-.4 2h-7l.4-2h1.5l3.2-16h-1.5l.4-2h7l-.4 2z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="strikethrough" data-command="strikethrough" title="Strikethrough">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.70588 16.1591C4.81459 19.7901 7.48035 22 11.6668 22C15.9854 22 18.724 19.6296 18.724 15.8779C18.724 15.5007 18.6993 15.1427 18.6474 14.8066H14.3721C14.8637 15.2085 15.0799 15.7037 15.0799 16.3471C15.0799 17.7668 13.7532 18.7984 11.8113 18.7984C9.88053 18.7984 8.38582 17.7531 8.21659 16.1591H4.70588ZM5.23953 9.31962H9.88794C9.10723 8.88889 8.75888 8.33882 8.75888 7.57339C8.75888 6.13992 9.96576 5.18793 11.7631 5.18793C13.5852 5.18793 14.8761 6.1797 14.9959 7.81344H18.4102C18.3485 4.31824 15.8038 2 11.752 2C7.867 2 5.09129 4.35802 5.09129 7.92044C5.09129 8.41838 5.14071 8.88477 5.23953 9.31962ZM2.23529 10.6914C1.90767 10.6914 1.59347 10.8359 1.36181 11.0931C1.13015 11.3504 1 11.6993 1 12.0631C1 12.4269 1.13015 12.7758 1.36181 13.0331C1.59347 13.2903 1.90767 13.4348 2.23529 13.4348H20.7647C21.0923 13.4348 21.4065 13.2903 21.6382 13.0331C21.8699 12.7758 22 12.4269 22 12.0631C22 11.6993 21.8699 11.3504 21.6382 11.0931C21.4065 10.8359 21.0923 10.6914 20.7647 10.6914H2.23529Z"/>\n </svg>\n </button>\n\n <details class="lexxy-editor__toolbar-dropdown" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="highlight" title="Color highlight">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.65422 0.711575C7.1856 0.242951 6.42579 0.242951 5.95717 0.711575C5.48853 1.18021 5.48853 1.94 5.95717 2.40864L8.70864 5.16011L2.85422 11.0145C1.44834 12.4204 1.44833 14.6998 2.85422 16.1057L7.86011 21.1115C9.26599 22.5174 11.5454 22.5174 12.9513 21.1115L19.6542 14.4087C20.1228 13.94 20.1228 13.1802 19.6542 12.7115L11.8544 4.91171L11.2542 4.31158L7.65422 0.711575ZM4.55127 12.7115L10.4057 6.85716L17.1087 13.56H4.19981C4.19981 13.253 4.31696 12.9459 4.55127 12.7115ZM23.6057 20.76C23.6057 22.0856 22.5311 23.16 21.2057 23.16C19.8802 23.16 18.8057 22.0856 18.8057 20.76C18.8057 19.5408 19.8212 18.5339 20.918 17.4462C21.0135 17.3516 21.1096 17.2563 21.2057 17.16C21.3018 17.2563 21.398 17.3516 21.4935 17.4462C22.5903 18.5339 23.6057 19.5408 23.6057 20.76Z"/></svg>\n </summary>\n <lexxy-highlight-dropdown class="lexxy-editor__toolbar-dropdown-content">\n <div class="lexxy-highlight-colors"></div>\n <button data-command="removeHighlight" class="lexxy-editor__toolbar-button lexxy-editor__toolbar-dropdown-reset">Remove all coloring</button>\n </lexxy-highlight-dropdown>\n </details>\n\n <details class="lexxy-editor__toolbar-dropdown" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="link" title="Link" data-hotkey="cmd+k ctrl+k">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.111 9.546a1.5 1.5 0 012.121 0 5.5 5.5 0 010 7.778l-2.828 2.828a5.5 5.5 0 01-7.778 0 5.498 5.498 0 010-7.777l2.828-2.83a1.5 1.5 0 01.355-.262 6.52 6.52 0 00.351 3.799l-1.413 1.414a2.499 2.499 0 000 3.535 2.499 2.499 0 003.535 0l2.83-2.828a2.5 2.5 0 000-3.536 1.5 1.5 0 010-2.121z"/><path d="M12.111 3.89a5.5 5.5 0 117.778 7.777l-2.828 2.829a1.496 1.496 0 01-.355.262 6.522 6.522 0 00-.351-3.8l1.413-1.412a2.5 2.5 0 10-3.536-3.535l-2.828 2.828a2.5 2.5 0 000 3.536 1.5 1.5 0 01-2.122 2.12 5.5 5.5 0 010-7.777l2.83-2.829z"/></svg>\n </summary>\n <lexxy-link-dropdown class="lexxy-editor__toolbar-dropdown-content">\n <form method="dialog">\n <input type="url" placeholder="Enter a URL…" class="input">\n <div class="lexxy-editor__toolbar-dropdown-actions">\n <button type="submit" class="lexxy-editor__toolbar-button" value="link">Link</button>\n <button type="button" class="lexxy-editor__toolbar-button" value="unlink">Unlink</button>\n </div>\n </form>\n </lexxy-link-dropdown>\n </details>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="quote" data-command="insertQuoteBlock" title="Quote">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 5C8.985 5 11 7.09 11 9.667c0 2.694-.962 5.005-2.187 6.644-.613.82-1.3 1.481-1.978 1.943-.668.454-1.375.746-2.022.746a.563.563 0 01-.52-.36.602.602 0 01.067-.57l.055-.066.009-.009.041-.048a4.25 4.25 0 00.168-.21c.143-.188.336-.47.53-.84a6.743 6.743 0 00.75-2.605C3.705 13.994 2 12.038 2 9.667 2 7.089 4.015 5 6.5 5zM17.5 5C19.985 5 22 7.09 22 9.667c0 2.694-.962 5.005-2.187 6.644-.613.82-1.3 1.481-1.978 1.943-.668.454-1.375.746-2.023.746a.563.563 0 01-.52-.36.602.602 0 01.068-.57l.055-.066.009-.009.041-.048c.039-.045.097-.115.168-.21a6.16 6.16 0 00.53-.84 6.745 6.745 0 00.75-2.605C14.705 13.994 13 12.038 13 9.667 13 7.089 15.015 5 17.5 5z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="heading" data-command="rotateHeadingFormat" title="Heading">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M15.322 5.315H9.64V22H5.684V5.315H0v-3.31h15.322v3.31z"/><path d="M23.957 11.79H19.92V22h-3.402V11.79H12.48V9.137h11.477v2.653z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="code" data-command="insertCodeBlock" title="Code">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M10.121 6l-6 6 6 6-2.12 2.121-7.061-7.06a1.5 1.5 0 010-2.121L8 3.879 10.121 6zM23.06 10.94a1.5 1.5 0 010 2.12L16 20.121 13.88 18l6-6-6-6L16 3.879l7.06 7.06z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5 5a2 2 0 11-4 0 2 2 0 014 0zM5 12a2 2 0 11-4 0 2 2 0 014 0zM5 19a2 2 0 11-4 0 2 2 0 014 0zM7 5.25C7 4.56 7.56 4 8.25 4h13.5a1.25 1.25 0 110 2.5H8.25C7.56 6.5 7 5.94 7 5.25zM7 12.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25zM7 19.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.25C7 4.56 7.56 4 8.25 4h13.5a1.25 1.25 0 110 2.5H8.25C7.56 6.5 7 5.94 7 5.25zM7 12.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25zM7 19.25c0-.69.56-1.25 1.25-1.25h13.5a1.25 1.25 0 110 2.5H8.25c-.69 0-1.25-.56-1.25-1.25zM4.438 8H3.39V3.684H3.34c-.133.093-.267.188-.402.285l-.407.289a129.5 129.5 0 00-.402.285v-.969l.633-.453c.21-.15.42-.302.629-.453h1.046V8zM2.672 11.258h-1v-.051c0-.206.036-.405.11-.598.075-.195.188-.37.34-.527.15-.156.339-.281.566-.375.229-.094.498-.14.808-.14.367 0 .688.065.961.195s.484.308.633.535c.15.224.226.478.226.762 0 .244-.046.463-.14.656-.091.19-.209.368-.352.535-.14.164-.289.332-.445.504L3.168 14.09v.05h2.238V15H1.723v-.656l1.949-2.102c.096-.101.19-.207.281-.316.091-.112.167-.232.227-.36a.953.953 0 00.09-.41.712.712 0 00-.387-.648.845.845 0 00-.41-.098.81.81 0 00-.43.11.75.75 0 00-.277.293.824.824 0 00-.094.386V11.258zM2.852 19.66v-.812h.562a.917.917 0 00.43-.098.742.742 0 00.293-.266.673.673 0 00.101-.379.654.654 0 00-.234-.523.87.87 0 00-.59-.2.987.987 0 00-.336.055.837.837 0 00-.258.149.712.712 0 00-.172.215.66.66 0 00-.066.25h-.98c.007-.209.053-.403.136-.582.084-.18.203-.336.36-.469.156-.135.346-.24.57-.316.227-.076.486-.115.777-.118a2.33 2.33 0 01.965.176c.271.12.48.285.63.496.15.209.227.448.23.719a1.11 1.11 0 01-.16.637 1.28 1.28 0 01-.825.586v.054c.162.016.33.07.504.164.177.094.328.232.453.415.125.18.189.411.192.695a1.37 1.37 0 01-.157.676c-.104.197-.25.365-.437.503-.188.136-.404.24-.649.313-.242.07-.5.105-.777.105-.401 0-.743-.067-1.027-.203a1.608 1.608 0 01-.649-.547 1.46 1.46 0 01-.238-.75h.969c.01.128.057.243.14.344a.885.885 0 00.332.238c.141.058.3.088.477.09.195 0 .366-.034.512-.101a.798.798 0 00.336-.29.744.744 0 00.117-.425.74.74 0 00-.446-.695 1.082 1.082 0 00-.496-.106h-.59z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="upload" data-command="uploadAttachments" title="Upload file">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16 8a2 2 0 110 4 2 2 0 010-4z""/><path d="M22 2a1 1 0 011 1v18a1 1 0 01-1 1H2a1 1 0 01-1-1V3a1 1 0 011-1h20zM3 18.714L9 11l5.25 6.75L17 15l4 4V4H3v14.714z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20.2041 2.01074C21.2128 2.113 22 2.96435 22 4V20L21.9893 20.2041C21.8938 21.1457 21.1457 21.8938 20.2041 21.9893L20 22H4C2.96435 22 2.113 21.2128 2.01074 20.2041L2 20V4C2 2.89543 2.89543 2 4 2H20L20.2041 2.01074ZM4 13V20H11V13H4ZM13 13V20H20V13H13ZM4 11H11V4H4V11ZM13 11H20V4H13V11Z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="divider" data-command="insertHorizontalDivider" title="Insert a divider">\n <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 12C0 11.4477 0.447715 11 1 11H23C23.5523 11 24 11.4477 24 12C24 12.5523 23.5523 13 23 13H1C0.447716 13 0 12.5523 0 12Z"/><path d="M4 5C4 3.89543 4.89543 3 6 3H18C19.1046 3 20 3.89543 20 5C20 6.10457 19.1046 7 18 7H6C4.89543 7 4 6.10457 4 5Z"/><path d="M4 19C4 17.8954 4.89543 17 6 17H18C19.1046 17 20 17.8954 20 19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19Z"/></svg>\n </button>\n \n <div class="lexxy-editor__toolbar-spacer" role="separator"></div>\n \n <button class="lexxy-editor__toolbar-button" type="button" name="undo" data-command="undo" title="Undo">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5.64648 8.26531C7.93911 6.56386 10.7827 5.77629 13.624 6.05535C16.4655 6.33452 19.1018 7.66079 21.0195 9.77605C22.5839 11.5016 23.5799 13.6516 23.8936 15.9352C24.0115 16.7939 23.2974 17.4997 22.4307 17.4997C21.5641 17.4997 20.8766 16.7915 20.7148 15.9401C20.4295 14.4379 19.7348 13.0321 18.6943 11.8844C17.3 10.3464 15.3835 9.38139 13.3174 9.17839C11.2514 8.97546 9.18359 9.54856 7.5166 10.7858C6.38259 11.6275 5.48981 12.7361 4.90723 13.9997H8.5C9.3283 13.9997 9.99979 14.6714 10 15.4997C10 16.3281 9.32843 16.9997 8.5 16.9997H1.5C0.671573 16.9997 0 16.3281 0 15.4997V8.49968C0.000213656 7.67144 0.671705 6.99968 1.5 6.99968C2.3283 6.99968 2.99979 7.67144 3 8.49968V11.0212C3.7166 9.9704 4.60793 9.03613 5.64648 8.26531Z"/></svg>\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo">\n <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.2599 8.26531C15.9672 6.56386 13.1237 5.77629 10.2823 6.05535C7.4408 6.33452 4.80455 7.66079 2.88681 9.77605C1.32245 11.5016 0.326407 13.6516 0.0127834 15.9352C-0.105117 16.7939 0.608975 17.4997 1.47567 17.4997C2.34228 17.4997 3.02969 16.7915 3.19149 15.9401C3.47682 14.4379 4.17156 13.0321 5.212 11.8844C6.60637 10.3464 8.52287 9.38139 10.589 9.17839C12.655 8.97546 14.7227 9.54856 16.3897 10.7858C17.5237 11.6275 18.4165 12.7361 18.9991 13.9997H15.4063C14.578 13.9997 13.9066 14.6714 13.9063 15.4997C13.9063 16.3281 14.5779 16.9997 15.4063 16.9997H22.4063C23.2348 16.9997 23.9063 16.3281 23.9063 15.4997V8.49968C23.9061 7.67144 23.2346 6.99968 22.4063 6.99968C21.578 6.99968 20.9066 7.67144 20.9063 8.49968V11.0212C20.1897 9.9704 19.2984 9.03613 18.2599 8.26531Z"/></svg>\n </button>\n\n <details class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-overflow" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" aria-label="Show more toolbar buttons">•••</summary>\n <div class="lexxy-editor__toolbar-dropdown-content lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons"></div>\n </details>\n '}}function Ha(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ka="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Ua=Ka&&"documentMode"in document?document.documentMode:null;function Wa(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function Va(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function ja(e,...t){const n=Wa(...t);n.length>0&&e.classList.add(...n)}function qa(e,...t){const n=Wa(...t);n.length>0&&e.classList.remove(...n)}function Ga(e){return e?e.getAdjacentCaret():null}function Ja(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function Za(e){const t=Oi()||Fi();let n;if(pi(t))n=Vl(t.focus,"next");else{if(null!=t){const e=t.getNodes(),r=e[e.length-1];r&&(n=Nl(r,"next"))}n=n||Fl(ds(),"previous").getFlipped().insert(No())}const r=function(e,t,n){let r=na(t,"next");for(let e=r;e;e=sa(e,n))r=e;return Cl(r)&&Ha(283),r.insert(e.isInline()?No().append(e):e),na(Nl(e.getLatest(),"next"),t.direction)}(e,n),i=Rl(r);return ql(Dl(vl(i)?ea(i):r)),e.getLatest()}function Ya(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Xa(e,t){return Qa(e,t,null)}function Qa(e,t,n){let r=!1;for(const i of tc(e))t(i)?null!==n&&n(i):(r=!0,fo(i)&&Qa(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function ec(e,t){const n=[],r=Array.from(e).reverse();for(let e=r.pop();void 0!==e;e=r.pop())if(t(e))n.push(e);else if(fo(e))for(const t of tc(e))r.push(t);return n}function tc(e){return nc(Fl(e,"previous"))}function nc(e){return zl({hasNext:wl,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}Ka&&"InputEvent"in window&&!Ua&&new window.InputEvent("input");const rc=Symbol.for("preact-signals");function ic(){if(ac>1)return void ac--;let e,t=!1;for(;void 0!==sc;){let n=sc;for(sc=void 0,cc++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&pc(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(cc=0,ac--,t)throw e}let oc,sc;function lc(e){const t=oc;oc=void 0;try{return e()}finally{oc=t}}let ac=0,cc=0,uc=0;function dc(e){if(void 0===oc)return;let t=e.n;return void 0===t||t.t!==oc?(t={i:0,S:e,p:oc.s,n:void 0,t:oc,e:void 0,x:void 0,r:t},void 0!==oc.s&&(oc.s.n=t),oc.s=t,e.n=t,32&oc.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=oc.s,t.n=void 0,oc.s.n=t,oc.s=t),t):void 0}function hc(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function gc(e,t){return new hc(e,t)}function pc(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function fc(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function mc(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function yc(e,t){hc.call(this,void 0),this.x=e,this.s=void 0,this.g=uc-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function bc(e){const t=e.u;if(e.u=void 0,"function"==typeof t){ac++;const n=oc;oc=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,_c(e),t}finally{oc=n,ic()}}}function _c(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,bc(e)}function xc(e){if(oc!==this)throw new Error("Out-of-order effect");mc(this),oc=e,this.f&=-2,8&this.f&&_c(this),ic()}function Sc(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Cc(e,t){const n=new Sc(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function wc(e,t={}){const n={};for(const r in e){const i=t[r],o=gc(void 0===i?e[r]:i);n[r]=o}return n}function vc(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}function kc(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ec(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,r=t;for(const e in r)n[e]=Ec(n[e],r[e]);return e}return t}hc.prototype.brand=rc,hc.prototype.h=function(){return!0},hc.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:lc((()=>{var e;null==(e=this.W)||e.call(this)})))},hc.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&lc((()=>{var e;null==(e=this.Z)||e.call(this)})))}},hc.prototype.subscribe=function(e){return Cc((()=>{const t=this.value,n=oc;oc=void 0;try{e(t)}finally{oc=n}}),{name:"sub"})},hc.prototype.valueOf=function(){return this.value},hc.prototype.toString=function(){return this.value+""},hc.prototype.toJSON=function(){return this.value},hc.prototype.peek=function(){const e=oc;oc=void 0;try{return this.value}finally{oc=e}},Object.defineProperty(hc.prototype,"value",{get(){const e=dc(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(cc>100)throw new Error("Cycle detected");this.v=e,this.i++,uc++,ac++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{ic()}}}}),yc.prototype=new hc,yc.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===uc)return!0;if(this.g=uc,this.f|=1,this.i>0&&!pc(this))return this.f&=-2,!0;const e=oc;try{fc(this),oc=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return oc=e,mc(this),this.f&=-2,!0},yc.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}hc.prototype.S.call(this,e)},yc.prototype.U=function(e){if(void 0!==this.t&&(hc.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},yc.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(yc.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=dc(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Sc.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.u=e)}finally{e()}},Sc.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,bc(this),fc(this),ac++;const e=oc;return oc=this,xc.bind(this,e)},Sc.prototype.N=function(){2&this.f||(this.f|=2,this.o=sc,sc=this)},Sc.prototype.d=function(){this.f|=8,1&this.f||_c(this)},Sc.prototype.dispose=function(){this.d()};function Tc(e){return 0===e.id}function Nc(e){return 2===e.id}const Ac=new Set;let Lc=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):la;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;Nc(t)||kc(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n);let o;this.state=i,this.extension.init&&(o=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,o,r)}build(e){const t=this.state;let n;4!==t.id&&kc(307,String(t.id),String(5)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;const n=this.state;5!==n.id&&kc(308,String(n.id),String(5));const r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{const e=this.state;7!==e.id&&kc(309,String(n.id),String(7)),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){const t=this.state;let n;return 6!==t.id&&kc(310,String(t.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return void 0===this._signal&&kc(311),this._signal}getInitResult(){void 0===this.extension.init&&kc(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||kc(313,String(e.id),String(4)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=3}(e)||kc(314,String(e.id),String(3)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&kc(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&kc(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||kc(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Ac}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map((([e])=>e))),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=5})(e)||kc(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const Oc={tag:Or};function Fc(){const e=ds();e.isEmpty()&&e.append(No())}const Rc={config:{setOptions:Oc,updateOptions:Oc},init:({$initialEditorState:e=Fc})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const i=r.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:r}=i;if(function(e){return e instanceof vo}(r))e.setEditorState(r,n);else if("function"==typeof r)e.update((()=>{r(e)}),t);else if(r&&("string"==typeof r||"object"==typeof r)){const t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[_o,Gr,Dr,si,Eo]},Ic=Symbol.for("@lexical/extension/LexicalBuilder");function Pc(){}function Mc(e){throw e}function Dc(e){return Array.isArray(e)?e:[e]}const Bc="0.38.2+prod.esm";let zc=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Bc,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(t){const n=[Dc(Rc)];for(const e of t)n.push(Dc(e));return new e(n)}static maybeFromEditor(t){const n=t[Ic];return n&&(n.PACKAGE_VERSION!==Bc&&kc(292,n.PACKAGE_VERSION,Bc),n instanceof e||kc(293)),n}static fromEditor(t){const n=e.maybeFromEditor(t);return void 0===n&&kc(294),n}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(Fo({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[Ic]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=Pc;function t(){try{e()}finally{e=Pc}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Va(this.registerEditor(n),(()=>n.setRootElement(null))),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&kc(295,e.name),t}addEdge(e,t,n){const r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&kc(296);const t=Dc(e),[n]=t;"string"!=typeof n.name&&kc(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&kc(298,n.name),!r){r=new Lc(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&kc(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&kc(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=Dc(e);this.addEdge(n.name,t[0].name,t.slice(1)),this.addExtension(t)}for(const[e,t]of n.peerDependencies||[])this.addEdge(n.name,e,t?[t]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,r)=>{let i=n.state;if(Nc(i))return;const o=n.extension.name;var s;Tc(i)||kc(300,o,r||"[unknown]"),Tc(s=i)||kc(304,String(s.id),String(0)),i=Object.assign(s,{id:1}),n.state=i;const l=this.outgoingConfigEdges.get(o);if(l)for(const e of l.keys()){const n=this.extensionNameMap.get(e);n&&t(n,o)}i=function(e){return function(e){return 1===e.id}(e)||kc(305,String(e.id),String(1)),Object.assign(e,{id:2})}(i),n.state=i,e.push(n)};for(const e of this.extensionNameMap.values())Tc(e.state)&&t(e);for(const t of e)for(const[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){const t=this.extensionNameMap.get(e);if(t)for(const e of n)t.configs.add(e)}for(const[e,...t]of this.roots)if(t.length>0){const n=this.extensionNameMap.get(e.name);void 0===n&&kc(301,e.name);for(const e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(const n of t){const t=n.register(e,i);t&&r.push(t)}for(const n of t){const t=n.afterRegistration(e);t&&r.push(t)}return Va(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,i={},o={},s=this.sortedExtensionReps();for(const l of s){const{extension:s}=l;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of vc(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&kc(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,l)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&Ec(o,s.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);const l=Object.keys(i).length>0,a=r.size>0;(l||a)&&(e.html={},l&&(e.html.import=i),a&&(e.html.export=r));for(const t of s)t.init(e);return e.onError||(e.onError=Mc),e}};function $c(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Hc(e){let t=1,n=e.getParent();for(;null!=n;){if(ou(n)){const e=n.getParent();if(hu(e)){t++,n=e.getParent();continue}$c(40)}return t}return t}function Kc(e){let t=e.getParent();hu(t)||$c(40);let n=t;for(;null!==n;)n=n.getParent(),hu(n)&&(t=n);return t}function Uc(e){let t=[];const n=e.getChildren().filter(ou);for(let e=0;e<n.length;e++){const r=n[e],i=r.getFirstChild();hu(i)?t=t.concat(Uc(i)):t.push(r)}return t}function Wc(e){return ou(e)&&hu(e.getFirstChild())}function Vc(e){return iu().append(e)}function jc(e,t){return ou(e)&&(0===t.length||1===t.length&&e.is(t[0])&&0===e.getChildrenSize())}function qc(e){const t=Oi();if(null!==t){let n=t.getNodes();if(pi(t)){const r=t.getStartEndPoints();null===r&&$c(143);const[i]=r,o=i.getNode(),s=o.getParent();if(Ws(o)){const e=o.getFirstChild();if(e)n=e.selectStart().getNodes();else{const e=No();o.append(e),n=e.select().getNodes()}}else if(jc(o,n)){const t=du(e);if(Ws(s)){o.replace(t);const e=iu();fo(o)&&(e.setFormat(o.getFormatType()),e.setIndent(o.getIndent())),t.append(e)}else if(ou(o)){const e=o.getParentOrThrow();Gc(t,e.getChildren()),e.replace(t)}return}}const r=new Set;for(let t=0;t<n.length;t++){const i=n[t];if(fo(i)&&i.isEmpty()&&!ou(i)&&!r.has(i.getKey())){Jc(i,e);continue}let o=Qo(i)?i.getParent():ou(i)&&i.isEmpty()?i:null;for(;null!=o;){const t=o.getKey();if(hu(o)){if(!r.has(t)){const n=du(e);Gc(n,o.getChildren()),o.replace(n),r.add(t)}break}{const n=o.getParent();if(Ws(n)&&!r.has(t)){r.add(t),Jc(o,e);break}o=n}}}}}function Gc(e,t){e.splice(e.getChildrenSize(),0,t)}function Jc(e,t){if(hu(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),i=iu();let o;if(Gc(i,e.getChildren()),hu(n)&&t===n.getListType())n.append(i),hu(r)&&t===r.getListType()&&(Gc(n,r.getChildren()),r.remove()),o=n;else if(hu(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),o=r;else{const n=du(t);n.append(i),e.replace(n),o=n}return i.setFormat(e.getFormatType()),i.setIndent(e.getIndent()),e.remove(),o}function Zc(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&Wc(n)&&Wc(r)&&(Zc(n.getFirstChild(),r.getFirstChild()),r.remove());const i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function Yc(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())ou(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),hu(r.getFirstChild())||n++)}function Xc(e){const t=new Set;if(Wc(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Wc(r)&&Wc(i)){const n=i.getFirstChild();if(hu(n)){n.append(e);const i=r.getFirstChild();hu(i)&&(Gc(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Wc(r)){const t=r.getFirstChild();if(hu(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(Wc(i)){const t=i.getFirstChild();hu(t)&&t.append(e)}else if(hu(n)){const t=iu().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),o=du(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());t.append(o),o.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Qc(e){if(Wc(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(hu(n?n.getParent():void 0)&&ou(n)&&hu(t)){const r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{const r=t.getListType(),i=iu(),o=du(r);i.append(o),e.getPreviousSiblings().forEach((e=>o.append(e)));const s=iu(),l=du(r);s.append(l),Gc(l,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(s),n.replace(e)}}}function eu(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}let tu=class extends po{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(null==e.__checked)return;const t=e.getParent();hu(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)},extends:po,importDOM:{li:()=>({conversion:nu,priority:0})}})}constructor(e=1,t=void 0,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){!function(e,t,n){const r=t.getParent();!hu(r)||"check"!==r.getListType()||hu(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}(t,this,e),t.value=this.__value,function(e,t,n){const r=[],i=[],o=t.list,s=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),void 0!==s&&r.push(...eu(s)),o){const e=n.getParent(),t=hu(e)&&"check"===e.getListType(),s=n.getChecked();t&&!s||i.push(o.listitemUnchecked),t&&s||i.push(o.listitemChecked),t&&r.push(s?o.listitemChecked:o.listitemUnchecked)}if(void 0!==l){const e=eu(l);n.getChildren().some((e=>hu(e)))?r.push(...e):i.push(...e)}i.length>0&&qa(e,...i),r.length>0&&ja(e,...r)}(t,n.theme,this);const r=e?e.__style:"",i=this.__style;r!==i&&(""===i?t.removeAttribute("style"):t.style.cssText=i),function(e,t,n){const r=ua(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in ua(n.__textStyle))t in r||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){const r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);const r=this.getDirection();return r&&(t.dir=r),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(fo(n)&&this.canMergeWith(n)){const e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(ou(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!hu(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const t=du(n.getListType());let r=this.getNextSibling();for(;r;){const e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}return t&&(fo(e)||$c(139),this.getChildren().forEach((t=>{e.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(hu(n)||$c(39),ou(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=du(n.getListType());r.forEach((e=>i.append(e))),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Wc(t)&&Wc(n)&&(Zc(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=iu().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=No();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=ou(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,o=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(o,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(o,i.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return hu(n)&&(t=n.getListType()),"check"===t?Boolean(e.__checked):void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(null===e||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;ou(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&$c(117),(e=Math.floor(e))>=0||$c(199);let t=this.getIndent();for(;t!==e;)t<e?(Xc(this),t++):(Qc(this),t--);return this}canInsertAfter(e){return ou(e)}canReplaceWith(e){return ou(e)}canMergeWith(e){return ou(e)||Ao(e)}extractWithChild(e,t){if(!pi(t))return!1;const n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return du("bullet")}canMergeWhenEmpty(){return!0}};function nu(e){if(e.classList.contains("task-list-item"))for(const t of e.children)if("INPUT"===t.tagName)return ru(t);if(e.classList.contains("joplin-checkbox"))for(const t of e.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&"INPUT"===t.children[0].tagName)return ru(t.children[0]);const t=e.getAttribute("aria-checked");return{node:iu("true"===t||"false"!==t&&void 0)}}function ru(e){return"checkbox"!==e.getAttribute("type")?{node:null}:{node:iu(e.hasAttribute("checked"))}}function iu(e){return js(new tu(void 0,e))}function ou(e){return e instanceof tu}let su=class extends po{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{!function(e){const t=e.getNextSibling();hu(t)&&e.getListType()===t.getListType()&&Zc(e,t)}(e),Yc(e)},extends:po,importDOM:{ol:()=>({conversion:cu,priority:0}),ul:()=>({conversion:cu,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=uu[e]||e;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag="number"===e?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,lu(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(lu(t,n.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return Xs(t)&&(1!==this.__start&&t.setAttribute("start",String(this.__start)),"check"===this.__listType&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e<n.length;e++){const t=n[e];ou(t)||(r===n&&(r=[...n]),r[e]=iu().append(!fo(t)||hu(t)||t.isInline()?t:ri(t.getTextContent())))}return super.splice(e,t,r)}extractWithChild(e){return ou(e)}};function lu(e,t,n){const r=[],i=[],o=t.list;if(void 0!==o){const e=o[`${n.__tag}Depth`]||[],t=Hc(n)-1,s=t%e.length,l=e[s],a=o[n.__tag];let c;const u=o.nested,d=o.checklist;if(void 0!==u&&u.list&&(c=u.list),void 0!==a&&r.push(a),void 0!==d&&"check"===n.__listType&&r.push(d),void 0!==l){r.push(...eu(l));for(let t=0;t<e.length;t++)t!==s&&i.push(n.__tag+t)}if(void 0!==c){const e=eu(c);t>1?r.push(...e):i.push(...e)}}i.length>0&&qa(e,...i),r.length>0&&ja(e,...r)}function au(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(ou(r)){t.push(r);const e=r.getChildren();e.length>1&&e.forEach((e=>{hu(e)&&t.push(Vc(e))}))}else t.push(Vc(r))}return t}function cu(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=du("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list")||"1"===e.getAttribute("data-is-checklist"))return!0;for(const t of e.childNodes)if(Xs(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?du("check"):du("bullet")),{after:au,node:n}}const uu={ol:"number",ul:"bullet"};function du(e="number",t=1){return js(new su(e,t))}function hu(e){return e instanceof su}const gu=on("UPDATE_LIST_START_COMMAND"),pu=on("INSERT_UNORDERED_LIST_COMMAND"),fu=on("INSERT_ORDERED_LIST_COMMAND"),mu=on("REMOVE_LIST_COMMAND");function yu(e){return Va(e.registerCommand(fu,(()=>(qc("number"),!0)),1),e.registerCommand(gu,(e=>{const{listNodeKey:t,newStart:n}=e,r=os(t);return!!hu(r)&&("number"===r.getListType()&&(r.setStart(n),Yc(r)),!0)}),1),e.registerCommand(pu,(()=>(qc("bullet"),!0)),1),e.registerCommand(mu,(()=>(function(){const e=Oi();if(pi(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(jc(r,n))t.add(Kc(r));else for(let e=0;e<n.length;e++){const r=n[e];if(Qo(r)){const e=Ja(r,tu);null!=e&&t.add(Kc(e))}}for(const n of t){let t=n;const r=Uc(n);for(const n of r){const r=No().setTextStyle(e.style).setTextFormat(e.format);Gc(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&jl(e.anchor,ea(Fl(r,"next"))),n.__key===e.focus.key&&jl(e.focus,ea(Fl(r,"next"))),n.remove()}n.remove()}}}(),!0)),1),e.registerCommand(dn,(()=>function(){const e=Oi();if(!pi(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!ou(t)||0!==t.getChildrenSize())return!1;const n=Kc(t),r=t.getParent();hu(r)||$c(40);const i=r.getParent();let o;if(Ws(i))o=No(),n.insertAfter(o);else{if(!ou(i))return!1;o=iu(),i.insertAfter(o)}o.setTextStyle(e.style).setTextFormat(e.format).select();const s=t.getNextSiblings();if(s.length>0){const e=du(r.getListType());if(ou(o)){const t=iu();t.append(e),o.insertAfter(t)}else o.insertAfter(e);e.append(...s)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!ou(e)&&!hu(e))break;t=e}t.remove()}(t),!0}()),1),e.registerNodeTransform(tu,(e=>{const t=e.getFirstChild();if(t){if(ii(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=Oi();pi(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}})),e.registerNodeTransform(Gr,(e=>{const t=e.getParent();if(ou(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}const bu=new Set(["http:","https:","mailto:","sms:","tel:"]);let _u=class e extends po{__url;__target;__rel;__title;static getType(){return"link"}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e="",t={},n){super(n);const{target:r=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=o}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),ja(t,e.theme.link),t}updateLinkDOM(e,t,n){if(Ys(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const n of["target","rel","title"]){const r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:xu,priority:1})}}static importJSON(e){return Su().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Au(e);try{const t=new URL(Au(e));if(!bu.has(t.protocol))return"about:blank"}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const n=Su(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!pi(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function xu(e){let t=null;if(Ys(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=Su(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Su(e="",t){return js(new _u(e,t))}function Cu(e){return e instanceof _u}let wu=class e extends _u{__isUnlinked;constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}static getType(){return"autolink"}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return vu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(fo(n)){const e=vu(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}};function vu(e="",t){return js(new wu(e,t))}function ku(e){return e instanceof wu}function Eu(e,t){if("element"===e.type){const n=e.getNode();return fo(n)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function Tu(e,t={}){let n;if(e&&"object"==typeof e){const{url:r,...i}=e;n=r,t={...i,...t}}else n=e;const{target:r,title:i}=t,o=void 0===t.rel?"noreferrer":t.rel,s=Oi();if(null===s||!pi(s)&&!mi(s))return;if(mi(s)){const e=s.getNodes();if(0===e.length)return;return void e.forEach((e=>{if(null===n){const t=gl(e,(e=>!ku(e)&&Cu(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=gl(e,(e=>!ku(e)&&Cu(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==o&&t.setRel(o);else{const t=Su(n,{rel:o,target:r});e.insertBefore(t),t.append(e)}}}))}const l=s.extract();if(null===n){const e=new Set;return void l.forEach((t=>{const n=t.getParent();if(Cu(n)&&!ku(n)){const t=n.getKey();if(e.has(t))return;!function(e,t){const n=new Set(t.filter((t=>e.isParentOf(t))).map((e=>e.getKey()))),r=e.getChildren(),i=r.filter((e=>n.has(e.getKey())));if(i.length===r.length)return r.forEach((t=>e.insertBefore(t))),void e.remove();const o=r.findIndex((e=>n.has(e.getKey()))),s=r.findLastIndex((e=>n.has(e.getKey()))),l=0===o,a=s===r.length-1;if(l)i.forEach((t=>e.insertBefore(t)));else if(a)for(let t=i.length-1;t>=0;t--)e.insertAfter(i[t]);else{for(let t=i.length-1;t>=0;t--)e.insertAfter(i[t]);const t=r.slice(s+1);if(t.length>0){const n=Su(e.getURL(),{rel:e.getRel(),target:e.getTarget(),title:e.getTitle()});i[i.length-1].insertAfter(n),t.forEach((e=>n.append(e)))}}}(n,l),e.add(t)}}))}const a=new Set,c=e=>{a.has(e.getKey())||(a.add(e.getKey()),e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==o&&e.setRel(o),void 0!==i&&e.setTitle(i))};if(1===l.length){const e=l[0],t=gl(e,Cu);if(null!==t)return c(t)}!function(e){const t=Oi();if(!pi(t))return e();const n=wt(t),r=n.isBackward(),i=Eu(n.anchor,r?-1:0),o=Eu(n.focus,r?0:-1);if(e(),i||o){const e=Oi();if(pi(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(o){const e=o.getParent();e&&t.focus.set(e.getKey(),o.getIndexWithinParent()+(r?0:1),"element")}gs(wt(t))}}}((()=>{let e=null;for(const t of l){if(!t.isAttached())continue;const s=gl(t,Cu);if(s){c(s);continue}if(fo(t)){if(!t.isInline())continue;if(Cu(t)){if(!(ku(t)||null!==e&&e.getParentOrThrow().isParentOf(t))){c(t),e=t;continue}for(const e of t.getChildren())t.insertBefore(e);t.remove();continue}}const l=t.getPreviousSibling();Cu(l)&&l.is(e)?l.append(t):(e=Su(n,{rel:o,target:r,title:i}),t.insertAfter(e),e.append(t))}}))}const Nu=/^\+?[0-9\s()-]{5,}$/;function Au(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:Nu.test(e)?`tel:${e}`:`https://${e}`}function Lu(e,t){const n=Zo(t)?t.body.childNodes:t.childNodes;let r=[];const i=[];for(const t of n)if(!Ru.has(t.nodeName)){const n=Iu(t,e,i,!1);null!==n&&(r=r.concat(n))}return function(e){for(const t of e)t.getNextSibling()instanceof ko&&t.insertAfter(zr());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(i),r}function Ou(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),r=ds().getChildren();for(let i=0;i<r.length;i++)Fu(e,r[i],n,t);return n.innerHTML}function Fu(e,t,n,r=null){let i=null===r||t.isSelected(r);const o=fo(t)&&t.excludeFromCopy("html");let s=t;null!==r&&ii(t)&&(s=fa(r,t,"clone"));const l=fo(s)?s.getChildren():[],a=Bo(e,s.getType());let c;c=a&&void 0!==a.exportDOM?a.exportDOM(e,s):s.exportDOM(e);const{element:u,after:d}=c;if(!u)return!1;const h=document.createDocumentFragment();for(let n=0;n<l.length;n++){const o=l[n],s=Fu(e,o,h,r);!i&&fo(t)&&s&&t.extractWithChild(o,r,"html")&&(i=!0)}if(i&&!o){if((Xs(u)||el(u))&&u.append(h),n.append(u),d){const e=d.call(s,u);e&&(el(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(h);return i}const Ru=new Set(["STYLE","SCRIPT"]);function Iu(e,t,n,r,i=new Map,o){let s=[];if(Ru.has(e.nodeName))return s;let l=null;const a=function(e,t){const{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase());let i=null;if(void 0!==r)for(const t of r){const n=t(e);null!==n&&(null===i||(i.priority||0)<=(n.priority||0))&&(i=n)}return null!==i?i.conversion:null}(e,t),c=a?a(e):null;let u=null;if(null!==c){u=c.after;const t=c.node;if(l=Array.isArray(t)?t[t.length-1]:t,null!==l){for(const[,e]of i)if(l=e(l,o),!l)break;l&&s.push(...Array.isArray(t)?t:[l])}null!=c.forChild&&i.set(e.nodeName,c.forChild)}const d=e.childNodes;let h=[];const g=(null==l||!Ws(l))&&(null!=l&&Ei(l)||r);for(let e=0;e<d.length;e++)h.push(...Iu(d[e],t,n,g,new Map(i),l));return null!=u&&(h=u(h)),nl(e)&&(h=function(e,t,n){const r=e.style.textAlign,i=[];let o=[];for(let e=0;e<t.length;e++){const s=t[e];if(Ei(s))r&&!s.getFormat()&&s.setFormat(r),i.push(s);else if(o.push(s),e===t.length-1||e<t.length-1&&Ei(t[e+1])){const e=n();e.setFormat(r),e.append(...o),i.push(e),o=[]}}return i}(e,h,g?()=>{const e=new ko;return n.push(e),e}:No)),null==l?h.length>0?s=s.concat(h):nl(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(tl(e.nextSibling)&&tl(e.previousSibling))}(e)&&(s=s.concat(zr())):fo(l)&&l.append(...h),s}function Pu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Mu(e,t=Oi()){return null==t&&Pu(166),pi(t)&&t.isCollapsed()||0===t.getNodes().length?"":Ou(e,t)}function Du(e,t){const n=e.getData("text/plain")||e.getData("text/uri-list");null!=n&&t.insertRawText(n)}function Bu(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return zu(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=ro(e[n]);ii(r)&&ma(r),t.push(r)}return t}(e.nodes),t)}catch(e){console.error(e)}const i=e.getData("text/html"),o=e.getData("text/plain");if(i&&o!==i)try{return zu(n,Lu(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(i),"text/html")),t)}catch(e){console.error(e)}const s=o||e.getData("text/uri-list");if(null!=s)if(pi(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=Oi();if(pi(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([li()]):n.insertText(r)}}}else t.insertRawText(s)}function zu(e,t,n){e.dispatchCommand(ln,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(pi(e)&&e.isCollapsed()){let t=null;const n=Vl(e.anchor,"previous");if(n)if(Cl(n))t=n.origin;else{const e=Bl(n,Fl(ds(),"next").getFlipped());for(const n of e){if(ii(n.origin)){t=n.origin;break}if(fo(n.origin)&&!n.origin.isInline())break}}if(t&&ii(t)){const n=t.getFormat(),r=t.getStyle();e.format===n&&e.style===r||(e.format=n,e.style=r,e.dirty=!0)}}}(n))}function $u(e,t,n,r=[]){let i=null===t||n.isSelected(t);const o=fo(n)&&n.excludeFromCopy("html");let s=n;null!==t&&ii(s)&&(s=fa(t,s,"clone"));const l=fo(s)?s.getChildren():[],a=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Pu(58,n.name),fo(e)){const e=t.children;Array.isArray(e)||Pu(59,n.name)}return t}(s);ii(s)&&0===s.getTextContentSize()&&(i=!1);for(let r=0;r<l.length;r++){const o=l[r],s=$u(e,t,o,a.children);!i&&fo(n)&&s&&n.extractWithChild(o,t,"clone")&&(i=!0)}if(i&&!o)r.push(a);else if(Array.isArray(a.children))for(let e=0;e<a.children.length;e++){const t=a.children[e];r.push(t)}return i}let Hu=null;async function Ku(e,t,n){if(null!==Hu)return!1;if(null!==t)return new Promise(((r,i)=>{e.update((()=>{r(Uu(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,o=i.document,s=Zs(i);if(null===r||null===s)return!1;const l=o.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(o.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise(((t,r)=>{const s=e.registerCommand(Hn,(r=>(Ya(r,ClipboardEvent)&&(s(),null!==Hu&&(i.clearTimeout(Hu),Hu=null),t(Uu(e,r,n))),!0)),4);Hu=i.setTimeout((()=>{s(),Hu=null,t(!1)}),50),o.execCommand("copy"),l.remove()}))}function Uu(e,t,n){if(void 0===n){const t=Zs(e._window),r=Oi();if(!r||r.isCollapsed())return!1;if(!t)return!1;const i=t.anchorNode,o=t.focusNode;if(null!==i&&null!==o&&!Ko(e,i,o))return!1;n=Vu(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of Wu)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Wu=[["text/html",Mu],["application/x-lexical-editor",function(e,t=Oi()){return null==t&&Pu(166),pi(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=ds().getChildren();for(let i=0;i<r.length;i++)$u(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function Vu(e=Oi()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=il();for(const[r,i]of Wu){const o=i(n,e);null!==o&&(t[r]=o)}}return t}const ju={build:(e,t,n)=>wc(t),config:{disabled:"undefined"==typeof window},name:"@lexical/dragon",register:(e,t,n)=>Cc((()=>n.getOutput().disabled.value?void 0:function(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const r=e.getRootElement();if(document.activeElement!==r)return;const i=n.data;if("string"==typeof i){let t;try{t=JSON.parse(i)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const r=t.payload;if(r&&"makeChanges"===r.functionId){const t=r.args;if(t){const[r,i,o,s,l]=t;e.update((()=>{const e=Oi();if(pi(e)){const t=e.anchor;let a=t.getNode(),c=0,u=0;if(ii(a)&&r>=0&&i>=0&&(c=r,u=r+i,e.setTextNodeRange(a,c,a,u)),c===u&&""===o||(e.insertRawText(o),a=t.getNode()),ii(a)){c=s,u=s+l;const t=a.getTextContentSize();c=c>t?t:c,u=u>t?t:u,e.setTextNodeRange(a,c,a,u)}n.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}(e)))},qu="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Gu=qu&&"documentMode"in document?document.documentMode:null,Ju=qu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Zu=!(!qu||!("InputEvent"in window)||Gu)&&"getTargetRanges"in new window.InputEvent("input"),Yu=qu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Xu=qu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qu=qu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ed=qu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ju&&!Qu;function td(e,t){t.update((()=>{if(null!==e){const n=Ya(e,KeyboardEvent)?null:e.clipboardData,r=Oi();if(null!==r&&!r.isCollapsed()&&null!=n){e.preventDefault();const i=Mu(t);null!==i&&n.setData("text/html",i),n.setData("text/plain",r.getTextContent())}}}))}function nd(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const rd="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,id=rd&&"documentMode"in document?document.documentMode:null,od=rd&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),sd=!(!rd||!("InputEvent"in window)||id)&&"getTargetRanges"in new window.InputEvent("input"),ld=rd&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ad=rd&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,cd=rd&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ud=rd&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&od&&!cd,dd=on("DRAG_DROP_PASTE_FILE");let hd=class e extends po{static getType(){return"quote"}static clone(t){return new e(t.__key)}createDOM(e){const t=document.createElement("blockquote");return ja(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:bd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Xs(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return gd().updateFromJSON(e)}insertNewAfter(e,t){const n=No(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=No();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function gd(){return js(new hd)}function pd(e){return e instanceof hd}let fd=class e extends po{__tag;static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){ja(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:yd,priority:0}),h2:e=>({conversion:yd,priority:0}),h3:e=>({conversion:yd,priority:0}),h4:e=>({conversion:yd,priority:0}),h5:e=>({conversion:yd,priority:0}),h6:e=>({conversion:yd,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&md(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>md(e)?{conversion:e=>({node:_d("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(Xs(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return _d(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?No():_d(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=No();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?No():_d(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function md(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function yd(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=_d(t),null!==e.style&&(cl(e,n),n.setFormat(e.style.textAlign))),{node:n}}function bd(e){const t=gd();return null!==e.style&&(t.setFormat(e.style.textAlign),cl(e,t)),{node:t}}function _d(e="h1"){return js(new fd(e))}function xd(e){return e instanceof fd}function Sd(e){let t=null;if(Ya(e,DragEvent)?t=e.dataTransfer:Ya(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function Cd(e){const t=Oi();if(!pi(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){const i=r[t],o=i.getKey();if(n.has(o))continue;const s=gl(i,(e=>fo(e)&&!e.isInline()));if(null===s)continue;const l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function wd(e){return bo(as(e))}function vd(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function kd(e){return Va(e.registerCommand(an,(e=>{const t=Oi();return!!mi(t)&&(t.clear(),!0)}),0),e.registerCommand(cn,(e=>{const t=Oi();return pi(t)?(t.deleteCharacter(e),!0):!!mi(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(fn,(e=>{const t=Oi();return!!pi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(mn,(e=>{const t=Oi();return!!pi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(hn,(t=>{const n=Oi();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Bu(r,n,e);else if(pi(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(pn,(()=>{const e=Oi();return!!pi(e)&&(e.removeText(),!0)}),0),e.registerCommand(yn,(e=>{const t=Oi();return!!pi(t)&&(t.formatText(e),!0)}),0),e.registerCommand(Dn,(e=>{const t=Oi();if(!pi(t)&&!mi(t))return!1;const n=t.getNodes();for(const t of n){const n=gl(t,(e=>fo(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(un,(e=>{const t=Oi();return!!pi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(dn,(()=>{const e=Oi();return!!pi(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(Rn,(()=>(Bi([li()]),!0)),0),e.registerCommand(In,(()=>Cd((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(Pn,(()=>Cd((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(kn,(e=>{const t=Oi();if(mi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(pi(t)){const n=Fs(t.focus,!0);if(!e.shiftKey&&bo(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(En,(e=>{const t=Oi();if(mi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(pi(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===ds().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Fs(t.focus,!1);if(!e.shiftKey&&bo(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(wn,(e=>{const t=Oi();if(mi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),pa(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!pi(t))return!1;if(Sa(t,!0)){const n=e.shiftKey;return e.preventDefault(),wa(t,n,!0),!0}return!1}),0),e.registerCommand(Sn,(e=>{const t=Oi();if(mi(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),pa(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!pi(t))return!1;const n=e.shiftKey;return!!Sa(t,!1)&&(e.preventDefault(),wa(t,n,!1),!0)}),0),e.registerCommand(An,(t=>{if(wd(t.target))return!1;const n=Oi();if(pi(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(xo(n))return!1;const r=function(e){const t=gl(e,(e=>fo(e)&&!e.isInline()));return fo(t)||Ha(4,e.__key),t}(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Pn,void 0);if(ad&&"ko-KR"===navigator.language)return!1}else if(!mi(n))return!1;return t.preventDefault(),e.dispatchCommand(cn,!0)}),0),e.registerCommand(On,(t=>{if(wd(t.target))return!1;const n=Oi();return!(!pi(n)&&!mi(n))&&(t.preventDefault(),e.dispatchCommand(cn,!1))}),0),e.registerCommand(Tn,(t=>{const n=Oi();if(!pi(n))return!1;if(vd(n),null!==t){if((ad||ld||ud)&&sd)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(un,!1)}return e.dispatchCommand(dn,void 0)}),0),e.registerCommand(Ln,(()=>!!pi(Oi())&&(e.blur(),!0)),0),e.registerCommand(Mn,(t=>{const[,n]=Sd(t);if(n.length>0){const r=nd(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,o=as(i);if(null!==o){const e=Ni();if(ii(o))e.anchor.set(o.getKey(),t,"text"),e.focus.set(o.getKey(),t,"text");else{const t=o.getParentOrThrow().getKey(),n=o.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}gs(wt(e))}e.dispatchCommand(dd,n)}return t.preventDefault(),!0}return!!pi(Oi())}),0),e.registerCommand(Bn,(e=>{const[t]=Sd(e),n=Oi();return!(t&&!pi(n))}),0),e.registerCommand(zn,(e=>{const[t]=Sd(e),n=Oi();if(t&&!pi(n))return!1;const r=nd(e.clientX,e.clientY);if(null!==r){bo(as(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Un,(()=>(Ns(),!0)),0),e.registerCommand(Hn,(t=>(Ku(e,Ya(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Kn,(t=>(async function(e,t){await Ku(t,Ya(e,ClipboardEvent)?e:null),t.update((()=>{const e=Oi();pi(e)?e.removeText():mi(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(gn,(t=>{const[,n,r]=Sd(t);return n.length>0&&!r?(e.dispatchCommand(dd,n),!0):(!Qs(t.target)||!Ho(t.target))&&(null!==Oi()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=Oi(),r=Ya(e,InputEvent)||Ya(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Bu(r,n,t)}),{tag:Fr})}(t,e),!0))}),0),e.registerCommand(Nn,(e=>{const t=Oi();return pi(t)&&vd(t),!1}),0),e.registerCommand(Fn,(e=>{const t=Oi();return pi(t)&&vd(t),!1}),0))}const Ed={conflictsWith:["@lexical/plain-text"],dependencies:[ju],name:"@lexical/rich-text",nodes:[fd,hd],register:kd};var Td;o.languages.javascript=o.languages.extend("clike",{"class-name":[o.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),o.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,o.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:o.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:o.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:o.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:o.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:o.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),o.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:o.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),o.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),o.languages.markup&&(o.languages.markup.tag.addInlined("script","javascript"),o.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),o.languages.js=o.languages.javascript,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+o+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+o+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var i=t[n];if("code"===i.type){var o=i.content[1],s=i.content[3];if(o&&s&&"code-language"===o.type&&"code-block"===s.type&&"string"==typeof o.content){var l=o.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),a="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());s.alias?"string"==typeof s.alias?s.alias=[s.alias,a]:s.alias.push(a):s.alias=[a]}}else e(i.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,i=t.classes.length;r<i;r++){var o=t.classes[r],c=/language-(.+)/.exec(o);if(c){n=c[1];break}}var u=e.languages[n];if(u)t.content=e.highlight(function(e){var t=e.replace(s,"");return t=t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),a(n);var r=l[t];return r||e})),t}(t.content),u,n);else if(n&&"none"!==n&&e.plugins.autoloader){var d="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=d,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(d);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},a=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(o),o.languages.c=o.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),o.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),o.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},o.languages.c.string],char:o.languages.c.char,comment:o.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:o.languages.c}}}}),o.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete o.languages.c.boolean,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(o),o.languages.objectivec=o.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete o.languages.objectivec["class-name"],o.languages.objc=o.languages.objectivec,o.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},(Td=o.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/}).string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:Td},boolean:Td.boolean,variable:Td.variable};var Nd;Nd||(Nd=1,o.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},o.languages.python["string-interpolation"].inside.interpolation.inside.rest=o.languages.python,o.languages.py=o.languages.python);var Ad;Ad||(Ad=1,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(o)),o.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},o.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=o.languages.swift}));var Ld;Ld||(Ld=1,function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(o));var Od;Od||(Od=1,function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0,inside:{punctuation:/\./}}})}(o));var Fd;function Rd(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}Fd||(Fd=1,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(o));function Id(e,t){for(const n of e.childNodes){if(Xs(n)&&n.tagName===t)return!0;Id(n,t)}return!1}const Pd="data-language",Md="data-highlight-language",Dd="data-theme";let Bd=class e extends po{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");ja(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Pd,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Md,n));const r=this.getTheme();r&&t.setAttribute(Dd,r);const i=this.getStyle();return i&&t.setAttribute("style",i),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(Pd,r):i&&t.removeAttribute(Pd);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute(Md,r):t.removeAttribute(Md):o&&r&&t.setAttribute(Md,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(Dd,s):l&&t.removeAttribute(Dd);const a=this.__style,c=e.__style;return a?a!==c&&t.setAttribute("style",a):c&&t.removeAttribute("style"),!1}exportDOM(e){const t=document.createElement("pre");ja(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Pd,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Md,n));const r=this.getTheme();r&&t.setAttribute(Dd,r);const i=this.getStyle();return i&&t.setAttribute("style",i),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||Id(e,"BR"))?{conversion:Hd,priority:1}:null,div:()=>({conversion:Kd,priority:1}),pre:()=>({conversion:Hd,priority:0}),table:e=>jd(e)?{conversion:Ud,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&jd(n)?{conversion:Wd,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&jd(t)?{conversion:Wd,priority:3}:null}}}static importJSON(e){return zd().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const e=No();return this.insertAfter(e,t),e}const{anchor:i,focus:o}=e,s=(i.isBefore(o)?i:o).getNode();if(ii(s)){let e=Xd(s);const t=[];for(;;)if(ai(e))t.push(li()),e=e.getNextSibling();else{if(!Zd(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(Jd(" ".repeat(n))),n!==i)break;e=e.getNextSibling()}}const n=s.splitText(i.offset)[0],r=0===i.offset?0:1,o=n.getIndexWithinParent()+r,l=s.getParentOrThrow(),a=[zr(),...t];l.splice(o,0,a);const c=t[t.length-1];c?c.select():0===i.offset?n.selectPrevious():n.getNextSibling().selectNext(0,0)}if($d(s)){const{offset:t}=e.anchor;s.splice(t,0,[zr()]),s.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){const e=No();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function zd(e,t){return function(e){const t=il();return Ji(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(Bd).setLanguage(e).setTheme(t)}function $d(e){return e instanceof Bd}function Hd(e){return{node:zd(e.getAttribute(Pd))}}function Kd(e){const t=e,n=Vd(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(Vd(t))return!0;t=t.parentElement}return!1}(t)?{node:n?zd():null}:{node:null}}function Ud(){return{node:zd()}}function Wd(){return{node:null}}function Vd(e){return null!==e.style.fontFamily.match("monospace")}function jd(e){return e.classList.contains("js-file-line-container")}let qd=class e extends Gr{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e);return ja(t,Gd(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=Gd(n.theme,e.__highlightType),o=Gd(n.theme,this.__highlightType);return i!==o&&(i&&qa(t,i),o&&ja(t,o)),r}static importJSON(e){return Jd().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return zd()}};function Gd(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Jd(e="",t){return js(new qd(e,t))}function Zd(e){return e instanceof qd}function Yd(e,t){let n=e;for(let r=Nl(e,t);r&&(Zd(r.origin)||ai(r.origin));r=Ga(r))n=r.origin;return n}function Xd(e){return Yd(e,"previous")}function Qd(e){return Yd(e,"next")}!function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(Prism);const eh=globalThis.Prism||window.Prism,th={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},nh={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function rh(e){return nh[e]||e}function ih(e){return"string"==typeof e?e:Array.isArray(e)?e.map(ih).join(""):ih(e.content)}function oh(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent();let i=eh.tokenize(r,eh.languages[n?"diff":t]);return n&&(i=function(e,t){const n=t,r=eh.languages[n],i={tokens:e},o=eh.languages.diff.PREFIXES;for(const e of i.tokens){if("string"==typeof e||!(e.type in o)||!Array.isArray(e.content))continue;const t=e.type;let n=0;const i=()=>(n++,new eh.Token("prefix",o[t],t.replace(/^(\w+).*/,"$1"))),s=e.content.filter((e=>"string"==typeof e||"prefix"!==e.type)),l=e.content.length-s.length,a=eh.tokenize(ih(s),r);a.unshift(i());const c=/\r\n|\n/g,u=e=>{const t=[];c.lastIndex=0;let r,o=0;for(;n<l&&(r=c.exec(e));){const n=r.index+r[0].length;t.push(e.slice(o,n)),o=n,t.push(i())}if(0!==t.length)return o<e.length&&t.push(e.slice(o)),t},d=e=>{for(let t=0;t<e.length&&n<l;t++){const n=e[t];if("string"==typeof n){const r=u(n);r&&(e.splice(t,1,...r),t+=r.length-1)}else if("string"==typeof n.content){const e=u(n.content);e&&(n.content=e)}else Array.isArray(n.content)?d(n.content):d([n.content])}};d(a),n<l&&a.push(i()),e.content=a}return i.tokens}(i,n[1])),sh(i)}function sh(e,t){const n=[];for(const r of e)if("string"==typeof r){const e=r.split(/(\n|\t)/),i=e.length;for(let r=0;r<i;r++){const i=e[r];"\n"===i||"\r\n"===i?n.push(zr()):"\t"===i?n.push(li()):i.length>0&&n.push(Jd(i,t))}}else{const{content:e,alias:t}=r;"string"==typeof e?n.push(...sh([e],"prefix"===r.type&&"string"==typeof t?t:r.type)):Array.isArray(e)&&n.push(...sh(e,"unchanged"===r.type?void 0:r.type))}return n}const lh={$tokenize(e,t){return oh(e,t||this.defaultLanguage)},defaultLanguage:"javascript",tokenize(e,t){return eh.tokenize(e,eh.languages[t||""]||eh.languages[this.defaultLanguage])}};function ah(e,t,n){const r=e.getParent();$d(r)?dh(r,t,n):Zd(e)&&e.replace(ri(e.__text))}function ch(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let o="1",s=1;for(let e=0;e<i;e++)$r(r[e])&&(o+="\n"+ ++s);n.setAttribute("data-gutter",o)}const uh=new Set;function dh(e,t,n){const r=e.getKey();void 0===e.getLanguage()&&e.setLanguage(n.defaultLanguage);if(!function(e){const t=function(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}(e),n=t||e;try{return!!n&&eh.languages.hasOwnProperty(n)}catch(e){return!1}}(e.getLanguage()||n.defaultLanguage))return e.getIsSyntaxHighlightSupported()&&e.setIsSyntaxHighlightSupported(!1),void async function(){}();e.getIsSyntaxHighlightSupported()||e.setIsSyntaxHighlightSupported(!0),uh.has(r)||(uh.add(r),t.update((()=>{!function(e,t){const n=os(e);if(!$d(n)||!n.isAttached())return;const r=Oi();if(!pi(r))return void t();const i=r.anchor,o=i.offset,s="element"===i.type&&$r(n.getChildAtIndex(i.offset-1));let l=0;if(!s){const e=i.getNode();l=o+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(s?i.getNode().select(o,o):n.getChildren().some((e=>{const t=ii(e);if(t||$r(e)){const n=e.getTextContentSize();if(t&&n>=l)return e.select(l,l),!0;l-=n}return!1})))}(r,(()=>{const t=os(r);if(!$d(t)||!t.isAttached())return!1;const i=t.getLanguage()||n.defaultLanguage,o=n.$tokenize(t,i),s=function(e,t){let n=0;for(;n<e.length&&hh(e[n],t[n]);)n++;const r=e.length,i=t.length,o=Math.min(r,i)-n;let s=0;for(;s<o;)if(s++,!hh(e[r-s],t[i-s])){s--;break}const l=r-s;return{from:n,nodesForReplacement:t.slice(n,i-s),to:l}}(t.getChildren(),o),{from:l,to:a,nodesForReplacement:c}=s;return!(l===a&&!c.length||(e.splice(l,a-l,c),0))}))}),{onUpdate:()=>{uh.delete(r)},skipTransforms:!0}))}function hh(e,t){return Zd(e)&&Zd(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||ai(e)&&ai(t)||$r(e)&&$r(t)}function gh(e){if(!pi(e))return!1;const t=e.anchor.getNode(),n=$d(t)?t:t.getParent(),r=e.focus.getNode(),i=$d(r)?r:r.getParent();return $d(n)&&n.is(i)}function ph(e){const t=e.getNodes(),n=[];if(1===t.length&&$d(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];Zd(i)||ai(i)||$r(i)||Rd(169),$r(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=ui(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function fh(e){const t=Oi();if(!pi(t)||!gh(t))return!1;const n=ph(t),r=n.length;if(0===r&&t.isCollapsed())return e===In&&t.insertNodes([li()]),!0;if(0===r&&e===In&&"\n"===t.getTextContent()){const e=li(),n=zr(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),ql(ra(Bl(Al(e,"next",0),ea(Nl(n,"next"))),r)),!0}for(let i=0;i<r;i++){const r=n[i];if(r.length>0){let n=r[0];if(0===i&&(n=Xd(n)),e===In){const e=li();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=ui(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else ai(n)&&n.remove()}}return!0}function mh(e,t){const n=Oi();if(!pi(n))return!1;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,l=r.getNode(),a=i.getNode(),c=e===kn;if(!gh(n)||!Zd(l)&&!ai(l)||!Zd(a)&&!ai(a))return!1;if(!t.altKey){if(n.isCollapsed()){const e=l.getParentOrThrow();if(c&&0===o&&null===l.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&o===l.getTextContentSize()&&null===l.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(l.isBefore(a)?(u=Xd(l),d=Qd(a)):(u=Xd(a),d=Qd(l)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;e<h.length;e++){const t=h[e];if(!Zd(t)&&!ai(t)&&!$r(t))return!1}t.preventDefault(),t.stopPropagation();const g=c?u.getPreviousSibling():d.getNextSibling();if(!$r(g))return!0;const p=c?g.getPreviousSibling():g.getNextSibling();if(null==p)return!0;const f=Zd(p)||ai(p)||$r(p)?c?Xd(p):Qd(p):null;let m=null!=f?f:p;return g.remove(),h.forEach((e=>e.remove())),e===kn?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(l,o,a,s),!0}function yh(e,t){const n=Oi();if(!pi(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=e===vn;if(!gh(n)||!Zd(o)&&!ai(o)||!Zd(s)&&!ai(s))return!1;const a=s;if("rtl"===function(e){const t=Xd(e),n=Qd(e);let r=t;for(;null!==r;){if(Zd(r)){const e=jo(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(fo(i)){const e=i.getDirection();if("ltr"===e||"rtl"===e)return e}return null}(a)?!l:l){const e=function(e,t){let n=null,r=null,i=e,o=t,s=e.getTextContent();for(;;){if(0===o){if(i=i.getPreviousSibling(),null===i)break;if(Zd(i)||ai(i)||$r(i)||Rd(167),$r(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent()}else o--;const e=s[o];Zd(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let l=null;if(t<e.getTextContentSize())Zd(e)&&(l=e.getTextContent()[t]);else{const t=e.getNextSibling();Zd(t)&&(l=t.getTextContent()[0])}if(null!==l&&" "!==l)return n;{const r=function(e,t){let n=e,r=t,i=e.getTextContent(),o=e.getTextContentSize();for(;;){if(!Zd(n)||r===o){if(n=n.getNextSibling(),null===n||$r(n))return null;Zd(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if(Zd(n)){if(" "!==i[r])return{node:n,offset:r};r++}}}(e,t);return null!==r?r:n}}(a,i.offset);if(null!==e){const{node:t,offset:r}=e;$r(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else(function(e){const t=Qd(e);return $r(t)&&Rd(168),t})(a).select();return t.preventDefault(),t.stopPropagation(),!0}function bh(e,t){const n={};for(const r of e){const e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}const _h=/[!-/:-@[-`{-~\s]/;function xh(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Sh=at("mdListMarker",{parse:e=>"string"==typeof e&&/^[-*+]$/.test(e)?e:"-"}),Ch=e=>(t,n,r,i)=>{const o=e(r);o.append(...n),t.replace(o),i||o.select(0,0)},wh=e=>(t,n,r,i)=>{const o=t.getPreviousSibling(),s=t.getNextSibling(),l=iu("check"===e?"x"===r[3]:void 0),a=r[0].trim()[0],c="bullet"!==e&&"check"!==e||a!==Sh.parse(a)?void 0:a;if(hu(s)&&s.getListType()===e){c&&ut(s,Sh,c);const e=s.getFirstChild();null!==e?e.insertBefore(l):s.append(l),t.remove()}else if(hu(o)&&o.getListType()===e)c&&ut(o,Sh,c),o.append(l),t.remove();else{const n=du(e,"number"===e?Number(r[2]):void 0);c&&ut(n,Sh,c),n.append(l),t.replace(n)}l.append(...n),i||l.select(0,0);const u=function(e){const t=e.match(/\t/g),n=e.match(/ /g);let r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);u&&l.setIndent(u)},vh=(e,t,n)=>{const r=[],i=e.getChildren();let o=0;for(const s of i)if(ou(s)){if(1===s.getChildrenSize()){const e=s.getFirstChild();if(hu(e)){r.push(vh(e,t,n+1));continue}}const i=" ".repeat(4*n),l=e.getListType(),a=ct(e,Sh),c="number"===l?`${e.getStart()+o}. `:"check"===l?`${a} [${s.getChecked()?"x":" "}] `:a+" ";r.push(i+c+t(s)),o++}return r.join("\n")},kh={dependencies:[fd],export:(e,t)=>{if(!xd(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:Ch((e=>_d("h"+e[1].length))),type:"element"},Eh={dependencies:[hd],export:(e,t)=>{if(!pd(e))return null;const n=t(e).split("\n"),r=[];for(const e of n)r.push("> "+e);return r.join("\n")},regExp:/^>\s/,replace:(e,t,n,r)=>{if(r){const n=e.getPreviousSibling();if(pd(n))return n.splice(n.getChildrenSize(),0,[zr(),...t]),void e.remove()}const i=gd();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},Th={dependencies:[Bd],export:e=>{if(!$d(e))return null;const t=e.getTextContent();return"```"+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n```"},regExpEnd:{optional:!0,regExp:/[ \t]*```$/},regExpStart:/^[ \t]*```([\w-]+)?/,replace:(e,t,n,r,i,o)=>{let s,l;if(!t&&i){if(1===i.length)r?(s=zd(),l=n[1]+i[0]):(s=zd(n[1]),l=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{if(s=zd(n[1]),0===i[0].trim().length)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(" ")?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();l=i.join("\n")}const t=ri(l);s.append(t),e.append(s)}else t&&Ch((e=>zd(e?e[1]:void 0)))(e,t,n,o)},type:"multiline-element"},Nh={dependencies:[su,tu],export:(e,t)=>hu(e)?vh(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:wh("bullet"),type:"element"},Ah={dependencies:[su,tu],export:(e,t)=>hu(e)?vh(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:wh("number"),type:"element"},Lh={dependencies:[_u],export:(e,t,n)=>{if(!Cu(e)||ku(e))return null;const r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{const[,n,r,i]=t,o=Su(r,{title:i}),s=n.split("[").length-1,l=n.split("]").length-1;let a=n,c="";if(s<l)return;if(s>l){const e=n.split("[");c="["+e[0],a=e.slice(1).join("[")}const u=ri(a);return u.setFormat(e.getFormat()),o.append(u),e.replace(o),c&&o.insertBefore(ri(c)),u},trigger:")",type:"text-match"},Oh=[...[kh,Eh,Nh,Ah],...[Th],...[{format:["code"],tag:"`",type:"text-format"},{format:["bold","italic"],tag:"***",type:"text-format"},{format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},{format:["bold"],tag:"**",type:"text-format"},{format:["bold"],intraword:!1,tag:"__",type:"text-format"},{format:["highlight"],tag:"==",type:"text-format"},{format:["italic"],tag:"*",type:"text-format"},{format:["italic"],intraword:!1,tag:"_",type:"text-format"},{format:["strikethrough"],tag:"~~",type:"text-format"}],...[Lh]];function Fh(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(Rh(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function Rh(e,t,n,r,i){for(let o=0;o<i;o++)if(e[t+o]!==n[r+o])return!1;return!0}function Ih(e,t=Oh){const n=function(e){const t=bh(e,(e=>e.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=bh(n.textFormat,(({tag:e})=>e[e.length-1])),i=bh(n.textMatch,(({trigger:e})=>e));for(const n of t){const t=n.type;if("element"===t||"text-match"===t||"multiline-element"===t){const t=n.dependencies;for(const n of t)e.hasNode(n)||xh(173,n.getType())}}const o=(e,t,o)=>{(function(e,t,n,r){if(!Ws(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:o,replace:s}of r){const r=i.match(o);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[o,l]=t.splitText(n);if(!1!==s(e,l?[l,...i]:i,r,!1))return o.remove(),!0}}return!1})(e,t,o,n.element)||function(e,t,n,r){if(!Ws(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExpStart:o,replace:s,regExpEnd:l}of r){if(l&&!("optional"in l)||l&&"optional"in l&&!l.optional)continue;const r=i.match(o);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[o,l]=t.splitText(n);if(!1!==s(e,l?[l,...i]:i,r,null,null,!1))return o.remove(),!0}}return!1}(e,t,o,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t<r.length&&(r=r.slice(0,t));for(const t of i){if(!t.replace||!t.regExp)continue;const n=r.match(t.regExp);if(null===n)continue;const i=n.index||0,o=i+n[0].length;let s;return 0===i?[s]=e.splitText(o):[,s]=e.splitText(i,o),s.selectNext(0,0),t.replace(s,n),!0}return!1}(t,o,i)||function(e,t,n){const r=e.getTextContent(),i=t-1,o=r[i],s=n[o];if(!s)return!1;for(const t of s){const{tag:n}=t,s=n.length,l=i-s+1;if(s>1&&!Rh(r,l,n,0,s))continue;if(" "===r[l-1])continue;const a=r[i+1];if(!1===t.intraword&&a&&!_h.test(a))continue;const c=e;let u=c,d=Fh(r,l,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!$r(h);)if(ii(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=Fh(e,e.length,n)}if(d<0)continue;if(u===c&&d+s===l)continue;const g=u.getTextContent();if(d>0&&g[d-1]===o)continue;const p=g[d-1];if(!1===t.intraword&&p&&!_h.test(p))continue;const f=c.getTextContent(),m=f.slice(0,l)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+s));const b=Oi(),_=Ni();gs(_);const x=i-s*(u===c?2:1)+1;_.anchor.set(u.__key,d,"text"),_.focus.set(c.__key,x,"text");for(const e of t.format)_.hasFormat(e)||_.formatText(e);_.anchor.set(_.focus.key,_.focus.offset,_.focus.type);for(const e of t.format)_.hasFormat(e)&&_.toggleFormat(e);return pi(b)&&(_.format=b.format),!0}}(t,o,r)};return e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(Rr)||t.has(Lr))return;if(e.isComposing())return;const s=r.read(Oi),l=i.read(Oi);if(!pi(l)||!pi(s)||!s.isCollapsed()||s.is(l))return;const a=s.anchor.key,c=s.anchor.offset,u=r._nodeMap.get(a);!ii(u)||!n.has(a)||1!==c&&c>l.anchor.offset+1||e.update((()=>{if(!function(e){return ii(e)&&!e.hasFormat("code")}(u))return;const e=u.getParent();null===e||$d(e)||o(e,u,s.anchor.offset)}))}))}function Ph(e,t){let n=Date.now(),r=0;return(i,o,s,l,a,c)=>{const u=Date.now();if(c.has(Lr))return r=0,n=u,2;const d=function(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const o=t._selection,s=e._selection;if(i)return 1;if(!(pi(o)&&pi(s)&&s.isCollapsed()&&o.isCollapsed()))return 0;const l=function(e,t,n){const r=e._nodeMap,i=[];for(const e of t){const t=r.get(e);void 0!==t&&i.push(t)}for(const[e,t]of n){if(!t)continue;const n=r.get(e);void 0===n||xo(n)||i.push(n)}return i}(t,n,r);if(0===l.length)return 0;if(l.length>1){const n=t._nodeMap,r=n.get(o.anchor.key),i=n.get(s.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&ii(r)&&1===r.__text.length&&1===o.anchor.offset?2:0}const a=l[0],c=e._nodeMap.get(a.__key);if(!ii(c)||!ii(a)||c.__mode!==a.__mode)return 0;const u=c.__text,d=a.__text;if(u===d)return 0;const h=o.anchor,g=s.anchor;if(h.key!==g.key||"text"!==h.type)return 0;const p=h.offset,f=g.offset,m=d.length-u.length;return 1===m&&f===p-1?2:-1===m&&f===p+1?3:-1===m&&f===p?4:0}(i,o,l,a,e.isComposing()),h=(()=>{const h=null===s||s.editor===e,g=c.has("history-push");if(!g&&h&&c.has(Or))return 0;if(null===i)return 1;const p=o._selection;if(!(l.size>0||a.size>0))return null!==p?0:2;const f="number"==typeof t?t:t.peek();return!1===g&&0!==d&&d===r&&u<n+f&&h||1===l.size&&function(e,t,n){const r=t._nodeMap.get(e),i=n._nodeMap.get(e),o=t._selection,s=n._selection;return!(pi(o)&&pi(s)&&"element"===o.anchor.type&&"element"===o.focus.type&&"text"===s.anchor.type&&"text"===s.focus.type||!ii(r)||!ii(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read((()=>r.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(l)[0],i,o)?0:1})();return n=u,r=d,h}}function Mh(e){e.undoStack=[],e.redoStack=[],e.current=null}function Dh(e,t,n){const r=Ph(e,n),i=Va(e.registerCommand(bn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,o=r.pop();null!==i&&(n.push(i),e.dispatchCommand(jn,!0)),0===r.length&&e.dispatchCommand(qn,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Lr})}}(e,t),!0)),0),e.registerCommand(_n,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==n.length){const i=t.current;null!==i&&(r.push(i),e.dispatchCommand(qn,!0));const o=n.pop();0===n.length&&e.dispatchCommand(jn,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Lr})}}(e,t),!0)),0),e.registerCommand(Wn,(()=>(Mh(t),!1)),0),e.registerCommand(Vn,(()=>(Mh(t),e.dispatchCommand(jn,!1),e.dispatchCommand(qn,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:o,dirtyElements:s,tags:l})=>{const a=t.current,c=t.redoStack,u=t.undoStack,d=null===a?null:a.editorState;if(null!==a&&n===d)return;const h=r(i,n,a,o,s,l);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(jn,!1)),null!==a&&(u.push({...a}),e.dispatchCommand(qn,!0));else if(2===h)return;t.current={editor:e,editorState:n}})));return i}function Bh(){return{current:null,redoStack:[],undoStack:[]}}var zh={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline",highlight:"lexxy-content__highlight"},tableCellHeader:"lexxy-content__table-cell--header",tableCellSelected:"lexxy-content__table-cell--selected",tableSelection:"lexxy-content__table--selection",tableScrollableWrapper:"lexxy-content__table-wrapper",tableCellHighlight:"lexxy-content__table-cell--highlight",tableCellFocus:"lexxy-content__table-cell--focus",list:{nested:{listitem:"lexxy-nested-listitem"}},codeHighlight:{addition:"code-token__selector",atrule:"code-token__attr",attr:"code-token__attr","attr-name":"code-token__attr","attr-value":"code-token__selector",boolean:"code-token__property",bold:"code-token__variable",builtin:"code-token__selector",cdata:"code-token__comment",char:"code-token__selector",class:"code-token__function","class-name":"code-token__function",color:"code-token__property",comment:"code-token__comment",constant:"code-token__property",coord:"code-token__comment",decorator:"code-token__function",deleted:"code-token__operator",deletion:"code-token__operator",directive:"code-token__attr","directive-hash":"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__function",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",line:"code-token__selector",namespace:"code-token__variable",number:"code-token__property",macro:"code-token__function",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation","raw-string":"code-token__operator",regex:"code-token__variable",script:"code-token__function",selector:"code-token__selector",string:"code-token__selector",style:"code-token__function",symbol:"code-token__property",tag:"code-token__property",title:"code-token__function","type-definition":"code-token__function",url:"code-token__operator",variable:"code-token__variable"}};function $h(e,t,n=""){const r=document.createElement(e);for(const[e,n]of Object.entries(t||{}))e in r?r[e]=n:null!=n&&r.setAttribute(e,n);return n&&(r.innerHTML=n),r}function Hh(e){return(new DOMParser).parseFromString(e,"text/html")}function Kh(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Uh(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function Wh(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(2)} ${["B","KB","MB","GB","TB","PB"][t]}`}class Vh extends yo{static getType(){return"action_text_attachment"}static clone(e){return new Vh({...e},e.__key)}static importJSON(e){return new Vh({...e})}static importDOM(){return{[this.TAG_NAME]:()=>({conversion:e=>({node:new Vh({sgid:e.getAttribute("sgid"),src:e.getAttribute("url"),previewable:e.getAttribute("previewable"),altText:e.getAttribute("alt"),caption:e.getAttribute("caption"),contentType:e.getAttribute("content-type"),fileName:e.getAttribute("filename"),fileSize:e.getAttribute("filesize"),width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),img:()=>({conversion:e=>({node:new Vh({src:e.getAttribute("src"),caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),video:()=>({conversion:e=>{const t=e.getAttribute("src")||e.querySelector("source")?.src,n=t?.split("/")?.pop(),r=e.querySelector("source")?.getAttribute("content-type")||"video/*";return{node:new Vh({src:t,fileName:n,contentType:r})}},priority:1})}}static get TAG_NAME(){return Fa.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,src:n,previewable:r,altText:i,caption:o,contentType:s,fileName:l,fileSize:a,width:c,height:u},d){super(d),this.tagName=e||Vh.TAG_NAME,this.sgid=t,this.src=n,this.previewable=r,this.altText=i||"",this.caption=o||"",this.contentType=s||"",this.fileName=l||"",this.fileSize=a,this.width=c,this.height=u,this.editor=il()}createDOM(){const e=this.createAttachmentFigure();return this.isPreviewableAttachment?(e.appendChild(this.#j()),e.appendChild(this.#q())):(e.appendChild(this.#G()),e.appendChild(this.#J())),e}updateDOM(e,t){const n=t.querySelector("figcaption textarea");return n&&this.caption&&(n.value=this.caption),!1}getTextContent(){return`[${this.caption||this.fileName}]\n\n`}isInline(){return!1}exportDOM(){return{element:$h(this.tagName,{sgid:this.sgid,previewable:this.previewable||null,url:this.src,alt:this.altText,caption:this.caption,"content-type":this.contentType,filename:this.fileName,filesize:this.fileSize,width:this.width,height:this.height,presentation:"gallery"})}}exportJSON(){return{type:"action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){return e=this.contentType,t=this.isPreviewableAttachment,n=this.fileName,$h("figure",{className:`attachment attachment--${t?"preview":"file"} attachment--${n?n.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":e});var e,t,n}get#Z(){return(e=this.contentType).startsWith("image/")&&!e.includes("svg");var e}get isPreviewableAttachment(){return this.#Z||this.previewable}#j(){return $h("img",{src:this.src,alt:this.altText,...this.#Y})}get#Y(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#G(){return $h("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#J(){const e=$h("figcaption",{className:"attachment__caption"}),t=$h("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=$h("span",{className:"attachment__size",textContent:Wh(this.fileSize)});e.appendChild(t)}return e}#q(){const e=$h("figcaption",{className:"attachment__caption"}),t=$h("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",(e=>this.#X(e))),t.addEventListener("keydown",(e=>this.#Q(e))),e.appendChild(t),e}#X(e){this.#ee(e.target)}#ee(e){e.placeholder=this.fileName,this.editor.update((()=>{this.getWritable().caption=e.value}))}#Q(e){"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),e.target.blur(),this.editor.update((()=>{this.selectNext(0,0)}),{tag:Or}))}}const jh=[Or,Pr,Ir];function qh(e){const t=Ja(e,su);return t?.getListType()??null}function Gh(e,...t){return Jh(Gr,e,((e,n)=>({...e,forChild:(r,i)=>{const o=e?.forChild??(e=>e);let s=o(r,i);if(ii(s))return s=t.reduce(((e,t)=>t(e,n)??e),s),s}})))}function Jh(e,t,n=e=>e){return r=>{const i=e.importDOM()?.[t]?.(r);if(!i)return null;const o=i.conversion(r);return o?n(o,r)??o:o}}class Zh extends Vh{static getType(){return"action_text_attachment_upload"}static clone(e){return new Zh({...e},e.__key)}static importJSON(e){return new Zh({...e})}static importDOM(){return null}constructor(e,t){const{file:n,uploadUrl:r,blobUrlTemplate:i,progress:o,width:s,height:l,uploadError:a}=e;super({...e,contentType:n.type},t),this.file=n,this.uploadUrl=r,this.blobUrlTemplate=i,this.progress=o??null,this.width=s,this.height=l,this.uploadError=a}createDOM(){if(this.uploadError)return this.#te();this.#ne();const e=this.createAttachmentFigure();if(this.isPreviewableAttachment){const t=e.appendChild(this.#j());(async function(e,t){return new Promise((n=>{const r=new FileReader;t.addEventListener("load",(()=>{n(t)})),r.onload=e=>{t.src=e.target.result||null},r.readAsDataURL(e)}))})(this.file,t).then((e=>this.#re(e)))}else e.appendChild(this.#G());return e.appendChild(this.#ie()),e.appendChild(this.#oe()),e}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;if(e.progress!==this.progress){t.querySelector("progress").value=this.progress??0}return!1}exportDOM(){return{element:null}}exportJSON(){return{...super.exportJSON(),type:"action_text_attachment_upload",version:1,uploadUrl:this.uploadUrl,blobUrlTemplate:this.blobUrlTemplate,progress:this.progress,width:this.width,height:this.height,uploadError:this.uploadError}}get#se(){return null!==this.progress}#te(){const e=this.createAttachmentFigure();return e.classList.add("attachment--error"),e.appendChild($h("div",{innerText:`Error uploading ${this.file?.name??"file"}`})),e}#j(){return $h("img")}#G(){return $h("span",{className:"attachment__icon",textContent:this.#le()})}#le(){return this.file.name.split(".").pop().toLowerCase()}#ie(){const e=$h("figcaption",{className:"attachment__caption"}),t=$h("span",{className:"attachment__name",textContent:this.file.name||""}),n=$h("span",{className:"attachment__size",textContent:Wh(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#oe(){return $h("progress",{value:this.progress??0,max:100})}#re({width:e,height:t}){this.#ae||this.editor.update((()=>{const n=this.getWritable();n.width=e,n.height=t}),{tag:jh})}get#ae(){return Boolean(this.width&&this.height)}async#ne(){if(this.#se)return;this.#ce();const{DirectUpload:e}=await import("@rails/activestorage"),t=new e(this.file,this.uploadUrl,this);t.delegate=this.#ue(),t.create(((e,t)=>{e?this.#de(e):this.#he(t)}))}#ue(){const e=Fa.global.get("authenticatedUploads");return{directUploadWillCreateBlobWithXHR:t=>{e&&(t.withCredentials=!0)},directUploadWillStoreFileWithXHR:t=>{e&&(t.withCredentials=!0);t.upload.addEventListener("progress",(e=>this.#ge(e)))}}}#ce(){this.#pe(1)}#ge(e){this.#pe(Math.round(e.loaded/e.total*100))}#pe(e){this.editor.update((()=>{this.getWritable().progress=e}),{tag:jh})}#de(e){console.warn(`Upload error for ${this.file?.name??"file"}: ${e}`),this.editor.update((()=>{this.getWritable().uploadError=!0}),{tag:jh})}async#he(e){this.editor.update((()=>{this.replace(this.#fe(e))}),{tag:jh})}#fe(e){return new Yh(this,e).toAttachmentNode()}}class Yh{constructor(e,t){this.uploadNode=e,this.blob=t}toAttachmentNode(){return new Vh({...this.uploadNode,...this.#me,src:this.#ye})}get#me(){const{blob:e}=this;return{sgid:e.attachable_sgid,altText:e.filename,contentType:e.content_type,fileName:e.filename,fileSize:e.byte_size,previewable:e.previewable}}get#ye(){return this.blob.previewable?this.blob.url:this.#be}get#be(){return this.uploadNode.blobUrlTemplate.replace(":signed_id",this.blob.signed_id).replace(":filename",encodeURIComponent(this.blob.filename))}}class Xh extends yo{static getType(){return"horizontal_divider"}static clone(e){return new Xh(e.__key)}static importJSON(e){return new Xh}static importDOM(){return{hr:e=>({conversion:()=>({node:new Xh}),priority:1})}}constructor(e){super(e)}createDOM(){const e=$h("figure",{className:"horizontal-divider"}),t=$h("hr");return e.appendChild(t),e}updateDOM(){return!0}getTextContent(){return"┄\n\n"}isInline(){return!1}exportDOM(){return{element:$h("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Qh=/^(\d+(?:\.\d+)?)px$/,eg=3,tg=2,ng=0,rg=1;class ig extends po{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(e){return new ig(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:sg,priority:0}),th:e=>({conversion:sg,priority:0})}}static importJSON(e){return lg().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=ng,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),null!==this.__backgroundColor&&(t.style.backgroundColor=this.__backgroundColor),og(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),ja(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(Xs(t.element)){const e=t.element;e.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||"top",e.style.textAlign="start",null===this.__backgroundColor&&this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...og(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=eg){const n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==ng}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function og(e){return"middle"===e||"bottom"===e}function sg(e){const t=e,n=e.nodeName.toLowerCase();let r;Qh.test(t.style.width)&&(r=parseFloat(t.style.width));const i=lg("th"===n?rg:ng,t.colSpan,r);i.__rowSpan=t.rowSpan;const o=t.style.backgroundColor;""!==o&&(i.__backgroundColor=o);const s=t.style.verticalAlign;og(s)&&(i.__verticalAlign=s);const l=t.style,a=(l&&l.textDecoration||"").split(" "),c="700"===l.fontWeight||"bold"===l.fontWeight,u=a.includes("line-through"),d="italic"===l.fontStyle,h=a.includes("underline");return{after:e=>{const t=[];let n=null;const r=()=>{if(n){const e=n.getFirstChild();$r(e)&&1===n.getChildrenSize()&&e.remove()}};for(const i of e)Us(i)||ii(i)||$r(i)?(ii(i)&&(c&&i.toggleFormat("bold"),u&&i.toggleFormat("strikethrough"),d&&i.toggleFormat("italic"),h&&i.toggleFormat("underline")),n?n.append(i):(n=No().append(i),t.push(n))):(t.push(i),r(),n=null);return r(),0===t.length&&t.push(No()),t},node:i}}function lg(e=ng,t=1,n){return js(new ig(e,t,n))}function ag(e){return e instanceof ig}const cg=on("INSERT_TABLE_COMMAND");function ug(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let dg=class e extends po{__height;static getType(){return"tablerow"}static clone(t){return new e(t.__height,t.__key)}static importDOM(){return{tr:e=>({conversion:hg,priority:0})}}static importJSON(e){return gg().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...void 0===e?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),ja(t,e.theme.tableRow),t}extractWithChild(e,t,n){return"html"===n}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function hg(e){const t=e;let n;return Qh.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>ec(e,ag),node:gg(n)}}function gg(e){return js(new dg(e))}function pg(e){return e instanceof dg}const fg="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,mg=fg&&"documentMode"in document?document.documentMode:null,yg=fg&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function bg(e){const t=gl(e,(e=>ag(e)));return ag(t)?t:null}function _g(e){const t=gl(e,(e=>pg(e)));if(pg(t))return t;throw new Error("Expected table cell to be inside of table row.")}function xg(e){const t=gl(e,(e=>Np(e)));if(Np(t))return t;throw new Error("Expected table cell to be inside of table.")}fg&&"InputEvent"in window&&!mg&&new window.InputEvent("input");const Sg=(e,t)=>e===eg||e===t?t:ng;function Cg(e=!0){const t=Oi();pi(t)||Bg(t)||ug(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Rg(n),[o,,s]=Rg(r),[,l,a]=Og(s,o,i),{startRow:c}=a,{startRow:u}=l;return e?wg(c+i.__rowSpan>u+o.__rowSpan?i:o,!0):wg(u<c?o:i,!1)}function wg(e,t=!0){const[,,n]=Rg(e),[r,i]=Og(n,e,e),o=r[0].length,{startRow:s}=i;let l=null;if(t){const t=s+e.__rowSpan-1,i=r[t],a=gg();for(let e=0;e<o;e++){const{cell:n,startRow:r}=i[e];if(r+n.__rowSpan-1<=t){const t=i[e].cell.__headerState,n=Sg(t,tg);a.append(lg(n).append(No()))}else n.setRowSpan(n.__rowSpan+1)}const c=n.getChildAtIndex(t);pg(c)||ug(256),c.insertAfter(a),l=a}else{const e=s,t=r[e],i=gg();for(let n=0;n<o;n++){const{cell:r,startRow:o}=t[n];if(o===e){const e=t[n].cell.__headerState,r=Sg(e,tg);i.append(lg(r).append(No()))}else r.setRowSpan(r.__rowSpan+1)}const a=n.getChildAtIndex(e);pg(a)||ug(257),a.insertBefore(i),l=i}return l}function vg(e=!0){const t=Oi();pi(t)||Bg(t)||ug(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=Rg(n),[o,,s]=Rg(r),[,l,a]=Og(s,o,i),{startColumn:c}=a,{startColumn:u}=l;return e?kg(c+i.__colSpan>u+o.__colSpan?i:o,!0):kg(u<c?o:i,!1)}function kg(e,t=!0,n=!0){const[,,r]=Rg(e),[i,o]=Og(r,e,e),s=i.length,{startColumn:l}=o,a=t?l+e.__colSpan-1:l-1,c=r.getFirstChild();pg(c)||ug(120);let u=null;function d(e=ng){const t=lg(e).append(No());return null===u&&(u=t),t}let h=c;e:for(let e=0;e<s;e++){if(0!==e){const e=h.getNextSibling();pg(e)||ug(121),h=e}const t=i[e],n=t[a<0?0:a].cell.__headerState,r=Sg(n,rg);if(a<0){Tg(h,d(r));continue}const{cell:o,startColumn:s,startRow:l}=t[a];if(s+o.__colSpan-1<=a){let n=o,i=l,s=a;for(;i!==e&&n.__rowSpan>1;){if(s-=o.__colSpan,!(s>=0)){h.append(d(r));continue e}{const{cell:e,startRow:r}=t[s];n=e,i=r}}n.insertAfter(d(r))}else o.setColSpan(o.__colSpan+1)}null!==u&&n&&Eg(u);const g=r.getColWidths();if(g){const e=[...g],t=a<0?0:a,n=e[t];e.splice(t,0,n),r.setColWidths(e)}return u}function Eg(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function Tg(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function Ng(e){if(0===e.length)return null;const t=xg(e[0]),[n]=Fg(t,null,null);let r=1/0,i=-1/0,o=1/0,s=-1/0;const l=new Set;for(const t of n)for(const n of t){if(!n||!n.cell)continue;const t=n.cell.getKey();if(!l.has(t)&&e.some((e=>e.is(n.cell)))){l.add(t);const e=n.startRow,a=n.startColumn,c=n.cell.__rowSpan||1,u=n.cell.__colSpan||1;r=Math.min(r,e),i=Math.max(i,e+c-1),o=Math.min(o,a),s=Math.max(s,a+u-1)}}if(r===1/0||o===1/0)return null;const a=i-r+1,c=s-o+1,u=n[r][o];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const h=new Set([d.getKey()]);for(let e=r;e<=i;e++)for(let t=o;t<=s;t++){const r=n[e][t];if(!r.cell)continue;const i=r.cell,o=i.getKey();h.has(o)||(h.add(o),Ag(i)||d.append(...i.getChildren()),i.remove())}return 0===d.getChildrenSize()&&d.append(No()),d}function Ag(e){if(1!==e.getChildrenSize())return!1;const t=e.getFirstChildOrThrow();return!(!Ao(t)||!t.isEmpty())}function Lg(e){const[t,n,r]=Rg(e),i=t.__colSpan,o=t.__rowSpan;if(1===i&&1===o)return;const[s,l]=Og(r,t,t),{startColumn:a,startRow:c}=l,u=t.__headerState&tg,d=Array.from({length:i},((e,t)=>{let n=u;for(let e=0;0!==n&&e<s.length;e++)n&=s[e][t+a].cell.__headerState;return n})),h=t.__headerState&rg,g=Array.from({length:o},((e,t)=>{let n=h;for(let e=0;0!==n&&e<s[0].length;e++)n&=s[t+c][e].cell.__headerState;return n}));if(i>1){for(let e=1;e<i;e++)t.insertAfter(lg(d[e]|g[0]).append(No()));t.setColSpan(1)}if(o>1){let e;for(let t=1;t<o;t++){const r=c+t,o=s[r];e=(e||n).getNextSibling(),pg(e)||ug(125);let l=null;for(let e=0;e<a;e++){const t=o[e],n=t.cell;t.startRow===r&&(l=n),n.__colSpan>1&&(e+=n.__colSpan-1)}if(null===l)for(let n=i-1;n>=0;n--)Tg(e,lg(d[n]|g[t]).append(No()));else for(let e=i-1;e>=0;e--)l.insertAfter(lg(d[e]|g[t]).append(No()))}t.setRowSpan(1)}}function Og(e,t,n){const[r,i,o]=Fg(e,t,n);return null===i&&ug(207),null===o&&ug(208),[r,i,o]}function Fg(e,t,n){const r=[];let i=null,o=null;function s(e){let t=r[e];return void 0===t&&(r[e]=t=[]),t}const l=e.getChildren();for(let e=0;e<l.length;e++){const r=l[e];pg(r)||ug(209);const a=s(e);for(let c=r.getFirstChild(),u=0;null!=c;c=c.getNextSibling()){for(ag(c)||ug(147);void 0!==a[u];)u++;const r={cell:c,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:h}=c;for(let t=0;t<d&&!(e+t>=l.length);t++){const n=s(e+t);for(let e=0;e<h;e++)n[u+e]=r}null!==t&&null===i&&t.is(c)&&(i=r),null!==n&&null===o&&n.is(c)&&(o=r)}}return[r,i,o]}function Rg(e){let t;if(e instanceof ig)t=e;else if("__type"in e){const n=gl(e,ag);ag(n)||ug(148),t=n}else{const n=gl(e.getNode(),ag);ag(n)||ug(148),t=n}const n=t.getParent();pg(n)||ug(149);const r=n.getParent();return Np(r)||ug(210),[t,n,r]}function Ig(e,t,n){let r,i=Math.min(t.startColumn,n.startColumn),o=Math.min(t.startRow,n.startRow),s=Math.max(t.startColumn+t.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),l=Math.max(t.startRow+t.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{r=!1;for(let t=0;t<e.length;t++)for(let n=0;n<e[0].length;n++){const a=e[t][n];if(!a)continue;const c=a.startColumn+a.cell.__colSpan-1,u=a.startRow+a.cell.__rowSpan-1,d=a.startColumn<=s&&c>=i,h=a.startRow<=l&&u>=o;if(d&&h){const e=Math.min(i,a.startColumn),t=Math.max(s,c),n=Math.min(o,a.startRow),d=Math.max(l,u);e===i&&t===s&&n===o&&d===l||(i=e,s=t,o=n,l=d,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:i,minRow:o}}function Pg(e){const[t,,n]=Rg(e),r=n.getChildren(),i=r.length,o=r[0].getChildren().length,s=new Array(i);for(let e=0;e<i;e++)s[e]=new Array(o);for(let e=0;e<i;e++){const n=r[e].getChildren();let i=0;for(let r=0;r<n.length;r++){for(;s[e][i];)i++;const o=n[r],l=o.__rowSpan||1,a=o.__colSpan||1;for(let t=0;t<l;t++)for(let n=0;n<a;n++)s[e+t][i+n]=o;if(t===o)return{colSpan:a,columnIndex:i,rowIndex:e,rowSpan:l};i+=a}}return null}function Mg(e){const[[t,n,r,i],[o,s,l,a]]=["anchor","focus"].map((t=>{const n=e[t].getNode(),r=gl(n,ag);ag(r)||ug(238,t,n.getKey(),n.getType());const i=r.getParent();pg(i)||ug(239,t);const o=i.getParent();return Np(o)||ug(240,t),[n,r,i,o]}));return i.is(a)||ug(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:i,focusCell:s,focusNode:o,focusRow:l,focusTable:a}}class Dg{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if("root"===this.tableKey||"root"===this.anchor.key||"element"!==this.anchor.type||"root"===this.focus.key||"element"!==this.focus.type)return!1;const e=os(this.tableKey),t=os(this.anchor.key),n=os(this.focus.key);return null!==e&&null!==t&&null!==n}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Bg(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new Dg(this.tableKey,ui(this.anchor.key,this.anchor.offset,this.anchor.type),ui(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(ag).forEach((e=>{const n=e.getFirstChild();Ao(n)&&(t|=n.getTextFormat())}));return 0!==(t&Ue[e])}insertNodes(e){const t=this.focus.getNode();fo(t)||ug(151),wt(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Mg(this),n=Pg(e);null===n&&ug(153);const r=Pg(t);null===r&&ug(155);const i=Math.min(n.columnIndex,r.columnIndex),o=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),s=Math.min(n.rowIndex,r.rowIndex),l=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,o),fromY:Math.min(s,l),toX:Math.max(i,o),toY:Math.max(s,l)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(null!==e)return e;const{anchorTable:t,anchorCell:n,focusCell:r}=Mg(this),i=r.getParents()[1];if(i!==t){if(t.isParentOf(r)){const e=i.getParent();null==e&&ug(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{const e=t.getParent();null==e&&ug(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}const[o,s,l]=Og(t,n,r),{minColumn:a,maxColumn:c,minRow:u,maxRow:d}=Ig(o,s,l),h=new Map([[t.getKey(),t]]);let g=null;for(let e=u;e<=d;e++)for(let t=a;t<=c;t++){const{cell:n}=o[e][t],r=n.getParent();pg(r)||ug(160),r!==g&&(h.set(r.getKey(),r),g=r),h.has(n.getKey())||$g(n,(e=>{h.set(e.getKey(),e)}))}const p=Array.from(h.values());return Gi()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter((e=>ag(e)));let t="";for(let n=0;n<e.length;n++){const r=e[n],i=r.__parent,o=(e[n+1]||{}).__parent;t+=r.getTextContent()+(o!==i?"\n":"\t")}return t}}function Bg(e){return e instanceof Dg}function zg(){const e=ui("root",0,"element"),t=ui("root",0,"element");return new Dg("root",e,t)}function $g(e,t){const n=[[e]];for(let e=n.at(-1);void 0!==e&&n.length>0;e=n.at(-1)){const r=e.pop();void 0===r?n.pop():!1!==t(r)&&fo(r)&&n.push(r.getChildren())}}function Hg(e,t=il()){const n=os(e);Np(n)||ug(231,e);const r=Vg(n,t.getElementByKey(e));return null===r&&ug(232,e),{tableElement:r,tableNode:n}}class Kg{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;shouldCheckSelection;abortController;listenerOptions;nextFocus;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.nextFocus=null,this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Hg(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver((e=>{this.editor.getEditorState().read((()=>{let t=!1;for(let n=0;n<e.length;n++){const r=e[n].target.nodeName;if("TABLE"===r||"TBODY"===r||"THEAD"===r||"TR"===r){t=!0;break}}if(!t)return;const{tableNode:n,tableElement:r}=this.$lookup();this.table=tp(n,r)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{const{tableNode:t,tableElement:n}=this.$lookup();this.table=tp(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();const{tableNode:t,tableElement:n}=this.$lookup();np(e,tp(t,n),null),null!==Oi()&&(gs(null),e.dispatchCommand(sn,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();qa(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();ja(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(null!==e){e.tableKey!==this.tableNodeKey&&ug(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),np(t,this.table,this.tableSelection)}else this.$clearHighlight()}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return!!this.shouldCheckSelection&&(this.shouldCheckSelection=!1,!0)}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return null!==e&&(this.nextFocus=null),e}updateDOMSelection(){if(null!==this.anchorCell&&null!==this.focusCell){const e=Zs(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const n=this.editor,{tableNode:r}=this.$lookup(),i=e.x,o=e.y;if(this.focusCell=e,this.isHighlightingCells||this.anchorX===i&&this.anchorY===o&&!t){if(i===this.focusX&&o===this.focusY)return!1}else this.isHighlightingCells=!0,this.$disableHighlightStyle();if(this.focusX=i,this.focusY=o,this.isHighlightingCells){const t=xp(r,e.elem);if(null!=this.tableSelection&&null!=this.anchorCellNodeKey&&null!==t)return this.focusCellNodeKey=t.getKey(),this.tableSelection=function(e,t,n){e.getKey(),t.getKey(),n.getKey();const r=Oi(),i=Bg(r)?r.clone():zg();return i.set(e.getKey(),t.getKey(),n.getKey()),i}(r,this.$getAnchorTableCellOrThrow(),t),gs(this.tableSelection),n.dispatchCommand(sn,void 0),np(n,this.table,this.tableSelection),!0}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?os(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return null===e&&ug(234),e}$getFocusTableCell(){return this.focusCellNodeKey?os(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return null===e&&ug(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y;const{tableNode:t}=this.$lookup(),n=xp(t,e.elem);if(null!==n){const e=n.getKey();this.tableSelection=null!=this.tableSelection?this.tableSelection.clone():zg(),this.anchorCellNodeKey=e}}$formatCells(e){const t=Oi();Bg(t)||ug(236);const n=Ni(),r=n.anchor,i=n.focus,o=t.getNodes().filter(ag);o.length>0||ug(237);const s=o[0].getFirstChild(),l=Ao(s)?s.getFormatFlags(e,null):null;o.forEach((t=>{r.set(t.getKey(),0,"element"),i.set(t.getKey(),t.getChildrenSize(),"element"),n.formatText(e,l)})),gs(t),this.editor.dispatchCommand(sn,void 0)}$clearText(){const{editor:e}=this,t=os(this.tableNodeKey);if(!Np(t))throw new Error("Expected TableNode.");const n=Oi();Bg(n)||ug(253);const r=n.getNodes().filter(ag),i=t.getFirstChild(),o=t.getLastChild();if(r.length>0&&null!==i&&null!==o&&pg(i)&&pg(o)&&r[0]===i.getFirstChild()&&r[r.length-1]===o.getLastChild()){t.selectPrevious();const n=t.getParent();return t.remove(),void(xo(n)&&n.isEmpty()&&e.dispatchCommand(dn,void 0))}r.forEach((e=>{if(fo(e)){const t=No(),n=ri();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),np(e,this.table,null),gs(null),e.dispatchCommand(sn,void 0)}}const Ug="__lexicalTableSelection";function Wg(e){return Xs(e)&&"TABLE"===e.nodeName}function Vg(e,t){if(!t)return t;const n=Wg(t)?t:e.getDOMSlot(t).element;return"TABLE"!==n.nodeName&&ug(245,t.nodeName),n}function jg(e){return e._window}function qg(e,t){for(let n=t,r=null;null!==n;n=n.getParent()){if(e.is(n))return r;ag(n)&&(r=n)}return null}const Gg=[[En,"down"],[kn,"up"],[wn,"backward"],[Sn,"forward"]],Jg=[fn,mn,cn],Zg=[An,On];function Yg(e,t,n,r){const i=n.getRootElement(),o=jg(n);null!==i&&null!==o||ug(246);const s=new Kg(n,e.getKey()),l=Vg(e,t);!function(e,t){null!==Xg(e)&&ug(205),e[Ug]=t}(l,s),s.listenersToRemove.add((()=>function(e,t){Xg(e)===t&&delete e[Ug]}(l,s)));const a=t=>{if(s.pointerType=t.pointerType,0!==t.button||!Qs(t.target)||!o)return;const r=Qg(t.target);null!==r&&n.update((()=>{const n=Fi();if(yg&&t.shiftKey&&cp(n,e)&&(pi(n)||Bg(n))){const i=n.anchor.getNode(),o=qg(e,n.anchor.getNode());o?(s.$setAnchorCellForSelection(_p(s,o)),s.$setFocusCellForSelection(r),mp(t)):(e.isBefore(i)?e.selectStart():e.selectEnd()).anchor.set(n.anchor.key,n.anchor.offset,n.anchor.type)}else"touch"!==t.pointerType&&s.$setAnchorCellForSelection(r)})),(()=>{if(s.isSelecting)return;const e=()=>{s.isSelecting=!1,o.removeEventListener("pointerup",e),o.removeEventListener("pointermove",t)},t=r=>{if(1&~r.buttons&&s.isSelecting)return s.isSelecting=!1,o.removeEventListener("pointerup",e),void o.removeEventListener("pointermove",t);if(!Qs(r.target))return;let i=null;const a=!(yg||l.contains(r.target));if(a)i=ep(l,r.target);else for(const e of document.elementsFromPoint(r.clientX,r.clientY))if(i=ep(l,e),i)break;!i||null!==s.focusCell&&i.elem===s.focusCell.elem||(s.setNextFocus({focusCell:i,override:a}),n.dispatchCommand(sn,void 0))};s.isSelecting=!0,o.addEventListener("pointerup",e,s.listenerOptions),o.addEventListener("pointermove",t,s.listenerOptions)})()};l.addEventListener("pointerdown",a,s.listenerOptions),s.listenersToRemove.add((()=>{l.removeEventListener("pointerdown",a)}));const c=e=>{e.detail>=3&&Qs(e.target)&&null!==Qg(e.target)&&e.preventDefault()};l.addEventListener("mousedown",c,s.listenerOptions),s.listenersToRemove.add((()=>{l.removeEventListener("mousedown",c)}));const u=e=>{const t=e.target;0===e.button&&Qs(t)&&n.update((()=>{const e=Oi();Bg(e)&&e.tableKey===s.tableNodeKey&&i.contains(t)&&s.$clearHighlight()}))};o.addEventListener("pointerdown",u,s.listenerOptions),s.listenersToRemove.add((()=>{o.removeEventListener("pointerdown",u)}));for(const[t,r]of Gg)s.listenersToRemove.add(n.registerCommand(t,(t=>fp(n,t,r,e,s)),3));s.listenersToRemove.add(n.registerCommand(Ln,(t=>{const n=Oi();if(Bg(n)){const r=qg(e,n.focus.getNode());if(null!==r)return mp(t),r.selectEnd(),!0}return!1}),3));const d=t=>()=>{const n=Oi();if(!cp(n,e))return!1;if(Bg(n))return s.$clearText(),!0;if(pi(n)){if(!ag(qg(e,n.anchor.getNode())))return!1;const r=n.anchor.getNode(),i=n.focus.getNode(),o=e.isParentOf(r),l=e.isParentOf(i);if(o&&!l||l&&!o)return s.$clearText(),!0;const a=gl(n.anchor.getNode(),(e=>fo(e))),c=a&&gl(a,(e=>fo(e)&&ag(e.getParent())));if(!fo(c)||!fo(a))return!1;if(t===mn&&null===c.getPreviousSibling())return!0}return!1};for(const e of Jg)s.listenersToRemove.add(n.registerCommand(e,d(e),3));const h=t=>{const n=Oi();if(!Bg(n)&&!pi(n))return!1;const r=e.isParentOf(n.anchor.getNode());if(r!==e.isParentOf(n.focus.getNode())){const t=r?"anchor":"focus",i=r?"focus":"anchor",{key:o,offset:s,type:l}=n[i];return e[n[t].isBefore(n[i])?"selectPrevious":"selectNext"]()[i].set(o,s,l),!1}return!!cp(n,e)&&!!Bg(n)&&(t&&(t.preventDefault(),t.stopPropagation()),s.$clearText(),!0)};for(const e of Zg)s.listenersToRemove.add(n.registerCommand(e,h,3));return s.listenersToRemove.add(n.registerCommand(Kn,(e=>{const t=Oi();if(t){if(!Bg(t)&&!pi(t))return!1;Ku(n,Ya(e,ClipboardEvent)?e:null,Vu(t));const r=h(e);return pi(t)?(t.removeText(),!0):r}return!1}),3)),s.listenersToRemove.add(n.registerCommand(yn,(t=>{const n=Oi();if(!cp(n,e))return!1;if(Bg(n))return s.$formatCells(t),!0;if(pi(n)){const e=gl(n.anchor.getNode(),(e=>ag(e)));if(!ag(e))return!1}return!1}),3)),s.listenersToRemove.add(n.registerCommand(Dn,(t=>{const n=Oi();if(!Bg(n)||!cp(n,e))return!1;const r=n.anchor.getNode(),i=n.focus.getNode();if(!ag(r)||!ag(i))return!1;if(function(e,t){if(Bg(e)){const n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){const[e]=Og(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(n,e))return e.setFormat(t),!0;const[o,s,l]=Og(e,r,i),a=Math.max(s.startRow+s.cell.__rowSpan-1,l.startRow+l.cell.__rowSpan-1),c=Math.max(s.startColumn+s.cell.__colSpan-1,l.startColumn+l.cell.__colSpan-1),u=Math.min(s.startRow,l.startRow),d=Math.min(s.startColumn,l.startColumn),h=new Set;for(let e=u;e<=a;e++)for(let n=d;n<=c;n++){const r=o[e][n].cell;if(h.has(r))continue;h.add(r),r.setFormat(t);const i=r.getChildren();for(let e=0;e<i.length;e++){const n=i[e];fo(n)&&!n.isInline()&&n.setFormat(t)}}return!0}),3)),s.listenersToRemove.add(n.registerCommand(hn,(t=>{const r=Oi();if(!cp(r,e))return!1;if(Bg(r))return s.$clearHighlight(),!1;if(pi(r)){const i=gl(r.anchor.getNode(),(e=>ag(e)));if(!ag(i))return!1;if("string"==typeof t){const i=bp(n,r,e);if(i)return yp(i,e,[ri(t)]),!0}}return!1}),3)),r&&s.listenersToRemove.add(n.registerCommand(Fn,(t=>{const n=Oi();if(!pi(n)||!n.isCollapsed()||!cp(n,e))return!1;const r=gp(n.anchor.getNode());return!(null===r||!e.is(pp(r))||(mp(t),function(e,t){const n="next"===t?"getNextSibling":"getPreviousSibling",r="next"===t?"getFirstChild":"getLastChild",i=e[n]();if(fo(i))return i.selectEnd();const o=gl(e,pg);null===o&&ug(247);for(let e=o[n]();pg(e);e=e[n]()){const t=e[r]();if(fo(t))return t.selectEnd()}const s=gl(o,Np);null===s&&ug(248),"next"===t?s.selectNext():s.selectPrevious()}(r,t.shiftKey?"previous":"next"),0))}),3)),s.listenersToRemove.add(n.registerCommand(Gn,(t=>e.isSelected()),3)),s.listenersToRemove.add(n.registerCommand(ln,((e,t)=>{if(n!==t)return!1;const{nodes:r,selection:i}=e,o=i.getStartEndPoints(),s=Bg(i),l=pi(i)&&null!==gl(i.anchor.getNode(),(e=>ag(e)))&&null!==gl(i.focus.getNode(),(e=>ag(e)))||s;if(1!==r.length||!Np(r[0])||!l||null===o)return!1;const[a,c]=o,[u,d,h]=Rg(a),g=gl(c.getNode(),(e=>ag(e)));if(!(ag(u)&&ag(g)&&pg(d)&&Np(h)))return!1;const p=r[0],[f,m,y]=Og(h,u,g),[b]=Fg(p,null,null),_=f.length,x=_>0?f[0].length:0;let S=m.startRow,C=m.startColumn,w=b.length,v=w>0?b[0].length:0;if(s){const e=Ig(f,m,y),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;S=e.minRow,C=e.minColumn,w=Math.min(w,t),v=Math.min(v,n)}let k=!1;const E=Math.min(_,S+w)-1,T=Math.min(x,C+v)-1,N=new Set;for(let e=S;e<=E;e++)for(let t=C;t<=T;t++){const n=f[e][t];N.has(n.cell.getKey())||1===n.cell.__rowSpan&&1===n.cell.__colSpan||(Lg(n.cell),N.add(n.cell.getKey()),k=!0)}let[A]=Fg(h.getWritable(),null,null);const L=w-_+S;for(let e=0;e<L;e++)wg(A[_-1][0].cell);const O=v-x+C;for(let e=0;e<O;e++)kg(A[0][x-1].cell,!0,!1);[A]=Fg(h.getWritable(),null,null);for(let e=S;e<S+w;e++)for(let t=C;t<C+v;t++){const n=e-S,r=t-C,i=b[n][r];if(i.startRow!==n||i.startColumn!==r)continue;const o=i.cell;if(1!==o.__rowSpan||1!==o.__colSpan){const n=[],r=Math.min(e+o.__rowSpan,S+w)-1,i=Math.min(t+o.__colSpan,C+v)-1;for(let o=e;o<=r;o++)for(let e=t;e<=i;e++){const t=A[o][e];n.push(t.cell)}Ng(n),k=!0}const{cell:s}=A[e][t],l=s.getChildren();o.getChildren().forEach((e=>{ii(e)?(No().append(e),s.append(e)):s.append(e)})),l.forEach((e=>e.remove()))}if(s&&k){const[e]=Fg(h.getWritable(),null,null);e[m.startRow][m.startColumn].cell.selectEnd()}return!0}),3)),s.listenersToRemove.add(n.registerCommand(sn,(()=>{const t=Oi(),r=Fi(),i=s.getAndClearNextFocus();if(null!==i){const{focusCell:n}=i;if(Bg(t)&&t.tableKey===s.tableNodeKey)return(n.x!==s.focusX||n.y!==s.focusY)&&(s.$setFocusCellForSelection(n),!0);if(n!==s.anchorCell&&cp(t,e))return s.$setFocusCellForSelection(n),!0}if(s.getAndClearShouldCheckSelection()&&pi(r)&&pi(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=e.getFirstChild(),i=gp(n);if(null!==i&&pg(r)){const t=r.getFirstChild();if(ag(t)&&e.is(gl(i,(n=>n.is(e)||n.is(t)))))return t.selectStart(),!0}}if(pi(t)){const{anchor:i,focus:o}=t,l=i.getNode(),a=o.getNode(),c=gp(l),u=gp(a),d=!(!c||!e.is(pp(c))),h=!(!u||!e.is(pp(u))),g=d!==h,p=d&&h,f=t.isBackward();if(g){const r=t.clone();if(h){const[t]=Og(e,u,u),n=t[0][0].cell,i=t[t.length-1].at(-1).cell;r.focus.set(f?n.getKey():i.getKey(),f?n.getChildrenSize():i.getChildrenSize(),"element")}else if(d){const[t]=Og(e,c,c),n=t[0][0].cell,i=t[t.length-1].at(-1).cell;r.anchor.set(f?i.getKey():n.getKey(),f?i.getChildrenSize():0,"element")}gs(r),ip(n,s)}else if(p&&(c.is(u)||(s.$setAnchorCellForSelection(_p(s,c)),s.$setFocusCellForSelection(_p(s,u),!0)),"touch"===s.pointerType&&s.isSelecting&&t.isCollapsed()&&pi(r)&&r.isCollapsed())){const e=gp(r.anchor.getNode());e&&!e.is(u)&&(s.$setAnchorCellForSelection(_p(s,e)),s.$setFocusCellForSelection(_p(s,u),!0),s.pointerType=null)}}else if(t&&Bg(t)&&t.is(r)&&t.tableKey===e.getKey()){const r=Zs(o);if(r&&r.anchorNode&&r.focusNode){const i=as(r.focusNode),o=i&&!e.isParentOf(i),s=as(r.anchorNode),l=s&&e.isParentOf(s);if(o&&l&&r.rangeCount>0){const i=function(e,t){return Li(null,e,t,null)}(r,n);i&&(i.anchor.set(e.getKey(),t.isBackward()?e.getChildrenSize():0,"element"),r.removeAllRanges(),gs(i))}}}return t&&!t.is(r)&&(Bg(t)||Bg(r))&&s.tableSelection&&!s.tableSelection.is(r)?(Bg(t)&&t.tableKey===s.tableNodeKey?s.$updateTableTableSelection(t):!Bg(t)&&Bg(r)&&r.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!e.isSelected()?function(e,t){t.$enableHighlightStyle(),rp(t.table,(t=>{const n=t.elem;t.highlighted=!1,hp(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(n,s):!s.hasHijackedSelectionStyles&&e.isSelected()&&ip(n,s),!1)}),3)),s.listenersToRemove.add(n.registerCommand(dn,(()=>{const t=Oi();if(!pi(t)||!t.isCollapsed()||!cp(t,e))return!1;const r=bp(n,t,e);return!!r&&(yp(r,e),!0)}),3)),s}function Xg(e){return e[Ug]||null}function Qg(e){let t=e;for(;null!=t;){const e=t.nodeName;if("TD"===e||"TH"===e){const e=t._cell;return void 0===e?null:e}t=t.parentNode}return null}function ep(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;null!=r;r=r.parentNode){if(r===e)return n;const t=r.nodeName;"TD"!==t&&"TH"!==t||(n=r._cell||null)}return null}function tp(e,t){const n=[],r={columns:0,domRows:n,rows:0};let i=Vg(e,t).querySelector("tr"),o=0,s=0;for(n.length=0;null!=i;){const e=i.nodeName;if("TD"===e||"TH"===e){const e={elem:i,hasBackgroundColor:""!==i.style.backgroundColor,highlighted:!1,x:o,y:s};i._cell=e;let t=n[s];void 0===t&&(t=n[s]=[]),t[o]=e}else{const e=i.firstChild;if(null!=e){i=e;continue}}const t=i.nextSibling;if(null!=t){o++,i=t;continue}const r=i.parentNode;if(null!=r){const e=r.nextSibling;if(null==e)break;s++,o=0,i=e}}return r.columns=o+1,r.rows=s+1,r}function np(e,t,n){const r=new Set(n?n.getNodes():[]);rp(t,((t,n)=>{const i=t.elem;r.has(n)?(t.highlighted=!0,dp(e,t)):(t.highlighted=!1,hp(e,t),i.getAttribute("style")||i.removeAttribute("style"))}))}function rp(e,t){const{domRows:n}=e;for(let e=0;e<n.length;e++){const r=n[e];if(r)for(let n=0;n<r.length;n++){const i=r[n];if(!i)continue;const o=as(i.elem);null!==o&&t(i,o,{x:n,y:e})}}}function ip(e,t){t.$disableHighlightStyle(),rp(t.table,(t=>{t.highlighted=!0,dp(e,t)}))}const op=(e,t,n,r,i)=>{const o="forward"===i;switch(i){case"backward":case"forward":return n!==(o?e.table.columns-1:0)?up(t.getCellNodeFromCordsOrThrow(n+(o?1:-1),r,e.table),o):r!==(o?e.table.rows-1:0)?up(t.getCellNodeFromCordsOrThrow(o?0:e.table.columns-1,r+(o?1:-1),e.table),o):o?t.selectNext():t.selectPrevious(),!0;case"up":return 0!==r?up(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1):t.selectPrevious(),!0;case"down":return r!==e.table.rows-1?up(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0):t.selectNext(),!0;default:return!1}};function sp(e,t){let n,r;if(t.startColumn===e.minColumn)n="minColumn";else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n="maxColumn"}if(t.startRow===e.minRow)r="minRow";else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r="maxRow"}return[n,r]}function lp([e,t]){return["minColumn"===e?"maxColumn":"minColumn","minRow"===t?"maxRow":"minRow"]}function ap(e,t,[n,r]){const i=t[r],o=e[i];void 0===o&&ug(250,r,String(i));const s=t[n],l=o[s];return void 0===l&&ug(250,n,String(s)),l}function cp(e,t){if(pi(e)||Bg(e)){const n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function up(e,t){t?e.selectStart():e.selectEnd()}function dp(e,t){const n=t.elem,r=e._config.theme;ag(as(n))||ug(131),ja(n,r.tableCellSelected)}function hp(e,t){const n=t.elem;ag(as(n))||ug(131);qa(n,e._config.theme.tableCellSelected)}function gp(e){const t=gl(e,ag);return ag(t)?t:null}function pp(e){const t=gl(e,Np);return Np(t)?t:null}function fp(e,t,n,r,i){if(("up"===n||"down"===n)&&function(e){const t=e.getRootElement();return!!t&&(t.hasAttribute("aria-controls")&&"typeahead-menu"===t.getAttribute("aria-controls"))}(e))return!1;const o=Oi();if(!cp(o,r)){if(pi(o)){if("backward"===n){if(o.focus.offset>0)return!1;const e=function(e){for(let t=e,n=e;null!==n;t=n,n=n.getParent())if(fo(n)){if(n!==t&&n.getFirstChild()!==t)return null;if(!n.isInline())return n}return null}(o.focus.getNode());if(!e)return!1;const n=e.getPreviousSibling();return!!Np(n)&&(mp(t),t.shiftKey?o.focus.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent(),"element"):n.selectEnd(),!0)}if(t.shiftKey&&("up"===n||"down"===n)){const e=o.focus.getNode();if(!o.isCollapsed()&&("up"===n&&!o.isBackward()||"down"===n&&o.isBackward())){let i=gl(e,(e=>Np(e)));if(ag(i)&&(i=gl(i,Np)),i!==r)return!1;if(!i)return!1;const s="down"===n?i.getNextSibling():i.getPreviousSibling();if(!s)return!1;let l=0;"up"===n&&fo(s)&&(l=s.getChildrenSize());let a=s;if("up"===n&&fo(s)){a=s.getLastChild()||s,l=ii(a)?a.getTextContentSize():0}const c=o.clone();return c.focus.set(a.getKey(),l,ii(a)?"text":"element"),gs(c),mp(t),!0}if(Ws(e)){const e="up"===n?o.getNodes()[o.getNodes().length-1]:o.getNodes()[0];if(e&&null!==qg(r,e)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=Rg(e),[o]=Rg(t),s=r.getCordsFromCellNode(n,i.table),l=r.getCordsFromCellNode(o,i.table),a=r.getDOMCellFromCordsOrThrow(s.x,s.y,i.table),c=r.getDOMCellFromCordsOrThrow(l.x,l.y,i.table);return i.$setAnchorCellForSelection(a),i.$setFocusCellForSelection(c,!0),!0}return!1}{let r=gl(e,(e=>fo(e)&&!e.isInline()));if(ag(r)&&(r=gl(r,Np)),!r)return!1;const s="down"===n?r.getNextSibling():r.getPreviousSibling();if(Np(s)&&i.tableNodeKey===s.getKey()){const e=s.getFirstDescendant(),r=s.getLastDescendant();if(!e||!r)return!1;const[i]=Rg(e),[l]=Rg(r),a=o.clone();return a.focus.set(("up"===n?i:l).getKey(),"up"===n?0:l.getChildrenSize(),"element"),mp(t),gs(a),!0}}}}return"down"===n&&wp(e)&&i.setShouldCheckSelection(),!1}if(pi(o)){if("backward"===n||"forward"===n)return function(e,t,n,r,i,o,s){const l=Vl(n.focus,i?"previous":"next");if(ta(l))return!1;let a=l;for(const e of Ml(l).iterNodeCarets("shadowRoot")){if(!wl(e)||!fo(e.origin))return!1;a=e}const c=a.getParentAtCaret();if(!ag(c))return!1;const u=c,d=function(e){for(const t of Ml(e).iterNodeCarets("root")){const{origin:n}=t;if(ag(n)){if(vl(t))return Fl(n,e.direction)}else if(!pg(n))break}return null}(Nl(u,a.direction)),h=gl(u,Np);if(!h||!h.is(o))return!1;const g=e.getElementByKey(u.getKey()),p=Qg(g);if(!g||!p)return!1;const f=kp(e,h);if(s.table=f,d)if("extend"===r){const t=Qg(e.getElementByKey(d.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(t,!0)}else{const e=ea(d);jl(n.anchor,e),jl(n.focus,e)}else if("extend"===r)s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(p,!0);else{const e=function(e){const t=Rl(e);return vl(t)?ea(t):e}(Nl(h,l.direction));jl(n.anchor,e),jl(n.focus,e)}return mp(t),!0}(e,t,o,t.shiftKey?"extend":"move","backward"===n,r,i);if(o.isCollapsed()){const{anchor:s,focus:l}=o,a=gl(s.getNode(),ag),c=gl(l.getNode(),ag);if(!ag(a)||!a.is(c))return!1;const u=pp(a);if(u!==r&&null!=u){const r=Vg(u,e.getElementByKey(u.getKey()));if(null!=r)return i.table=tp(u,r),fp(e,t,n,u,i)}const d=e.getElementByKey(a.__key),h=e.getElementByKey(s.key);if(null==h||null==d)return!1;let g;if("element"===s.type)g=h.getBoundingClientRect();else{const t=Zs(jg(e));if(null===t||0===t.rangeCount)return!1;g=t.getRangeAt(0).getBoundingClientRect()}const p="up"===n?a.getFirstChild():a.getLastChild();if(null==p)return!1;const f=e.getElementByKey(p.__key);if(null==f)return!1;const m=f.getBoundingClientRect();if("up"===n?m.top>g.top-g.height:g.bottom+g.height>m.bottom){mp(t);const e=r.getCordsFromCellNode(a,i.table);if(!t.shiftKey)return op(i,r,e.x,e.y,n);{const t=r.getDOMCellFromCordsOrThrow(e.x,e.y,i.table);i.$setAnchorCellForSelection(t),i.$setFocusCellForSelection(t,!0)}return!0}}}else if(Bg(o)){const{anchor:s,focus:l}=o,a=gl(s.getNode(),ag),c=gl(l.getNode(),ag),[u]=o.getNodes();Np(u)||ug(251);const d=Vg(u,e.getElementByKey(u.getKey()));if(!ag(a)||!ag(c)||!Np(u)||null==d)return!1;i.$updateTableTableSelection(o);const h=tp(u,d),g=r.getCordsFromCellNode(a,h),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,h);if(i.$setAnchorCellForSelection(p),mp(t),t.shiftKey){const[e,t,o]=Og(r,a,c);return function(e,t,n,r,i){const o=Ig(t,n,r),s=function(e,t){const{minColumn:n,maxColumn:r,minRow:i,maxRow:o}=t;let s=1,l=1,a=1,c=1;const u=e[i],d=e[o];for(let e=n;e<=r;e++)s=Math.max(s,u[e].cell.__rowSpan),c=Math.max(c,d[e].cell.__rowSpan);for(let t=i;t<=o;t++)l=Math.max(l,e[t][n].cell.__colSpan),a=Math.max(a,e[t][r].cell.__colSpan);return{bottomSpan:c,leftSpan:l,rightSpan:a,topSpan:s}}(t,o),{topSpan:l,leftSpan:a,bottomSpan:c,rightSpan:u}=s,d=function(e,t){const n=sp(e,t);return null===n&&ug(249,t.cell.getKey()),n}(o,n),[h,g]=lp(d);let p=o[h],f=o[g];"forward"===i?p+="maxColumn"===h?1:a:"backward"===i?p-="minColumn"===h?1:u:"down"===i?f+="maxRow"===g?1:l:"up"===i&&(f-="minRow"===g?1:c);const m=t[f];if(void 0===m)return!1;const y=m[p];if(void 0===y)return!1;const[b,_]=function(e,t,n){const r=Ig(e,t,n),i=sp(r,t);if(i)return[ap(e,r,i),ap(e,r,lp(i))];const o=sp(r,n);if(o)return[ap(e,r,lp(o)),ap(e,r,o)];const s=["minColumn","minRow"];return[ap(e,r,s),ap(e,r,lp(s))]}(t,n,y),x=_p(e,b.cell),S=_p(e,_.cell);return e.$setAnchorCellForSelection(x),e.$setFocusCellForSelection(S,!0),!0}(i,e,t,o,n)}return c.selectEnd(),!0}return!1}function mp(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function yp(e,t,n){const r=No();"first"===e?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function bp(e,t,n){const r=n.getParent();if(!r)return;const i=Zs(jg(e));if(!i)return;const o=i.anchorNode,s=e.getElementByKey(r.getKey()),l=Vg(n,e.getElementByKey(n.getKey()));if(!o||!s||!l||!s.contains(o)||l.contains(o))return;const a=gl(t.anchor.getNode(),(e=>ag(e)));if(!a)return;const c=gl(a,(e=>Np(e)));if(!Np(c)||!c.is(n))return;const[u,d]=Og(n,a,a),h=u[0][0],g=u[u.length-1][u[0].length-1],{startRow:p,startColumn:f}=d,m=p===h.startRow&&f===h.startColumn,y=p===g.startRow&&f===g.startColumn;return m?"first":y?"last":void 0}function _p(e,t){const{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function xp(e,t,n){return qg(e,as(t,n))}function Sp(e,t,n){if(!t.theme.tableAlignment)return;const r=[],i=[];for(const e of["center","right"]){const o=t.theme.tableAlignment[e];o&&(e===n?i:r).push(o)}qa(e,...r),ja(e,...i)}const Cp=new WeakSet;function wp(e=il()){return Cp.has(e)}class vp extends po{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new vp(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Ep,priority:1})}}static importJSON(e){return Tp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return"html"===n}getDOMSlot(e){const t=Wg(e)?e:e.querySelector("table");return Wg(t)||ug(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const n=document.createElement("table");this.__style&&(n.style.cssText=this.__style);const r=document.createElement("colgroup");if(n.appendChild(r),function(e){e.__lexicalUnmanaged=!0}(r),ja(n,e.theme.table),this.updateTableElement(null,n,e),wp(t)){const t=document.createElement("div"),r=e.theme.tableScrollableWrapper;return r?ja(t,r):t.style.cssText="overflow-x: auto;",t.appendChild(n),this.updateTableWrapper(null,t,n,e),t}return n}updateTableWrapper(e,t,n,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,t,n,r){r>0?(ja(e,n.theme.tableFrozenColumn),t.setAttribute("data-lexical-frozen-column","true")):(qa(e,n.theme.tableFrozenColumn),t.removeAttribute("data-lexical-frozen-column"))}(t,n,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,t,n,r){r>0?(ja(e,n.theme.tableFrozenRow),t.setAttribute("data-lexical-frozen-row","true")):(qa(e,n.theme.tableFrozenRow),t.removeAttribute("data-lexical-frozen-row"))}(t,n,r,this.__frozenRowCount)}updateTableElement(e,t,n){this.__style!==(e?e.__style:"")&&(t.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,t,n){n?(ja(e,t.theme.tableRowStriping),e.setAttribute("data-lexical-row-striping","true")):(qa(e,t.theme.tableRowStriping),e.removeAttribute("data-lexical-row-striping"))}(t,n,this.__rowStriping),function(e,t,n,r){const i=e.querySelector("colgroup");if(!i)return;const o=[];for(let e=0;e<n;e++){const t=document.createElement("col"),n=r&&r[e];n&&(t.style.width=`${n}px`),o.push(t)}i.replaceChildren(...o)}(t,0,this.getColumnCount(),this.getColWidths()),Sp(t,n,this.getFormatType())}updateDOM(e,t,n){const r=this.getDOMSlot(t).element;return t===r===wp()||(Xs(i=t)&&"DIV"===i.nodeName&&this.updateTableWrapper(e,t,r,n),this.updateTableElement(e,r,n),!1);var i}exportDOM(e){const t=super.exportDOM(e),{element:n}=t;return{after:n=>{if(t.after&&(n=t.after(n)),!Wg(n)&&Xs(n)&&(n=n.querySelector("table")),!Wg(n))return null;Sp(n,e._config,this.getFormatType());const[r]=Fg(this,null,null),i=new Map;for(const e of r)for(const t of e){const e=t.cell.getKey();i.has(e)||i.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}const o=new Set;for(const e of n.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const t=e.getAttribute("data-temporary-table-cell-lexical-key");if(t){const n=i.get(t);if(e.removeAttribute("data-temporary-table-cell-lexical-key"),n){i.delete(t);for(let e=0;e<n.colSpan;e++)o.add(e+n.startColumn)}}}const s=n.querySelector(":scope > colgroup");if(s){const e=Array.from(n.querySelectorAll(":scope > colgroup > col")).filter(((e,t)=>o.has(t)));s.replaceChildren(...e)}const l=n.querySelectorAll(":scope > tr");if(l.length>0){const e=document.createElement("tbody");for(const t of l)e.appendChild(t);n.append(e)}return n},element:!Wg(n)&&Xs(n)?n.querySelector("table"):n}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:n,domRows:r}=t;for(let t=0;t<n;t++){const n=r[t];if(null!=n)for(let r=0;r<n.length;r++){const i=n[r];if(null==i)continue;const{elem:o}=i,s=xp(this,o);if(null!==s&&e.is(s))return{x:r,y:t}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,n){const{domRows:r}=n,i=r[t];if(null==i)return null;const o=i[e<i.length?e:i.length-1];return null==o?null:o}getDOMCellFromCordsOrThrow(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(null==r)return null;const i=as(r.elem);return ag(i)?i:null}getCellNodeFromCordsOrThrow(e,t,n){const r=this.getCellNodeFromCords(e,t,n);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return Boolean(this.getLatest().__rowStriping)}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach((e=>{ag(e)&&(t+=e.getColSpan())})),t}}function kp(e,t){const n=e.getElementByKey(t.getKey());return null===n&&ug(230),tp(t,n)}function Ep(e){const t=Tp();e.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0),e.hasAttribute("data-lexical-frozen-column")&&t.setFrozenColumns(1),e.hasAttribute("data-lexical-frozen-row")&&t.setFrozenRows(1);const n=e.querySelector(":scope > colgroup");if(n){let e=[];for(const t of n.querySelectorAll(":scope > col")){let n=t.style.width||"";if(!Qh.test(n)&&(n=t.getAttribute("width")||"",!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>ec(e,pg),node:t}}function Tp(){return js(new vp)}function Np(e){return e instanceof vp}function Ap({rows:e,columns:t,includeHeaders:n}){const r=Oi()||Fi();if(!r||!pi(r))return!1;if(pp(r.anchor.getNode()))return!1;const i=function(e,t,n=!0){const r=Tp();for(let i=0;i<e;i++){const e=gg();for(let r=0;r<t;r++){let t=ng;"object"==typeof n?(0===i&&n.rows&&(t|=rg),0===r&&n.columns&&(t|=tg)):n&&(0===i&&(t|=rg),0===r&&(t|=tg));const o=lg(t),s=No();s.append(ri()),o.append(s),e.append(o)}r.append(e)}return r}(Number(e),Number(t),n);Za(i);const o=i.getFirstDescendant();return ii(o)&&o.select(),!0}function Lp(e){pg(e.getParent())?e.isEmpty()&&e.append(No()):e.remove()}function Op(e){Np(e.getParent())?Xa(e,ag):e.remove()}function Fp(e){Xa(e,pg);const[t]=Fg(e,null,null),n=t.reduce(((e,t)=>Math.max(e,t.length)),0),r=e.getChildren();for(let e=0;e<t.length;++e){const i=r[e];if(!i)continue;pg(i)||ug(254,i.constructor.name,i.getType());const o=t[e].reduce(((e,t)=>t?1+e:e),0);if(o!==n)for(let e=o;e<n;++e){const e=lg();e.append(No()),i.append(e)}}}function Rp(e){if(e.detail<3||!Qs(e.target))return!1;const t=as(e.target);if(null===t)return!1;const n=gl(t,(e=>fo(e)&&!e.isInline()));return null!==n&&(!!ag(n.getParent())&&(n.select(0),!0))}function Ip(e){return!!pi(e)&&(e.isCollapsed()?Pp(e.style):e.hasFormat("highlight"))}function Pp(e){const t="string"==typeof e?ua(e):e;return!(!t.color&&!t["background-color"])}class Mp{constructor(e,t=[]){this._property=e,this._allowedValues=t,this._canonicalValues=this.#_e}applyCanonicalization(e){const t={...ua(e)};return t[this._property]=this.getCanonicalAllowedValue(t[this._property]),t[this._property]||delete t[this._property],da(t)}getCanonicalAllowedValue(e){return this._canonicalValues[e]||=this.#xe(e)}get#_e(){return this._allowedValues.reduce(((e,t)=>({...e,[t]:t})),{})}#xe(e){let t=this.#Se.indexOf(e);return t||=this.#Se.indexOf(Dp(this._property,e)),-1===t?null:this._allowedValues[t]}get#Se(){return this._computedAllowedValues||=this._allowedValues.map((e=>Dp(this._property,e)))}}function Dp(e,t){const n=`${e}: ${t};`,r=document.body.appendChild($h("span",{style:"display: none;"+n})),i=window.getComputedStyle(r).getPropertyValue(e);return r.remove(),i}class Bp{#Ce;constructor(e){this.#Ce=e}get editorElement(){return this.#Ce}get editorConfig(){return this.#Ce.config}get enabled(){return!0}get lexicalExtension(){return null}initializeToolbar(e){}}const zp=on(),$p=on(),Hp={color:null,"background-color":null},Kp=at("hasPastedStyles",{parse:e=>e||!1});class Up extends Bp{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return[{dependencies:[Ed],name:"lexxy/highlight",config:{color:{buttons:[],permit:[]},"background-color":{buttons:[],permit:[]}},html:{import:{mark:Vp}},register(e,t){const n=function(e){return[new Mp("color",[...e.buttons.color,...e.permit.color]),new Mp("background-color",[...e.buttons["background-color"],...e.permit["background-color"]])]}(t);return Va(e.registerCommand(zp,jp,2),e.registerCommand($p,(()=>jp(Hp)),2),e.registerNodeTransform(Gr,Gp),e.registerNodeTransform(Gr,(e=>function(e,t=[]){if(function(e){return ct(e,Kp)}(e)){Jp(e,!1);const n=function(e,t=[]){return t.reduce(((e,t)=>t.applyCanonicalization(e)),e)}(e.getStyle(),t);e.setStyle(n);const r=Oi();e.isSelected(r)&&(r.setStyle(e.getStyle()),r.setFormat(e.getFormat()))}}(e,n))))}},this.editorConfig.get("highlight")]}}function Wp(e,t){const n={color:t.style?.color,"background-color":t.style?.backgroundColor};(function(e){return Xi()._updateTags.has(e)})(Fr)&&Jp(e);const r=da(n);if(r.length)return e.setStyle(e.getStyle()+r)}function Vp(){return{conversion:Gh("mark",Wp),priority:1}}function jp(e){const t=Oi();if(!pi(t))return;const n={};for(const r in e){const i=ka(t,r);n[r]=qp(i,e[r])}ba(t,n)}function qp(e,t){return e===t?null:t}function Gp(e){Pp(e.getStyle())!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}function Jp(e,t=!0){ut(e,Kp,t)}const Zp=["bold","italic","strikethrough","link","unlink","toggleHighlight","removeHighlight","rotateHeadingFormat","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","insertHorizontalDivider","uploadAttachments","insertTable","undo","redo"];class Yp{static configureFor(e){new Yp(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#we(),this.#ve(),this.#ke()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(yn,"bold")}dispatchItalic(){this.editor.dispatchCommand(yn,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(yn,"strikethrough")}dispatchToggleHighlight(e){this.editor.dispatchCommand(zp,e)}dispatchRemoveHighlight(){this.editor.dispatchCommand($p)}dispatchLink(e){this.editor.update((()=>{const t=Oi();if(pi(t))if(t.isCollapsed()){const n=vu(e),r=ri(e);n.append(r),t.insertNodes([n])}else Tu(e)}))}dispatchUnlink(){this.#Ee(null)}dispatchInsertUnorderedList(){const e=Oi();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===qh(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(pu,void 0)}dispatchInsertOrderedList(){const e=Oi();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===qh(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(fu,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleNodeWrappingAllSelectedNodes((e=>pd(e)),(()=>gd()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(yn,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>$d(e)),(()=>new Bd("plain")))}))}dispatchInsertHorizontalDivider(){this.contents.insertAtCursorEnsuringLineBelow(new Xh),this.editor.focus()}dispatchRotateHeadingFormat(){const e=Oi();if(!pi(e))return;if(Ws(e.anchor.getNode()))return void e.insertNodes([_d("h2")]);const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(xd(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>_d(n))):this.contents.removeFormattingFromSelectedLines()}dispatchUploadAttachments(){const e=$h("input",{type:"file",multiple:!0,style:"display: none;",onchange:({target:e})=>{const t=Array.from(e.files);if(t.length)for(const e of t)this.contents.uploadFile(e)}});this.editorElement.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}dispatchInsertTable(){this.editor.dispatchCommand(cg,{rows:3,columns:3,includeHeaders:!0})}dispatchUndo(){this.editor.dispatchCommand(bn,void 0)}dispatchRedo(){this.editor.dispatchCommand(_n,void 0)}#we(){for(const t of Zp){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#Te(t,0,this[n].bind(this))}var e;this.#Te(gn,1,this.dispatchPaste.bind(this))}#Te(e,t,n){this.editor.registerCommand(e,n,t)}#ve(){this.editor.registerCommand(Fn,this.#Ne.bind(this),2)}#ke(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#Ae.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#Le.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#Oe.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#Fe.bind(this)))}#Oe(e){this.dragCounter++,1===this.dragCounter&&this.editor.getRootElement().classList.add("lexxy-editor--drag-over")}#Fe(e){this.dragCounter--,0===this.dragCounter&&this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")}#Ae(e){e.preventDefault()}#Le(e){e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);if(n.length){for(const e of n)this.contents.uploadFile(e);this.editor.focus()}}#Ne(e){return this.selection.isInsideList?this.#Re(e):!!this.selection.isInsideCodeBlock&&this.#Ie()}#Re(e){if(e.shiftKey&&!this.selection.isIndentedList)return!1;e.preventDefault();const t=e.shiftKey?Pn:In;return this.editor.dispatchCommand(t)}#Ie(){const e=Oi();return pi(e)&&e.isCollapsed()}#Ee(e){this.editor.update((()=>{Tu(null===e?null:e)}))}}function Xp(){return new Promise(requestAnimationFrame)}class Qp{constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#Pe(),this.#Me(),this.#De()}set current(e){this.editor.update((()=>{this.#Be()}))}get hasNodeSelection(){return this.editor.getEditorState().read((()=>{const e=Oi();return null!==e&&mi(e)}))}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#ze();if(!t)return;const n=this.#$e(t);n&&(e=this.#He(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{const e=ds(),t=e.getLastDescendant();t&&ii(t)?t.selectEnd():e.selectEnd()}))}selectedNodeWithOffset(){const e=Oi();if(!e)return{node:null,offset:0};if(pi(e))return{node:e.anchor.getNode(),offset:e.anchor.offset};if(mi(e)){const[t]=e.getNodes();return{node:t,offset:0}}return{node:null,offset:0}}preservingSelection(e){let t=null;this.editor.getEditorState().read((()=>{const e=Oi();e&&pi(e)&&(t={anchor:{key:e.anchor.key,offset:e.anchor.offset},focus:{key:e.focus.key,offset:e.focus.offset}})})),e(),t&&this.editor.update((()=>{const e=Oi();e&&pi(e)&&(e.anchor.set(t.anchor.key,t.anchor.offset,"text"),e.focus.set(t.focus.key,t.focus.offset,"text"))}))}getFormat(){const e=Oi();if(!pi(e))return{};const t=e.anchor.getNode();if(!t.getParent())return{};const n=t.getTopLevelElementOrThrow(),r=qh(t);return{isBold:e.hasFormat("bold"),isItalic:e.hasFormat("italic"),isStrikethrough:e.hasFormat("strikethrough"),isHighlight:Ip(e),isInLink:null!==Ja(t,_u),isInQuote:pd(n),isInHeading:xd(n),isInCode:e.hasFormat("code")||null!==Ja(t,Bd),isInList:null!==r,listType:r,isInTable:null!==bg(t)}}nearestNodeOfType(e){const t=Oi()?.anchor?.getNode();return Ja(t,e)}get hasSelectedWordsInSingleLine(){const e=Oi();if(!pi(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;if(!t.getTopLevelElement())return!1;const r=e.getNodes();for(const e of r)if($r(e))return!1;return!0}get isInsideList(){return this.nearestNodeOfType(tu)}get isIndentedList(){const e=this.nearestNodeOfType(su);return e&&Hc(e)>1}get isInsideCodeBlock(){return null!==this.nearestNodeOfType(Bd)}get isTableCellSelected(){return null!==this.nearestNodeOfType(ig)}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Ke();return e?ii(e)?this.#Ue(e,t):fo(e)?this.#We(e,t):this.#Ve(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Ke();return e?ii(e)?this.#je(e):fo(e)?this.#We(e,t):this.#Ve(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Ke();return e?ii(e)?this.#qe(e,t):fo(e)?this.#Ge(e,t):this.#Je(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Ke();return e?ii(e)?this.#Ze(e):fo(e)?this.#Ge(e,t):this.#Je(e):null}get#Ye(){if(this.currentlySelectedKeys)return this.currentlySelectedKeys;this.currentlySelectedKeys=new Set;const e=Oi();if(e&&mi(e))for(const t of e.getNodes())this.currentlySelectedKeys.add(t.getKey());return this.currentlySelectedKeys}#Me(){this.editor.registerCommand(wn,this.#Xe.bind(this),1),this.editor.registerCommand(Sn,this.#Qe.bind(this),1),this.editor.registerCommand(kn,this.#et.bind(this),1),this.editor.registerCommand(En,this.#tt.bind(this),1),this.editor.registerCommand(cn,this.#nt.bind(this),1),this.editor.registerCommand(sn,(()=>{this.current=Oi()}),1)}#Pe(){this.editor.registerCommand(an,(({target:e})=>{if(!Qs(e))return!1;const t=as(e);return bo(t)&&this.#rt(t)}),1),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#it()}))}#De(){this.editorContentElement.addEventListener("keydown",(e=>{if("ArrowUp"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.previousElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.previousElementSibling;n||e.preventDefault()}}if("ArrowDown"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.nextElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.nextElementSibling;n||e.preventDefault()}}}),!0)}#Be(){this.#ot(),this.#st(),this.previouslySelectedKeys=this.#Ye,this.currentlySelectedKeys=null}#ot(){for(const e of this.previouslySelectedKeys)if(!this.#Ye.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#st(){for(const e of this.#Ye)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#Xe(){return this.hasNodeSelection?await this.#lt((e=>e.selectPrevious())):this.#rt(this.nodeBeforeCursor)}async#Qe(){return this.hasNodeSelection?await this.#lt((e=>e.selectNext(0,0))):this.#rt(this.nodeAfterCursor)}async#et(){return this.hasNodeSelection?await this.#lt((e=>e.getTopLevelElement().selectPrevious())):this.#rt(this.topLevelNodeBeforeCursor)}async#tt(){return this.hasNodeSelection?await this.#lt((e=>e.getTopLevelElement().selectNext(0,0))):this.#rt(this.topLevelNodeAfterCursor)}async#lt(e){await Xp(),this.hasNodeSelection&&this.editor.update((()=>{e(Oi().getNodes()[0]),this.editor.focus()}))}async#it(){this.editor.update((()=>{const e=this.#at();e&&this.#ct(e)}))}#at(){const e=Oi();return e?mi(e)?this.#ut(e):pi(e)?this.#dt(e):null:null}#ut(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#dt(e){return e.anchor.getNode().getTopLevelElement()}#ct(e){const t=e.getNextSibling();t?t.selectStart():this.#ht()}#ht(){const e=ds(),t=No();e.append(t),t.selectStart()}#rt(e){if(bo(e)){const t=function(...e){const t=Ai();return e.forEach((e=>t.add(e.getKey()))),t}(e);return gs(t),t}return!1}#nt(e){const t=e?this.nodeBeforeCursor:this.nodeAfterCursor;return t instanceof yo&&(this.#rt(t),!0)}#ze(){const e=Oi();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#$e(e){let t=e.getBoundingClientRect();if(this.#gt(t)){const n=this.#pt(e);t=n.getBoundingClientRect(),this.#ft(n),n.remove()}return t}#gt(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#pt(e){const t=this.#mt();return e.insertNode(t),t}#mt(){const e=document.createElement("span");return e.textContent="​",e.style.display="inline-block",e.style.width="1px",e.style.height="1em",e.style.lineHeight="normal",e.setAttribute("nonce",Ma()),e}#ft(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#He(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const o=this.#yt(t);return isNaN(o)||(i+=o),{x:r,y:i,fontSize:o}}#yt(e){const t=window.getSelection().anchorNode,n=this.#bt(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#bt(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#Ke(){const e=Oi();if(!pi(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#Ue(e,t){return t===e.getTextContentSize()?this.#je(e):null}#je(e){if(e.getNextSibling()instanceof yo)return e.getNextSibling();const t=e.getParent();return t?t.getNextSibling():null}#We(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#Ve(e)}#qe(e,t){return 0===t?this.#Ze(e):null}#Ze(e){if(e.getPreviousSibling()instanceof yo)return e.getPreviousSibling();return e.getParent().getPreviousSibling()}#Ge(e,t){return t>0?e.getChildAtIndex(t-1):this.#Je(e)}#Ve(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#Je(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}function ef(e){return he.sanitize(e,{ALLOWED_TAGS:Ra.concat(Fa.global.get("attachmentTagName")),ALLOWED_ATTR:Ia,ADD_URI_SAFE_ATTR:["caption","filename"],SAFE_FOR_XML:!1})}function tf(e){try{return new URL(e),!0}catch{return!1}}function nf(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function rf(e){return e.charAt(0).toUpperCase()+e.slice(1)}class of{#Ce;#_t;constructor(e){this.#Ce=e,this.#_t=new Na(Fa.presets.get("default"),Fa.presets.get(e.preset),this.#xt)}get(e){return this.#_t.get(e)}get#xt(){const e={};for(const t of this.#St){const n=t.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`));this.#Ce.hasAttribute(n)&&(e[t]=this.#Ct(n))}return e}get#St(){return Object.keys(Fa.presets.get("default"))}#Ct(e){const t=this.#Ce.getAttribute(e);try{return JSON.parse(t)}catch{return t}}}class sf extends yo{static getType(){return"custom_action_text_attachment"}static clone(e){return new sf({...e},e.__key)}static importJSON(e){return new sf({...e})}static importDOM(){return{[this.TAG_NAME]:e=>e.getAttribute("content")?{conversion:e=>{const t=[],n=e.previousSibling;return n&&n.nodeType===Node.TEXT_NODE&&/\s$/.test(n.textContent)&&t.push(ri(" ")),t.push(new sf({sgid:e.getAttribute("sgid"),innerHtml:JSON.parse(e.getAttribute("content")),contentType:e.getAttribute("content-type")})),t.push(ri(" ")),{node:t}},priority:2}:null}}static get TAG_NAME(){return Fa.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,contentType:n,innerHtml:r},i){super(i);const o=Fa.global.get("attachmentContentTypeNamespace");this.tagName=e||sf.TAG_NAME,this.sgid=t,this.contentType=n||`application/vnd.${o}.unknown`,this.innerHtml=r}createDOM(){const e=$h(this.tagName,{"content-type":this.contentType,"data-lexxy-decorator":!0});return e.insertAdjacentHTML("beforeend",this.innerHtml),e}updateDOM(){return!1}getTextContent(){return this.createDOM().textContent.trim()||`[${this.contentType}]`}isInline(){return!0}exportDOM(){return{element:$h(this.tagName,{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class lf{constructor(e){this.editorElement=e,this.editor=e.editor}monitor(){this.editor.registerCommand(Tn,(e=>this.#wt(e)),3)}#wt(e){const t=Oi();if(!pi(t))return!1;const n=t.anchor.getNode();return!!this.#vt(n)&&(this.#kt(e,n)||this.#Et(e,n))}#kt(e,t){return!(!this.#Tt(t)&&!this.#Nt(t))&&(e.preventDefault(),this.#At(t),!0)}#Et(e,t){return!!this.#Lt(t)&&(e.preventDefault(),this.#Ot(t),!0)}#vt(e){let t=e;for(;t;){if(pd(t))return!0;t=t.getParent()}return!1}#Tt(e){const t=this.#Ft(e);return!!t&&this.#Rt(t)}#Nt(e){const t=this.#It(e);if(!t)return!1;if(!this.#Rt(t))return!1;const n=t.getParent();return n&&ou(n)}#Rt(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>!!$r(e)||this.#Rt(e)))}#Ft(e){let t=e;for(;t;){if(ou(t))return t;t=t.getParent()}return null}#At(e){const t=this.#Ft(e);if(!t)return;const n=t.getParent();if(!n||!hu(n))return;const r=n.getParent();if(r&&pd(r)){const e=this.#Pt(t).filter((e=>!this.#Rt(e)));if(e.length>0)return void this.#Mt(r,n,t,e)}const i=No();n.insertAfter(i),t.remove(),i.selectStart()}#Lt(e){const t=this.#It(e);if(!t)return!1;if(!this.#Rt(t))return!1;const n=t.getParent();return n&&pd(n)}#It(e){let t=e;for(;t;){if(Ao(t))return t;t=t.getParent()}return null}#Ot(e){const t=this.#It(e);if(!t)return;const n=t.getParent();if(!n||!pd(n))return;const r=this.#Dt(t).filter((e=>!this.#Rt(e)));if(r.length>0)this.#Bt(n,t,r);else{const e=No();n.insertAfter(e),t.remove(),e.selectStart()}}#Dt(e){const t=[];let n=e.getNextSibling();for(;n;)t.push(n),n=n.getNextSibling();return t}#Pt(e){const t=[];let n=e.getNextSibling();for(;n;)ou(n)&&t.push(n),n=n.getNextSibling();return t}#Mt(e,t,n,r){const i=this.#Dt(t).filter((e=>!this.#Rt(e))),o=No();e.insertAfter(o);const s=du(t.getListType()),l=gd();o.insertAfter(l),l.append(s),r.forEach((e=>{s.append(e)})),i.forEach((e=>{l.append(e)})),n.remove(),this.#zt(t),this.#$t(l),0===t.getChildrenSize()?(t.remove(),0===e.getChildrenSize()&&e.remove()):this.#$t(e),o.selectStart()}#zt(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!ou(n)||!this.#Rt(n))break;n.remove()}}#$t(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!this.#Rt(n))break;n.remove()}}#Bt(e,t,n){const r=No();e.insertAfter(r);const i=gd();r.insertAfter(i),n.forEach((e=>{i.append(e)})),t.remove(),this.#$t(e),this.#$t(i),r.selectStart()}}class af{constructor(e){this.editorElement=e,this.editor=e.editor,new lf(e).monitor()}insertHtml(e,{tag:t}={}){this.editor.update((()=>{const t=Oi();if(!pi(t))return;const n=Lu(this.editor,Hh(e));t.insertNodes(n)}),{tag:t})}insertAtCursor(e){const t=Oi(),n=t?.getNodes();if(pi(t))Bi([e]);else if(mi(t)&&n&&n.length>0){n.at(-1).insertAfter(e)}else{ds().append(e)}}insertAtCursorEnsuringLineBelow(e){this.insertAtCursor(e),this.#Ht(e)}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=Oi();if(!pi(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=Oi();if(!pi(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.#Kt(t)}))}toggleNodeWrappingAllSelectedNodes(e,t){this.editor.update((()=>{const n=Oi();if(!pi(n))return;const r=n.anchor.getNode().getTopLevelElement();r&&e(r)?this.#Ut(r):this.#Wt(t)}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=Oi();if(!pi(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=No();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=Oi();e=pi(t)&&!t.isCollapsed()})),e}unwrapSelectedListItems(){this.editor.update((()=>{const e=Oi();if(!pi(e))return;const{listItems:t,parentLists:n}=this.#Vt(e);if(t.size>0){const e=this.#jt(t);this.#qt(n),this.#Gt(e)}}))}createLink(e){let t=null;return this.editor.update((()=>{const n=ri(e),r=Su(e);r.append(n);const i=Oi();pi(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{Tu(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=Oi();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!ii(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s),a=l.lastIndexOf(e);-1!==a&&(t=l.slice(a+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=Oi();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!ii(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s);t=l.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t],this.editor.update((()=>{const{anchorNode:n,offset:r}=this.#Jt();if(!n)return;const i=this.#Zt(n,r,e);-1!==i&&this.#Yt(n,r,i,t)}))}createParagraphAfterNode(e,t){const n=No();e.insertAfter(n),n.selectStart(),t&&(n.append(ri(t)),n.select(1,1))}createParagraphBeforeNode(e,t){const n=No();e.insertBefore(n),n.selectStart(),t&&(n.append(ri(t)),n.select(1,1))}uploadFile(e){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");if(!this.#Xt(e))return;const t=this.editorElement.directUploadUrl,n=this.editorElement.blobUrlTemplate;this.editor.update((()=>{const r=new Zh({file:e,uploadUrl:t,blobUrlTemplate:n});this.insertAtCursor(r)}),{tag:Or})}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=os(e);if(!r)return;const i=Oi();let o=!1;if(pi(i)){const e=i.getNodes();o=e.includes(r)||e.some((e=>e.getParent()===r)),o&&gs(null)}const s=n.attachment?this.#Qt(t,n.attachment):this.#en(t);r.replace(s),o&&s.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=os(e);if(!r)return;const i=r.getTopLevelElement()||r,o=n.attachment?this.#Qt(t,n.attachment):this.#en(t);i.insertAfter(o)}))}#Ht(e){this.editor.update((()=>{if(!e.getNextSibling()){const t=No();e.insertAfter(t),t.selectStart()}}))}#Ut(e){const t=e.getChildren();0==t.length?e.insertBefore(No()):t.forEach((t=>{if(ii(t)&&""!==t.getTextContent().trim()){const n=No();n.append(t),e.insertBefore(n)}else $r(t)||e.insertBefore(t)})),e.remove()}#Wt(e){this.editor.update((()=>{const t=Oi();if(!pi(t))return;const n=t.extract();if(0===n.length)return;const r=new Set;n.forEach((e=>{const t=e.getTopLevelElementOrThrow();r.add(t)}));const i=this.#tn(Array.from(r));if(0===i.length)return this.#nn(),void this.insertAtCursor(e());const o=e();i[0].insertBefore(o),i.forEach((e=>{o.append(e)}))}))}#tn(e){let t=e.length-1;for(;t>=0;){const n=e[t];if(!Ao(n)||!this.#rn(n))break;t--}return e.slice(0,t+1)}#rn(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>$r(e)))}#nn(){const e=ds();if(1===e.getChildrenSize()){const t=e.getFirstChild();t&&Ao(t)&&this.#rn(t)&&t.remove()}}#Kt(e){this.editor.update((()=>{const t=Oi();pi(t)&&(t.isCollapsed()?this.#in(t,e):this.#on(t,e))}))}#in(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else Bi([t()])}#on(e,t){const n=this.#sn(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#ln(n);if(0===r.size)return;const o=this.#an(t,r);this.#cn(e,o),this.#un(i)}#sn(e){const t=e.extract().map((e=>this.#dn(e))).filter(Boolean);return gs(null),t}#dn(e){return Ao(e)?e:ii(e)&&e.getParent()&&Ao(e.getParent())?e.getParent():null}#ln(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#an(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(ri(e)),t<r.length-1&&n.append(zr())})),n}#cn(e,t){const n=e.anchor.getNode().getParent();n&&n.replace(t)}#un(e){e.forEach((e=>e.remove()))}#Vt(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=Ja(e,tu);if(t){n.add(t);const e=t.getParent();e&&hu(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#jt(e){const t=[];for(const n of e){const e=this.#hn(n);e&&t.push(e)}return t}#hn(e){const t=e.getParent();if(!t||!hu(t))return null;const n=No(),r=this.#gn(e,n);return e.insertAfter(n),this.#pn(n,r),e.remove(),n}#gn(e,t){const n=[];return e.getChildren().forEach((e=>{hu(e)?n.push(e):t.append(e)})),n}#pn(e,t){t.forEach((t=>{e.insertAfter(t)}))}#qt(e){for(const t of e)hu(t)&&0===t.getChildrenSize()&&t.remove()}#Gt(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#fn(t,n)}#fn(e,t){e.selectStart();const n=Oi();n&&pi(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#Jt(){const e=Oi();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return ii(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#Zt(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#Yt(e,t,n,r){const i=e.getTextContent(),o=i.slice(0,n),s=i.slice(t),l=ri(o),a=ri(s||" ");e.replace(l);this.#mn(l,r).insertAfter(a),this.#yn(a.getParentOrThrow());const c=s?0:1;a.select(c,c)}#mn(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#yn(e){if(Ao(e)&&this.editorElement.supportsMultiLine){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];ii(n)&&""===n.getTextContent()&&r&&!ii(r)&&e.append(zr())}}#Qt(e,t={}){return new sf({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#en(e){return Lu(this.editor,Hh(e))[0]||No()}#Xt(e){return Kh(this.editorElement,"lexxy:file-accept",{file:e},!0)}}function cf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var uf={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function df(e){uf=e}var hf={exec:()=>null};function gf(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(pf.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var pf={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},ff=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,mf=/(?:[*+-]|\d{1,9}[.)])/,yf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,bf=gf(yf).replace(/bull/g,mf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),_f=gf(yf).replace(/bull/g,mf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Sf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Cf=gf(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Sf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),wf=gf(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mf).getRegex(),vf="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",kf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ef=gf("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",kf).replace("tag",vf).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Tf=gf(xf).replace("hr",ff).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vf).getRegex(),Nf={blockquote:gf(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Tf).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Cf,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:ff,html:Ef,lheading:bf,list:wf,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Tf,table:hf,text:/^[^\n]+/},Af=gf("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ff).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vf).getRegex(),Lf={...Nf,lheading:_f,table:Af,paragraph:gf(xf).replace("hr",ff).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Af).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",vf).getRegex()},Of={...Nf,html:gf("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",kf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:hf,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:gf(xf).replace("hr",ff).replace("heading"," *#{1,6} *[^\n]").replace("lheading",bf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ff=/^( {2,}|\\)\n(?!\s*$)/,Rf=/[\p{P}\p{S}]/u,If=/[\s\p{P}\p{S}]/u,Pf=/[^\s\p{P}\p{S}]/u,Mf=gf(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,If).getRegex(),Df=/(?!~)[\p{P}\p{S}]/u,Bf=gf(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),zf=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,$f=gf(zf,"u").replace(/punct/g,Rf).getRegex(),Hf=gf(zf,"u").replace(/punct/g,Df).getRegex(),Kf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Uf=gf(Kf,"gu").replace(/notPunctSpace/g,Pf).replace(/punctSpace/g,If).replace(/punct/g,Rf).getRegex(),Wf=gf(Kf,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Df).getRegex(),Vf=gf("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Pf).replace(/punctSpace/g,If).replace(/punct/g,Rf).getRegex(),jf=gf(/\\(punct)/,"gu").replace(/punct/g,Rf).getRegex(),qf=gf(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Gf=gf(kf).replace("(?:--\x3e|$)","--\x3e").getRegex(),Jf=gf("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Gf).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Yf=gf(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Zf).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xf=gf(/^!?\[(label)\]\[(ref)\]/).replace("label",Zf).replace("ref",Sf).getRegex(),Qf=gf(/^!?\[(ref)\](?:\[\])?/).replace("ref",Sf).getRegex(),em=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tm={_backpedal:hf,anyPunctuation:jf,autolink:qf,blockSkip:Bf,br:Ff,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:hf,emStrongLDelim:$f,emStrongRDelimAst:Uf,emStrongRDelimUnd:Vf,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Yf,nolink:Qf,punctuation:Mf,reflink:Xf,reflinkSearch:gf("reflink|nolink(?!\\()","g").replace("reflink",Xf).replace("nolink",Qf).getRegex(),tag:Jf,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:hf},nm={...tm,link:gf(/^!?\[(label)\]\((.*?)\)/).replace("label",Zf).getRegex(),reflink:gf(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zf).getRegex()},rm={...tm,emStrongRDelimAst:Wf,emStrongLDelim:Hf,url:gf(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",em).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:gf(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",em).getRegex()},im={...rm,br:gf(Ff).replace("{2,}","*").getRegex(),text:gf(rm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},om={normal:Nf,gfm:Lf,pedantic:Of},sm={normal:tm,gfm:rm,breaks:im,pedantic:nm},lm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},am=e=>lm[e];function cm(e,t){if(t){if(pf.escapeTest.test(e))return e.replace(pf.escapeReplace,am)}else if(pf.escapeTestNoEncode.test(e))return e.replace(pf.escapeReplaceNoEncode,am);return e}function um(e){try{e=encodeURI(e).replace(pf.percentDecode,"%")}catch{return null}return e}function dm(e,t){let n=e.replace(pf.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(pf.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(pf.slashPipe,"|");return r}function hm(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==t)break;i++}return e.slice(0,r-i)}function gm(e,t,n,r,i){let o=t.href,s=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:o,title:s,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}var pm=class{options;rules;lexer;constructor(e){this.options=e||uf}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:hm(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map((e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=hm(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:hm(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=hm(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,o=!1,s=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))s.push(e[t]),o=!0;else{if(o)break;s.push(e[t])}e=e.slice(t);let l=s.join("\n"),a=l.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${l}`:l,r=r?`${r}\n${a}`:a;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(a,i,!0),this.lexer.state.top=c,0===e.length)break;let u=i.at(-1);if("code"===u?.type)break;if("blockquote"===u?.type){let t=u,o=t.raw+"\n"+e.join("\n"),s=this.blockquote(o);i[i.length-1]=s,n=n.substring(0,n.length-t.raw.length)+s.raw,r=r.substring(0,r.length-t.text.length)+s.text;break}if("list"!==u?.type);else{let t=u,o=t.raw+"\n"+e.join("\n"),s=this.list(o);i[i.length-1]=s,n=n.substring(0,n.length-u.raw.length)+s.raw,r=r.substring(0,r.length-t.raw.length)+s.raw,e=o.substring(i.at(-1).raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),s=!1;for(;e;){let n=!1,r="",l="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let a=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!a.trim(),d=0;if(this.options.pedantic?(d=2,l=a.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,l=a.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),o=this.rules.other.headingBeginRegex(d),s=this.rules.other.htmlBeginRegex(d);for(;e;){let h,g=e.split("\n",1)[0];if(c=g,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),h=c):h=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||o.test(c)||s.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())l+="\n"+h.slice(d);else{if(u||a.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(a)||o.test(a)||n.test(a))break;l+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),a=h.slice(d)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(s=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(l),g&&(h="[ ] "!==g[0],l=l.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:l,tokens:[]}),i.raw+=r}let l=i.items.at(-1);if(!l)return;l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=dm(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?o.align.push("right"):this.rules.other.tableAlignCenter.test(e)?o.align.push("center"):this.rules.other.tableAlignLeft.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<n.length;e++)o.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:o.align[e]});for(let e of i)o.rows.push(dm(e,o.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]}))));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=hm(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),gm(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return gm(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,o=[...r[0]].length-1,s=o,l=0,a="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+o);null!=(r=a.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){s+=i;continue}if((r[5]||r[6])&&o%3&&!((o+i)%3)){l+=i;continue}if(s-=i,s>0)continue;i=Math.min(i,i+s+l);let t=[...r[0]][0].length,a=e.slice(0,o+r.index+t+i);if(Math.min(o,i)%2){let e=a.slice(1,-1);return{type:"em",raw:a,text:e,tokens:this.lexer.inlineTokens(e)}}let c=a.slice(2,-2);return{type:"strong",raw:a,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},fm=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||uf,this.options.tokenizer=this.options.tokenizer||new pm,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:pf,block:om.normal,inline:sm.normal};this.options.pedantic?(t.block=om.pedantic,t.inline=sm.pedantic):this.options.gfm&&(t.block=om.gfm,this.options.breaks?t.inline=sm.breaks:t.inline=sm.gfm),this.tokenizer.rules=t}static get rules(){return{block:om,inline:sm}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(pf.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(pf.tabCharGlobal," ").replace(pf.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let o=t.at(-1);n&&"paragraph"===o?.type?(o.raw+=(o.raw.endsWith("\n")?"":"\n")+r.raw,o.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,o="";for(;e;){let r;if(i||(o=""),i=!1,this.options.extensions?.inline?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===r.type&&"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let s=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(s)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(o=r.raw.slice(-1)),i=!0;let n=t.at(-1);"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},mm=class{options;parser;constructor(e){this.options=e||uf}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(pf.notSpaceStart)?.[0],i=e.replace(pf.endingNewline,"")+"\n";return r?'<pre><code class="language-'+cm(r)+'">'+(n?i:cm(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:cm(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+cm(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n="";for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${cm(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=um(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+cm(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=um(e);if(null===i)return cm(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${cm(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:cm(e.text)}},ym=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},bm=class e{options;renderer;textRenderer;constructor(e){this.options=e||uf,this.options.renderer=this.options.renderer||new mm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ym}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let o=i;switch(o.type){case"space":n+=this.renderer.space(o);continue;case"hr":n+=this.renderer.hr(o);continue;case"heading":n+=this.renderer.heading(o);continue;case"code":n+=this.renderer.code(o);continue;case"table":n+=this.renderer.table(o);continue;case"blockquote":n+=this.renderer.blockquote(o);continue;case"list":n+=this.renderer.list(o);continue;case"html":n+=this.renderer.html(o);continue;case"def":n+=this.renderer.def(o);continue;case"paragraph":n+=this.renderer.paragraph(o);continue;case"text":{let i=o,s=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],s+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:s,text:s,tokens:[{type:"text",raw:s,text:s,escaped:!0}]}):s;continue}default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}let o=i;switch(o.type){case"escape":case"text":n+=t.text(o);break;case"html":n+=t.html(o);break;case"link":n+=t.link(o);break;case"image":n+=t.image(o);break;case"strong":n+=t.strong(o);break;case"em":n+=t.em(o);break;case"codespan":n+=t.codespan(o);break;case"br":n+=t.br(o);break;case"del":n+=t.del(o);break;default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},_m=class{options;block;constructor(e){this.options=e||uf}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?fm.lex:fm.lexInline}provideParser(){return this.block?bm.parse:bm.parseInline}},xm=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=bm;Renderer=mm;TextRenderer=ym;Lexer=fm;Tokenizer=pm;Hooks=_m;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){let t=this.defaults.renderer||new mm(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new pm(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new _m;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],o=t[r];_m.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&_m.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return o.call(t,n)})();let r=i.call(t,e);return o.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await o.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return fm.lex(e,t??this.defaults)}parser(e,t){return bm.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?fm.lex:fm.lexInline)(n,i),o=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(o,i.walkTokens));let s=await(i.hooks?await i.hooks.provideParser():e?bm.parse:bm.parseInline)(o,i);return i.hooks?await i.hooks.postprocess(s):s})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?fm.lex:fm.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?bm.parse:bm.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return o(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+cm(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Sm(e,t){return xm.parse(e,t)}Sm.options=Sm.setOptions=function(e){return xm.setOptions(e),Sm.defaults=xm.defaults,df(Sm.defaults),Sm},Sm.getDefaults=cf,Sm.defaults=uf,Sm.use=function(...e){return xm.use(...e),Sm.defaults=xm.defaults,df(Sm.defaults),Sm},Sm.walkTokens=function(e,t){return xm.walkTokens(e,t)},Sm.parseInline=xm.parseInline,Sm.Parser=bm,Sm.parser=bm.parse,Sm.Renderer=mm,Sm.TextRenderer=ym,Sm.Lexer=fm,Sm.lexer=fm.lex,Sm.Tokenizer=pm,Sm.Hooks=_m,Sm.parse=Sm,Sm.options,Sm.setOptions,Sm.use,Sm.walkTokens,Sm.parseInline,bm.parse,fm.lex;class Cm{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!!t&&(this.#bn(t)&&!this.#_n()?(this.#xn(t),e.preventDefault(),!0):void this.#Sn(t))}#bn(e){return this.#Cn(e)||this.#wn(e)}#Cn(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#wn(e){const t=Array.from(e.types);return 2===t.length&&t.includes("text/uri-list")&&t.includes("text/plain")}#_n(){let e=!1;return this.editor.getEditorState().read((()=>{const t=Oi();if(!pi(t))return;let n=t.anchor.getNode();for(;n;){if($d(n))return void(e=!0);n=n.getParent()}})),e}#xn(e){e.items[0].getAsString((t=>{if(tf(t)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(t);else if(tf(t)){const e=this.contents.createLink(t);this.#vn(e,{url:t})}else this.editorElement.supportsMarkdown?this.#kn(t):this.#En(e)}))}#vn(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};Kh(this.editorElement,"lexxy:insert-link",{...t,...n})}#kn(e){const t=Sm(e);this.contents.insertHtml(t,{tag:[Fr]})}#En(e){this.editor.update((()=>{const t=Oi();Bu(e,t,this.editor)}),{tag:Fr})}#Sn(e){if(!this.editorElement.supportsAttachments)return;e.getData("text/html")||this.#Tn((()=>{for(const t of e.items){const e=t.getAsFile();e&&this.contents.uploadFile(e)}}))}async#Tn(e){const t=window.scrollY,n=window.scrollX;e(),await Xp(),window.scrollTo(n,t),this.editor.focus()}}class wm{constructor(e){this.lexxyElement=e,this.enabledExtensions=this.#Nn()}get lexicalExtensions(){return this.enabledExtensions.map((e=>e.lexicalExtension)).filter(Boolean)}initializeToolbars(){this.#An&&this.enabledExtensions.forEach((e=>e.initializeToolbar(this.#An)))}get#An(){return this.lexxyElement.toolbar}get#Ln(){return this.lexxyElement.baseExtensions}get#On(){return Fa.global.get("extensions")}#Nn(){return this.#Ln.concat(this.#On).map((e=>new e(this.lexxyElement))).filter((e=>e.enabled))}}class vm extends Eo{$config(){return this.config("provisonal_paragraph",{extends:Eo,importDOM:()=>null,$transform:e=>{e.concretizeIfEdited(e),e.removeUnlessRequired(e)}})}static neededBetween(e,t){return!Em(e,"next")&&!Em(t,"previous")}createDOM(e){const t=super.createDOM(e),n=this.isSelected(Oi());return t.classList.add("provisional-paragraph"),t.classList.toggle("hidden",!n),t}updateDOM(e,t){const n=this.isSelected(Oi());return t.classList.toggle("hidden",!n),!1}getTextContent(){return""}exportDOM(){return{element:null}}isSelected(e=null){const t=e||Oi();return t?.getNodes().some((e=>e.is(this)||this.isParentOf(e)))}removeUnlessRequired(e=this.getLatest()){e.required||e.remove()}concretizeIfEdited(e=this.getLatest()){e.getTextContentSize()>0&&e.replace(No(),!0)}get required(){return this.isDirectRootChild&&vm.neededBetween(...this.immediateSiblings)}get isDirectRootChild(){return Ws(this.getParent())}get immediateSiblings(){return[this.getPreviousSibling(),this.getNextSibling()]}}function km(e){return e instanceof vm}function Em(e,t){return fo(e)&&("next"===t?e.canInsertTextBefore():e.canInsertTextAfter())}class Tm extends Bp{get lexicalExtension(){return{name:"lexxy/provisional-paragraph",nodes:[vm],register:e=>Va(e.registerNodeTransform(_o,Nm),e.registerNodeTransform(_o,Am),e.registerCommand(sn,Lm,3))}}}function Nm(e){const t=e.getFirstChild();vm.neededBetween(null,t)&&function(e,t){Fl(e,"next").insert(t)}(e,new vm);for(const t of function(e){return nc(Fl(e,"next"))}(e)){const e=t.getNextSibling();vm.neededBetween(t,e)&&t.insertAfter(new vm)}}function Am(e){for(const t of Om(e))t.removeUnlessRequired()}function Lm(){for(const e of Om())e.markDirty()}function Om(e=ds()){return ec(e.getChildren(),km)}const Fm="language";class Rm extends Bp{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/trix-content",html:{import:{em:e=>Im(e,{conversion:Gh("i",Wp),priority:1}),span:e=>Im(e,{conversion:Gh("mark",Wp),priority:1}),strong:e=>Im(e,{conversion:Gh("b",Wp),priority:1}),del:()=>({conversion:Gh("s",Pm,Wp),priority:1}),pre:e=>function(e,t){return e.hasAttribute(Fm)?t:null}(e,{conversion:Jh(Bd,"pre",Mm),priority:1})}}}}}function Im(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function Pm(e){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),e}function Mm(e,t){const n=rh(t.getAttribute(Fm));e.node.setLanguage(n)}class Dm extends vp{$config(){return this.config("wrapped_table_node",{extends:vp})}static importDOM(){return super.importDOM()}exportDOM(e){const t=super.exportDOM(e);return{...t,after:e=>{if(t.after){return $h("figure",{className:"lexxy-content__table-wrapper"},(e=t.after(e)).cloneNode(!0).outerHTML)}return e}}}}class Bm extends Bp{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/tables",nodes:[Dm,{replace:vp,with:()=>new Dm,withKlass:Dm},ig,dg],register:e=>Va(function(e){return e.hasNodes([vp])||ug(255),Va(e.registerCommand(cg,Ap,0),e.registerCommand(ln,(({nodes:t,selection:n},r)=>!(e!==r||!pi(n))&&null!==pp(n.anchor.getNode())&&t.some(Np)),0),e.registerCommand(an,Rp,0),e.registerNodeTransform(vp,Fp),e.registerNodeTransform(dg,Op),e.registerNodeTransform(ig,Lp))}(e),function(e,t=!0){const n=new Map,r=(r,i,o)=>{const s=Vg(r,o),l=Yg(r,s,e,t);n.set(i,[l,s])},i=e.registerMutationListener(vp,(t=>{e.getEditorState().read((()=>{for(const[e,i]of t){const t=n.get(e);if("created"===i||"updated"===i){const{tableNode:i,tableElement:o}=Hg(e);void 0===t?r(i,e,o):o!==t[1]&&(t[0].removeListeners(),n.delete(e),r(i,e,o))}else"destroyed"===i&&void 0!==t&&(t[0].removeListeners(),n.delete(e))}}),{editor:e})}),{skipInitialization:!1});return()=>{i();for(const[,[e]]of n)e.removeListeners()}}(e,!0),function(e){Cp.add(e)}(e),e.registerNodeTransform(ig,(e=>{null===e.getBackgroundColor()&&e.setBackgroundColor("")})),e.registerNodeTransform(ig,(e=>{const t=e.getHeaderStyles();if(t!==rg)return;const n=e.getParent(),r=n?.getParent();if(!r)return;const i=r.getChildren(),o=n.getChildren().indexOf(e),s=n.getChildren().every((e=>e.getHeaderStyles()!==ng)),l=i.every((e=>{const t=e.getChildren()[o];return t&&t.getHeaderStyles()!==ng}));let a=ng;s&&(a|=rg),l&&(a|=tg),a!==t&&e.setHeaderStyles(a,eg)})),e.registerCommand("insertTableRowAfter",(()=>{Cg(!0)}),2),e.registerCommand("insertTableRowBefore",(()=>{Cg(!1)}),2),e.registerCommand("insertTableColumnAfter",(()=>{vg(!0)}),2),e.registerCommand("insertTableColumnBefore",(()=>{vg(!1)}),2),e.registerCommand("deleteTableRow",(()=>{!function(){const e=Oi();pi(e)||Bg(e)||ug(188);const[t,n]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[r,,i]=Rg(t),[o]=Rg(n),[s,l,a]=Og(i,r,o),{startRow:c}=l,{startRow:u}=a,d=u+o.__rowSpan-1;if(s.length===d-c+1)return void i.remove();const h=s[0].length,g=s[d+1],p=i.getChildAtIndex(d+1);for(let e=d;e>=c;e--){for(let t=h-1;t>=0;t--){const{cell:n,startRow:r,startColumn:i}=s[e][t];if(i===t){if(r<c||r+n.__rowSpan-1>d){const e=Math.max(r,c),t=Math.min(n.__rowSpan+r-1,d),i=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-i)}if(r>=c&&r+n.__rowSpan-1>d&&e===d){null===p&&ug(122);let r=null;for(let n=0;n<t;n++){const t=g[n],i=t.cell;t.startRow===e+1&&(r=i),i.__colSpan>1&&(n+=i.__colSpan-1)}null===r?Tg(p,n):r.insertAfter(n)}}}const t=i.getChildAtIndex(e);pg(t)||ug(206,String(e)),t.remove()}if(void 0!==g){const{cell:e}=g[0];Eg(e)}else{const e=s[c-1],{cell:t}=e[0];Eg(t)}}()}),2),e.registerCommand("deleteTableColumn",(()=>{!function(){const e=Oi();pi(e)||Bg(e)||ug(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[r,,i]=Rg(t),[o]=Rg(n),[s,l,a]=Og(i,r,o),{startColumn:c}=l,{startRow:u,startColumn:d}=a,h=Math.min(c,d),g=Math.max(c+r.__colSpan-1,d+o.__colSpan-1),p=g-h+1;if(s[0].length===g-h+1)return i.selectPrevious(),void i.remove();const f=s.length;for(let e=0;e<f;e++)for(let t=h;t<=g;t++){const{cell:n,startColumn:r}=s[e][t];if(r<h){if(t===h){const e=h-r;n.setColSpan(n.__colSpan-Math.min(p,n.__colSpan-e))}}else if(r+n.__colSpan-1>g){if(t===g){const e=g-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}const m=s[u],y=c>d?m[c+r.__colSpan]:m[d+o.__colSpan];if(void 0!==y){const{cell:e}=y;Eg(e)}else{const e=d<c?m[d-1]:m[c-1],{cell:t}=e;Eg(t)}const b=i.getColWidths();if(b){const e=[...b];e.splice(h,p),i.setColWidths(e)}}()}),2),e.registerCommand("deleteTable",(()=>{const e=Oi();if(!pi(e))return!1;pp(e.anchor.getNode())?.remove()}),2))}}}class zm extends HTMLElement{static formAssociated=!0;static debug=!1;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#Fn="";#Rn=document.createElement("textarea");constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Uh("lexxy-editor"),this.config=new of(this),this.extensions=new wm(this),this.editor=this.#In(),this.contents=new af(this),this.selection=new Qp(this),this.clipboard=new Cm(this),Yp.configureFor(this),this.#Pn(),requestAnimationFrame((()=>Kh(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.#Mn(),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#Dn()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#f())),"required"===e&&this.isConnected&&(this.#Rn.required=this.hasAttribute("required"),this.#Bn())}formResetCallback(){this.value=this.#Fn,this.editor.dispatchCommand(Vn,void 0)}toString(){return this.cachedStringValue||this.editor?.getEditorState().read((()=>{this.cachedStringValue=ds().getTextContent()})),this.cachedStringValue}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get toolbarElement(){return this.#zn?(this.toolbar=this.toolbar||this.#$n(),this.toolbar):null}get baseExtensions(){return[Tm,Up,Rm,Bm]}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isEmpty(){return["<p><br></p>","<p></p>",""].includes(this.value.trim())}get isBlank(){return this.isEmpty||null!==this.toString().match(/^\s*$/g)}get hasOpenPrompt(){return null!==this.querySelector(".lexxy-prompt-menu.lexxy-prompt-menu--visible")}get preset(){return this.getAttribute("preset")||"default"}get supportsAttachments(){return this.config.get("attachments")}get supportsMarkdown(){return this.supportsRichText&&this.config.get("markdown")}get supportsMultiLine(){return this.config.get("multiLine")&&!this.isSingleLineMode}get supportsRichText(){return this.config.get("richText")}get isSingleLineMode(){return this.hasAttribute("single-line")}get contentTabIndex(){return parseInt(this.editorContentElement?.getAttribute("tabindex")??"0")}focus(){this.editor.focus((()=>this.#Hn()))}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=ef(Ou(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{zs(Pr);const t=ds();t.clear(),t.append(...this.#Kn(e)),t.selectEnd(),this.#Un(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#Kn(e){e||(e="<p></p>");return Lu(this.editor,Hh(`${e}`)).map(this.#Wn).map(this.#Vn)}#Wn(e){if(!ii(e))return e;const t=No();return t.append(e),t}#Vn(e){if(Ao(e)&&1===e.getChildrenSize()){const t=e.getFirstChild();if(bo(t)&&!t.isInline())return t}return e}#Pn(){this.#jn(),this.#qn(),this.#Gn(),this.#Jn(),this.#Zn(),this.#Yn(),this.#Xn(),this.#Qn()}#In(){this.editorContentElement||=this.#er();const e=function(...e){return zc.fromExtensions(e).buildEditor()}({name:"lexxy/core",namespace:"Lexxy",theme:zh,nodes:this.#tr},...this.extensions.lexicalExtensions);return e.setRootElement(this.editorContentElement),e}get#tr(){const e=[sf];return this.supportsRichText&&e.push(hd,fd,su,tu,Bd,qd,_u,wu,Xh),this.supportsAttachments&&e.push(Vh,Zh),e}#er(){const e=$h("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#nr,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#rr.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#nr(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#rr(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#ir(e){const t=void 0!==this.#ir&&this.#ir!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#Rn.value=this.isEmpty?"":e,t&&Kh(this,"lexxy:change")}get#ir(){return this._internalFormValue}#Xn(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"<p></p>";this.value=this.#Fn=e}#Qn(){document.addEventListener("turbo:before-cache",this.#or)}#or=e=>{this.#Dn()};#jn(){this.#sr(this.editor.registerUpdateListener((({editorState:e})=>{this.#lr(),this.#ir=this.value,this.#Un(),this.#Bn()})))}#lr(){this.cachedValue=null,this.cachedStringValue=null}#sr(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#ar(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#qn(){this.supportsRichText?(kd(this.editor),yu(this.editor),this.#cr(),this.#ur(),this.supportsMarkdown&&Ih(this.editor,Oh)):function(e){Va(e.registerCommand(cn,(e=>{const t=Oi();return!!pi(t)&&(t.deleteCharacter(e),!0)}),0),e.registerCommand(fn,(e=>{const t=Oi();return!!pi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(mn,(e=>{const t=Oi();return!!pi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(hn,(e=>{const t=Oi();if(!pi(t))return!1;if("string"==typeof e)t.insertText(e);else{const n=e.dataTransfer;if(null!=n)Du(n,t);else{const n=e.data;n&&t.insertText(n)}}return!0}),0),e.registerCommand(pn,(()=>{const e=Oi();return!!pi(e)&&(e.removeText(),!0)}),0),e.registerCommand(un,(e=>{const t=Oi();return!!pi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(dn,(()=>{const e=Oi();return!!pi(e)&&(e.insertLineBreak(),!0)}),0),e.registerCommand(wn,(e=>{const t=Oi();if(!pi(t))return!1;const n=e,r=n.shiftKey;return!!Sa(t,!0)&&(n.preventDefault(),wa(t,r,!0),!0)}),0),e.registerCommand(Sn,(e=>{const t=Oi();if(!pi(t))return!1;const n=e,r=n.shiftKey;return!!Sa(t,!1)&&(n.preventDefault(),wa(t,r,!1),!0)}),0),e.registerCommand(An,(t=>!!pi(Oi())&&(!Xu||"ko-KR"!==navigator.language)&&(t.preventDefault(),e.dispatchCommand(cn,!0))),0),e.registerCommand(On,(t=>!!pi(Oi())&&(t.preventDefault(),e.dispatchCommand(cn,!1))),0),e.registerCommand(Tn,(t=>{if(!pi(Oi()))return!1;if(null!==t){if((Xu||Yu||ed)&&Zu)return!1;t.preventDefault()}return e.dispatchCommand(un,!1)}),0),e.registerCommand(Un,(()=>(Ns(),!0)),0),e.registerCommand(Hn,(t=>!!pi(Oi())&&(td(t,e),!0)),0),e.registerCommand(Kn,(t=>!!pi(Oi())&&(function(e,t){td(e,t),t.update((()=>{const e=Oi();pi(e)&&e.removeText()}))}(t,e),!0)),0),e.registerCommand(gn,(t=>!!pi(Oi())&&(function(e,t){e.preventDefault(),t.update((()=>{const t=Oi(),n=Ya(e,ClipboardEvent)?e.clipboardData:null;null!=n&&pi(t)&&Du(n,t)}),{tag:Fr})}(t,e),!0)),0),e.registerCommand(Mn,(e=>!!pi(Oi())&&(e.preventDefault(),!0)),0),e.registerCommand(Bn,(e=>!!pi(Oi())&&(e.preventDefault(),!0)),0))}(this.editor),this.historyState={current:null,redoStack:[],undoStack:[]},Dh(this.editor,this.historyState,20)}#cr(){this.tableTools=$h("lexxy-table-tools"),this.append(this.tableTools)}#ur(){!function(e,t){if(!e.hasNodes([Bd,qd]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=lh);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(Bd,(t=>{e.getEditorState().read((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=os(n);null!==t&&ch(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(Bd,(n=>dh(n,e,t))),e.registerNodeTransform(Gr,(n=>ah(n,e,t))),e.registerNodeTransform(qd,(n=>ah(n,e,t))),e.registerCommand(Fn,(t=>{const n=function(e){const t=Oi();if(!pi(t)||!gh(t))return null;const n=e?Pn:In,r=e?Pn:Rn,i=t.anchor,o=t.focus;if(i.is(o))return r;const s=ph(t);if(1!==s.length)return n;const l=s[0];let a,c;0===l.length&&Rd(285),t.isBackward()?(a=o,c=i):(a=i,c=o);const u=Xd(l[0]),d=Qd(l[0]),h=ui(u.getKey(),0,"text"),g=ui(d.getKey(),d.getTextContentSize(),"text");return a.isBefore(h)||g.isBefore(c)?n:h.isBefore(a)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(Rn,(()=>!!gh(Oi())&&(Bi([li()]),!0)),1),e.registerCommand(In,(e=>fh(In)),1),e.registerCommand(Pn,(e=>fh(Pn)),1),e.registerCommand(kn,(e=>{const t=Oi();if(!pi(t))return!1;const{anchor:n}=t,r=n.getNode();return!!gh(t)&&(t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&$d(r.getParentOrThrow())?(e.preventDefault(),!0):mh(kn,e))}),1),e.registerCommand(En,(e=>{const t=Oi();if(!pi(t))return!1;const{anchor:n}=t,r=n.getNode();return!!gh(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&$d(r.getParentOrThrow())?(e.preventDefault(),!0):mh(En,e))}),1),e.registerCommand(vn,(e=>yh(vn,e)),1),e.registerCommand(Cn,(e=>yh(Cn,e)),1)),Va(...n)}(this.editor),this.codeLanguagePicker=$h("lexxy-code-language-picker"),this.append(this.codeLanguagePicker)}#Gn(){this.editor.registerCommand(Tn,(e=>(e.ctrlKey||e.metaKey||!this.supportsMultiLine)&&(e.preventDefault(),!0)),2)}#Jn(){this.addEventListener("focusin",this.#dr),this.addEventListener("focusout",this.#hr)}#dr(e){this.#gr(e.target)&&!this.currentlyFocused&&(Kh(this,"lexxy:focus"),this.currentlyFocused=!0)}#hr(e){this.#gr(e.relatedTarget)||(Kh(this,"lexxy:blur"),this.currentlyFocused=!1)}#gr(e){return this.contains(e)||this.toolbarElement?.contains(e)}#Hn(){this.isEmpty&&this.selection.placeCursorAtTheEnd()}#Mn(){document.querySelector(":focus")||this.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===this&&this.focus()}#Zn(){}#Yn(){this.#zn&&(this.toolbarElement.setEditor(this),this.extensions.initializeToolbars())}#$n(){const e=this.config.get("toolbar");return e&&!0!==e?document.getElementById(e):this.#pr()}get#zn(){return this.supportsRichText&&this.config.get("toolbar")}#pr(){const e=$h("lexxy-toolbar");return e.innerHTML=$a.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),this.prepend(e),e}#Un(){this.classList.toggle("lexxy-editor--empty",this.isEmpty)}#Bn(){this.#Rn.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#Rn.validity,this.#Rn.validationMessage,this.editorContentElement)}#Dn(){this.#ar(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.codeLanguagePicker&&(this.codeLanguagePicker.remove(),this.codeLanguagePicker=null),this.tableHandler&&(this.tableHandler.remove(),this.tableHandler=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#or)}#f(){this.disconnectedCallback(),this.valueBeforeDisconnect=null,this.connectedCallback()}}class $m extends HTMLElement{connectedCallback(){this.container=this.closest("details"),this.container.addEventListener("toggle",this.#fr.bind(this)),this.container.addEventListener("keydown",this.#mr.bind(this)),this.#yr(this.initialize.bind(this))}disconnectedCallback(){this.container.removeEventListener("keydown",this.#mr.bind(this))}get toolbar(){return this.closest("lexxy-toolbar")}get editorElement(){return this.toolbar.editorElement}get editor(){return this.toolbar.editor}initialize(){}close(){this.editor.focus(),this.container.open=!1}async#yr(e){await this.toolbar.editorConnected,e()}#fr(){this.container.open&&this.#br()}async#br(){this.#_r[0].focus(),this.#b()}#mr(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}async#b(){await Xp(),this.#K.forEach(((e,t)=>{e.setAttribute("tabindex",0===t?0:"-1")}))}get#_r(){return Array.from(this.querySelectorAll("button, input"))}get#K(){return Array.from(this.querySelectorAll("button"))}}class Hm extends $m{connectedCallback(){super.connectedCallback(),this.input=this.querySelector("input"),this.#xr()}#xr(){this.container.addEventListener("toggle",this.#fr.bind(this)),this.addEventListener("submit",this.#Sr.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#Cr.bind(this))}#fr({newState:e}){this.input.value=this.#wr,this.input.required="open"===e}#Sr(e){const t=e.submitter?.value;this.editor.dispatchCommand(t,this.input.value),this.close()}#Cr(){this.editor.dispatchCommand("unlink"),this.close()}get#wr(){let e="";return this.editor.getEditorState().read((()=>{const t=Oi();if(!pi(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if(Cu(n)){e=n.getURL();break}n=n.getParent()}})),e}}const Km="button.lexxy-highlight-button",Um="[data-command='removeHighlight']",Wm=Symbol("no_style");class Vm extends $m{connectedCallback(){super.connectedCallback(),this.#vr()}initialize(){this.#kr(),this.#Er()}#vr(){this.container.addEventListener("toggle",this.#fr.bind(this))}#Er(){this.#Tr.forEach((e=>e.addEventListener("click",this.#Nr.bind(this)))),this.querySelector(Um).addEventListener("click",this.#Ar.bind(this))}#kr(){const e=this.editorElement.config.get("highlight.buttons");this.#Lr("color",e.color),this.#Lr("background-color",e["background-color"]);const t=Math.max(e.color.length,e["background-color"].length);this.style.setProperty("--max-colors",t)}#Lr(e,t){t.forEach(((t,n)=>{this.#Or.appendChild(this.#Fr(e,t,n))}))}#Fr(e,t,n){const r=document.createElement("button");return r.dataset.style=e,r.style.setProperty(e,t),r.dataset.value=t,r.classList.add("lexxy-editor__toolbar-button","lexxy-highlight-button"),r.name=e+"-"+n,r}#fr({newState:e}){"open"===e&&this.editor.getEditorState().read((()=>{this.#Rr(Oi())}))}#Nr(e){e.preventDefault();const t=e.target.closest(Km);if(!t)return;const n=t.dataset.style,r=t.dataset.value;this.editor.dispatchCommand("toggleHighlight",{[n]:r}),this.close()}#Ar(e){e.preventDefault(),this.editor.dispatchCommand("removeHighlight"),this.close()}#Rr(e){if(!pi(e))return;const t=ka(e,"color",Wm),n=ka(e,"background-color",Wm);this.#Tr.forEach((e=>{const r=e.dataset.value===t||e.dataset.value===n;e.setAttribute("aria-pressed",r)}));const r=t!==Wm||n!==Wm;this.querySelector(Um).disabled=!r}get#Or(){return this.querySelector(".lexxy-highlight-colors")}get#Tr(){return Array.from(this.querySelectorAll(Km))}}class jm{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=$h("li",{role:"option",id:Uh("prompt-item"),tabindex:"0"});return n.classList.add("lexxy-prompt-menu__item"),n.appendChild(t),n}async loadPromptItemsFromUrl(e){try{const t=await fetch(e),n=Hh(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class qm extends jm{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#Ir(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#Ir(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return nf(e).includes(nf(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class Gm extends qm{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class Jm extends qm{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class Zm extends jm{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,o)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){o(e)}}),t)})))}(this.fetchFilteredListItems.bind(this),200)}async buildListItems(e=""){return await this.loadAndFilterListItems(e)}promptItemFor(e){return this.promptItemByListItem.get(e)}async fetchFilteredListItems(e){const t=await this.loadPromptItemsFromUrl(this.#Pr(e));return this.#Ir(t)}#Pr(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#Ir(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class Ym extends HTMLElement{constructor(){super(),this.keyListeners=[]}static observedAttributes=["connected"];connectedCallback(){this.source=this.#Mr(),this.#Dr(),this.toggleAttribute("connected",!0)}disconnectedCallback(){this.source=null,this.popoverElement=null}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#f()))}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get open(){return this.popoverElement?.classList?.contains("lexxy-prompt-menu--visible")}get closed(){return!this.open}get#Br(){return!this.supportsSpaceInSearches}#Mr(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new Zm(e):new Jm(e):new Gm(this.querySelectorAll("lexxy-prompt-item"))}#Dr(){const e=this.#zr.registerUpdateListener((({editorState:t})=>{t.read((()=>{const{node:t,offset:n}=this.#$r.selectedNodeWithOffset();if(t&&ii(t)){const r=t.getTextContent(),i=this.trigger.length;if(n>=i){if(r.slice(n-i,n)===this.trigger){const t=n===i,o=n>i?r[n-i-1]:null;(t||(" "===o||"\n"===o))&&(e(),this.#Hr())}}}}))}))}#Kr(){this.cursorPositionListener=this.#zr.registerUpdateListener((()=>{this.closed||this.#zr.read((()=>{const{node:e,offset:t}=this.#$r.selectedNodeWithOffset();if(e)if(ii(e)&&t>0){const n=e.getTextContent().slice(0,t).lastIndexOf(this.trigger),r=n+this.trigger.length-1;(-1===n||t<=r)&&this.#Ur()}else this.#Ur()}))}))}#Wr(){this.cursorPositionListener&&(this.cursorPositionListener(),this.cursorPositionListener=null)}get#zr(){return this.#Ce.editor}get#Ce(){return this.closest("lexxy-editor")}get#$r(){return this.#Ce.selection}async#Hr(){this.popoverElement??=await this.#Vr(),this.#jr(),await this.#qr(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#Gr(),this.#Ce.addEventListener("keydown",this.#Jr),this.#Ce.addEventListener("lexxy:change",this.#qr),this.#Zr(),this.#Kr()}#Zr(){this.keyListeners.push(this.#zr.registerCommand(Tn,this.#Yr.bind(this),3)),this.keyListeners.push(this.#zr.registerCommand(Fn,this.#Yr.bind(this),3)),this.#Br&&this.keyListeners.push(this.#zr.registerCommand(Nn,this.#Yr.bind(this),3)),this.keyListeners.push(this.#zr.registerCommand(kn,this.#Xr.bind(this),3)),this.keyListeners.push(this.#zr.registerCommand(En,this.#Qr.bind(this),3))}#Xr(e){return this.#ei(),e.preventDefault(),!0}#Qr(e){return this.#ti(),e.preventDefault(),!0}#Gr(){const e=this.#ni[0];e&&this.#ri(e)}get#ni(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#ri(e){this.#ii(),e.toggleAttribute("aria-selected",!0),e.scrollIntoView({block:"nearest",behavior:"smooth"}),e.focus(),this.#$r.preservingSelection((()=>{this.#Ce.focus()})),this.#oi.setAttribute("aria-controls",this.popoverElement.id),this.#oi.setAttribute("aria-activedescendant",e.id),this.#oi.setAttribute("aria-haspopup","listbox")}#ii(){this.#ni.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#oi.removeAttribute("aria-controls"),this.#oi.removeAttribute("aria-activedescendant"),this.#oi.removeAttribute("aria-haspopup")}#si(){const{x:e,y:t,fontSize:n}=this.#$r.cursorPosition,r=this.#Ce.getBoundingClientRect(),i=this.#oi.getBoundingClientRect().top-r.top;this.popoverElement.hasAttribute("data-anchored")||(this.popoverElement.style.left=`${e}px`,this.popoverElement.toggleAttribute("data-anchored",!0)),this.popoverElement.style.top=`${t+i}px`,this.popoverElement.style.bottom="auto";const o=this.popoverElement.getBoundingClientRect();(o.bottom>window.innerHeight||this.popoverElement.hasAttribute("data-clipped-at-bottom"))&&(this.popoverElement.style.top=t+i-o.height-n+"px",this.popoverElement.style.bottom="auto",this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#jr(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-anchored")}async#Ur(){this.#ii(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#Ce.removeEventListener("lexxy:change",this.#qr),this.#Ce.removeEventListener("keydown",this.#Jr),this.#li(),this.#Wr(),await Xp(),this.#Dr()}#li(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#qr=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#ai.containsTextBackUntil(this.trigger)?(await this.#ci(),await Xp(),this.#si()):this.#Ur()};async#ci(){const e=this.#ai.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#ui(t):this.#di(),this.#Gr()}#ui(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#di(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=$h("li",{innerHTML:this.#hi});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#hi(){return this.getAttribute("empty-results")||"Nothing found"}#Jr=e=>{"Escape"===e.key&&(this.#Ur(),this.#Ce.focus(),e.stopPropagation())};#ti(){const e=this.#gi+1;e<this.#ni.length&&this.#ri(this.#ni[e])}#ei(){const e=this.#gi-1;e>=0&&this.#ri(this.#ni[e])}get#gi(){return this.#ni.findIndex((e=>e.hasAttribute("aria-selected")))}get#pi(){return this.#ni[this.#gi]}#Yr(e){return e.preventDefault(),e.stopPropagation(),this.#fi(),!0}#fi(){this.#mi(),this.#Ur(),this.#Ce.focus()}#mi(){const e=this.source.promptItemFor(this.#pi);if(!e)return;const t=Array.from(e.querySelectorAll("template[type='editor']")),n=`${this.trigger}${this.#ai.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#yi(t,n):this.#bi(t,n,e.getAttribute("sgid"))}#yi(e,t){this.#zr.update((()=>{const n=e.flatMap((e=>this.#_i(e)));this.#ai.replaceTextBackUntil(t,n)}))}#_i(e){return Lu(this.#zr,Hh(`${e.innerHTML}`))}#bi(e,t,n=null){this.#zr.update((()=>{const r=this.#xi(e,n).flatMap((e=>[e,this.#Si()])).slice(0,-1);this.#ai.replaceTextBackUntil(t,r)}))}#xi(e,t=null){return e.map((e=>this.#Ci(e.innerHTML,e.getAttribute("content-type")||this.#wi,e.getAttribute("sgid")||t)))}#Si(){return ri(" ")}get#wi(){return`application/vnd.${Fa.global.get("attachmentContentTypeNamespace")}.${this.name}`}#Ci(e,t,n){return new sf({sgid:n,contentType:t,innerHtml:e})}get#ai(){return this.#Ce.contents}get#oi(){return this.#Ce.editorContentElement}async#Vr(){const e=$h("ul",{role:"listbox",id:Uh("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",Ma()),e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#vi),this.#Ce.appendChild(e),e}#vi=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#ri(t),this.#fi())};#f(){this.disconnectedCallback(),this.connectedCallback()}}class Xm extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.#ki(),this.#Ei()}#ki(){this.languagePickerElement=this.#Ti(),this.languagePickerElement.addEventListener("change",(()=>{this.#Ni(this.languagePickerElement.value)})),this.languagePickerElement.setAttribute("nonce",Ma()),this.appendChild(this.languagePickerElement)}#Ti(){const e=$h("select",{className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#Ai)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#Ai(){const e={...th};e.ruby||(e.ruby="Ruby"),e.php||(e.php="PHP"),e.go||(e.go="Go"),e.bash||(e.bash="Bash"),e.json||(e.json="JSON"),e.diff||(e.diff="Diff");const t=Object.entries(e).sort((([,e],[,t])=>e.localeCompare(t))),n=t.findIndex((([e])=>"plain"===e)),r=t.splice(n,1)[0];return Object.fromEntries([r,...t])}#Ni(e){this.editor.update((()=>{const t=this.#Li();t&&t.setLanguage(e)}))}#Ei(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#Li();e?this.#Oi(e):this.#Fi()}))}))}#Li(){const e=Oi();if(!pi(e))return null;const t=e.anchor.getNode(),n=t.getParent();return $d(t)?t:$d(n)?n:null}#Oi(e){const t=e.getLanguage();this.#Ri(t),this.#Ii(),this.#Pi(e)}#Ri(e){if(this.languagePickerElement&&e){const t=rh(e);this.languagePickerElement.value=t}}#Pi(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top,o=r.right-n.right;this.style.top=`${i}px`,this.style.right=`${o}px`}#Ii(){this.hidden=!1}#Fi(){this.hidden=!0}}class Qm{constructor(e){this.editor=e.editor,this.contents=e.contents,this.selection=e.selection,this.currentTableNodeKey=null,this.currentCellKey=null,this.#Mi()}destroy(){this.currentTableNodeKey=null,this.currentCellKey=null,this.#Di()}get currentCell(){return this.currentCellKey?this.editor.getEditorState().read((()=>{const e=os(this.currentCellKey);return e instanceof ig?e:null})):null}get currentTableNode(){return this.currentTableNodeKey?this.editor.getEditorState().read((()=>{const e=os(this.currentTableNodeKey);return e instanceof vp?e:null})):null}get currentRowCells(){const e=this.currentRowIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t[e]?.getChildren()??null))??null:null}get currentRowIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){const t=_g(e);return xg(t).getChildren().findIndex((e=>e.is(t)))}(e)))??0:0}get currentColumnCells(){const e=this.currentColumnIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t.map((t=>t.getChildAtIndex(e)))))??null:null}get currentColumnIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){return _g(e).getChildren().findIndex((t=>t.is(e)))}(e)))??0:0}get tableRows(){return this.editor.getEditorState().read((()=>this.currentTableNode?.getChildren()))??null}updateSelectedTable(){let e=null,t=null;this.editor.getEditorState().read((()=>{const n=Oi();if(!n||!this.selection.isTableCellSelected)return;const r=n.getNodes()[0];e=gp(r),t=pp(r)})),this.currentCellKey=e?.getKey()??null,this.currentTableNodeKey=t?.getKey()??null}executeTableCommand(e,t=null){"delete"!==e.action||"table"!==e.childType?"toggle"!==e.action?this.#Bi(e,t):this.#zi(e):this.#$i()}#Bi(e,t=null){this.#Hi(),this.editor.dispatchCommand(this.#Ki(e)),this.#Ui(e,t)}#zi(e){const t=e.childType;let n=null,r=null;"row"===t?(n=this.currentRowCells,r=rg):"column"===t&&(n=this.currentColumnCells,r=tg),n&&0!==n.length&&this.editor.update((()=>{const e=bg(n[0]);if(!e)return;const t=e.getHeaderStyles()^r;n.forEach((e=>{this.#Wi(e,t,r)}))}))}#$i(){this.#Hi(),this.editor.dispatchCommand("deleteTable")}#Hi(){this.editor.update((()=>{const e=Oi();if(!e)return;const t=e.getNodes()[0];gp(t)?.selectEnd()}))}#Ki(e){const{action:t,childType:n,direction:r}=e;return`${t}Table${rf(n)}${"insert"==t?rf(r):""}`}#Wi(e,t,n){const r=bg(e);r?.setHeaderStyles(t,n)}async#Vi(e,t){if(await Xp(),!this.currentTableNode)return;const n=this.tableRows;if(!n)return;const r=n[e];r&&this.editor.update((()=>{const e=bg(r.getChildAtIndex(t));e?.selectEnd()}))}#Ui(e,t=null){const{childType:n,direction:r}=e;let i=this.currentRowIndex,o=null!==t?t:this.currentColumnIndex;const s="delete"===e.action?-1:0,l="after"===r?1:s;"row"===n?i+=l:"column"===n&&(o+=l),this.#Vi(i,o)}#ji(){const e=this.tableRows;if(!e)return;const t=e.at(this.currentRowIndex+1);t&&this.editor.update((()=>{t.getChildAtIndex(this.currentColumnIndex)?.selectEnd()}))}#qi(){const e=this.currentCell;e&&this.editor.update((()=>{e.selectPrevious()}))}#Gi(){this.executeTableCommand({action:"insert",childType:"row",direction:"after"},0)}#Ji(){this.executeTableCommand({action:"delete",childType:"row"},-1)}#Zi(){const e=this.currentTableNode;this.executeTableCommand({action:"delete",childType:"row"}),this.editor.update((()=>{const t=e?.getNextSibling();if(Ao(t))t.selectStart();else{const e=No();this.currentTableNode.insertAfter(e),e.selectStart()}}))}#Yi(){if(!this.currentTableNode)return!1;const e=this.currentCell;return!!e&&""===e.getTextContent().trim()}#Xi(){if(!this.currentTableNode)return!1;const e=this.tableRows;return!!e&&e.length===this.currentRowIndex+1}#Qi(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&e.every((e=>""===e.getTextContent().trim()))}#eo(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&0===e.indexOf(this.currentCell)}#Mi(){this.unregisterBackspaceKeyHandler=this.editor.registerCommand(An,(e=>this.#to(e)),3),this.unregisterEnterKeyHandler=this.editor.registerCommand(Tn,(e=>this.#wt(e)),3)}#Di(){this.unregisterBackspaceKeyHandler?.(),this.unregisterEnterKeyHandler?.(),this.unregisterBackspaceKeyHandler=null,this.unregisterEnterKeyHandler=null}#to(e){return!!this.currentTableNode&&(this.#Qi()&&this.#eo()?(e.preventDefault(),this.#Ji(),!0):!(!this.#Yi()||this.#eo())&&(e.preventDefault(),this.#qi(),!0))}#wt(e){return!(e.ctrlKey||e.metaKey||e.shiftKey||!this.currentTableNode)&&(!this.selection.isInsideList&&!this.selection.isInsideCodeBlock&&(e.preventDefault(),this.#Xi()&&this.#Qi()?this.#Zi():this.#Xi()?this.#Gi():this.#ji(),!0))}}var ey={"insert-row-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 15C8.29055e-07 15.8284 0.671574 16.5 1.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V4.5L16.4922 4.34668C16.4154 3.59028 15.7767 3 15 3H13.5L13.5 4.5H15V9H1.5L1.5 4.5L3 4.5V3H1.5C0.671574 3 1.20956e-06 3.67157 1.24577e-06 4.5L7.86804e-07 15ZM15 10.5V15H1.5L1.5 10.5H15Z"/>\n <path d="M4.5 4.5H7.5V7.5H9V4.5H12L12 3L9 3V6.55671e-08L7.5 0V3L4.5 3V4.5Z"/>\n </svg>',"insert-row-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 13.5C7.50592e-07 14.3284 0.671574 15 1.5 15H3V13.5H1.5L1.5 9L15 9V13.5H13.5V15H15C15.7767 15 16.4154 14.4097 16.4922 13.6533L16.5 13.5V3L16.4922 2.84668C16.4205 2.14069 15.8593 1.57949 15.1533 1.50781L15 1.5L1.5 1.5C0.671574 1.5 1.28803e-06 2.17157 1.24577e-06 3L7.86804e-07 13.5ZM15 3V7.5L1.5 7.5L1.5 3L15 3Z"/>\n <path d="M7.5 15V18H9V15H12V13.5H9V10.5H7.5V13.5H4.5V15H7.5Z"/>\n </svg>',"delete-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M16.4922 12.1533C16.4154 12.9097 15.7767 13.5 15 13.5L12 13.5V12H15V6L1.5 6L1.5 12H4.5V13.5H1.5C0.723337 13.5 0.0846104 12.9097 0.00781328 12.1533L7.86804e-07 12L1.04907e-06 6C1.17362e-06 5.22334 0.590278 4.58461 1.34668 4.50781L1.5 4.5L15 4.5C15.8284 4.5 16.5 5.17157 16.5 6V12L16.4922 12.1533Z"/>\n <path d="M10.3711 15.9316L8.25 13.8096L6.12793 15.9316L5.06738 14.8711L7.18945 12.75L5.06738 10.6289L6.12793 9.56836L8.25 11.6895L10.3711 9.56836L11.4316 10.6289L9.31055 12.75L11.4316 14.8711L10.3711 15.9316Z"/>\n </svg>',"toggle-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0.00781328 13.6533C0.0846108 14.4097 0.723337 15 1.5 15L15 15L15.1533 14.9922C15.8593 14.9205 16.4205 14.3593 16.4922 13.6533L16.5 13.5V4.5L16.4922 4.34668C16.4205 3.64069 15.8593 3.07949 15.1533 3.00781L15 3L1.5 3C0.671574 3 1.24863e-06 3.67157 1.18021e-06 4.5L7.86804e-07 13.5L0.00781328 13.6533ZM15 9V13.5L1.5 13.5L1.5 9L15 9Z"/>\n </svg>',"insert-column-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 0C3.67157 0 3 0.671573 3 1.5V3H4.5V1.5H9V15H4.5V13.5H3V15C3 15.7767 3.59028 16.4154 4.34668 16.4922L4.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V1.5C16.5 0.671573 15.8284 6.03989e-09 15 0H4.5ZM15 15H10.5V1.5H15V15Z"/>\n <path d="M3 7.5H0V9H3V12H4.5V9H7.5V7.5H4.5V4.5H3V7.5Z"/>\n </svg>',"insert-column-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 0C14.3284 0 15 0.671573 15 1.5V3H13.5V1.5H9V15H13.5V13.5H15V15C15 15.7767 14.4097 16.4154 13.6533 16.4922L13.5 16.5H3L2.84668 16.4922C2.14069 16.4205 1.57949 15.8593 1.50781 15.1533L1.5 15V1.5C1.5 0.671573 2.17157 6.03989e-09 3 0H13.5ZM3 15H7.5V1.5H3V15Z"/>\n <path d="M15 7.5H18V9H15V12H13.5V9H10.5V7.5H13.5V4.5H15V7.5Z"/>\n </svg>',"delete-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1533 0.0078125C12.9097 0.0846097 13.5 0.723336 13.5 1.5V4.5H12V1.5H6V15H12V12H13.5V15C13.5 15.7767 12.9097 16.4154 12.1533 16.4922L12 16.5H6C5.22334 16.5 4.58461 15.9097 4.50781 15.1533L4.5 15V1.5C4.5 0.671573 5.17157 2.41596e-08 6 0H12L12.1533 0.0078125Z"/>\n <path d="M15.9316 6.12891L13.8105 8.24902L15.9326 10.3711L14.8711 11.4316L12.75 9.31055L10.6289 11.4316L9.56738 10.3711L11.6885 8.24902L9.56836 6.12891L10.6289 5.06836L12.75 7.18848L14.8711 5.06836L15.9316 6.12891Z"/>\n </svg>',"toggle-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.6533 17.9922C14.4097 17.9154 15 17.2767 15 16.5L15 3L14.9922 2.84668C14.9205 2.14069 14.3593 1.57949 13.6533 1.50781L13.5 1.5L4.5 1.5L4.34668 1.50781C3.59028 1.58461 3 2.22334 3 3L3 16.5C3 17.2767 3.59028 17.9154 4.34668 17.9922L4.5 18L13.5 18L13.6533 17.9922ZM9 3L13.5 3L13.5 16.5L9 16.5L9 3Z" />\n </svg>',"delete-table":'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M18.2129 19.2305C18.0925 20.7933 16.7892 22 15.2217 22H7.77832C6.21084 22 4.90753 20.7933 4.78711 19.2305L4 9H19L18.2129 19.2305Z"/><path d="M13 2C14.1046 2 15 2.89543 15 4H19C19.5523 4 20 4.44772 20 5V6C20 6.55228 19.5523 7 19 7H4C3.44772 7 3 6.55228 3 6V5C3 4.44772 3.44772 4 4 4H8C8 2.89543 8.89543 2 10 2H13Z"/>\n </svg>'};class ty extends HTMLElement{connectedCallback(){this.tableController=new Qm(this.#Ce),this.#kr(),this.#no(),this.#ro()}disconnectedCallback(){this.#io(),this.unregisterUpdateListener?.(),this.unregisterUpdateListener=null,this.removeEventListener("keydown",this.#oo),this.tableController?.destroy(),this.tableController=null}get#zr(){return this.#Ce.editor}get#Ce(){return this.closest("lexxy-editor")}get#so(){return Array.from(this.querySelectorAll("button, details > summary"))}#kr(){this.appendChild(this.#lo()),this.appendChild(this.#ao()),this.appendChild(this.#co()),this.addEventListener("keydown",this.#oo)}#uo(e,t,n){const r=$h("div",{className:`lexxy-table-control lexxy-table-control--${e}`}),i=this.#Fr(`Add ${e}`,{action:"insert",childType:e,direction:"after"},"+"),o=this.#Fr(`Remove ${e}`,{action:"delete",childType:e},"−"),s=$h("details",{className:"lexxy-table-control__more-menu"});s.setAttribute("name","lexxy-dropdown"),s.tabIndex=-1;const l=$h("summary",{},`_ ${e}s`);return t(l),s.appendChild(l),s.appendChild(n),r.appendChild(o),r.appendChild(s),r.appendChild(i),r}#lo(){return this.#uo("row",(e=>{this.rowCount=e}),this.#do("row"))}#ao(){return this.#uo("column",(e=>{this.columnCount=e}),this.#do("column"))}#do(e){const t=$h("div",{className:"lexxy-table-control__more-menu-details"}),n=this.#Fr(`Add ${e} before`,{action:"insert",childType:e,direction:"before"}),r=this.#Fr(`Add ${e} after`,{action:"insert",childType:e,direction:"after"}),i=this.#Fr(`Toggle ${e} style`,{action:"toggle",childType:e}),o=this.#Fr(`Remove ${e}`,{action:"delete",childType:e});return t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(o),t}#co(){const e=$h("div",{className:"lexxy-table-control"}),t=this.#Fr("Delete this table?",{action:"delete",childType:"table"});return t.classList.add("lexxy-table-control__button--delete-table"),e.appendChild(t),this.deleteContainer=e,e}#Fr(e,t={},n=this.#ho(t)){const r=$h("button",{className:"lexxy-table-control__button","aria-label":e,type:"button"});return r.tabIndex=-1,r.innerHTML=`${n} <span>${e}</span>`,r.dataset.action=t.action,r.dataset.childType=t.childType,r.dataset.direction=t.direction,r.addEventListener("click",(()=>this.#go(t))),r.addEventListener("mouseover",(()=>this.#po())),r.addEventListener("focus",(()=>this.#po())),r.addEventListener("mouseout",(()=>this.#po())),r}#ro(){this.unregisterKeyboardShortcuts=this.#zr.registerCommand(xn,this.#fo,3)}#io(){this.unregisterKeyboardShortcuts?.(),this.unregisterKeyboardShortcuts=null}#fo=e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F10"===e.key){const e=this.querySelector("button, [tabindex]:not([tabindex='-1'])");e?.focus()}};#oo=e=>{"Escape"===e.key?this.#mo():Da(this.#so,e)};#mo(){const e=this.tableController.currentCell;e&&(this.#zr.update((()=>{e.select(),this.#zr.focus()})),this.#yo())}async#po(){await Xp(),this.#bo();const e=this.querySelector("button:hover, button:focus");if(!e)return;const t={action:e.dataset.action,childType:e.dataset.childType,direction:e.dataset.direction};let n=null;switch(t.childType){case"row":n=this.tableController.currentRowCells;break;case"column":n=this.tableController.currentColumnCells;break;case"table":n=this.tableController.tableRows}n&&n.forEach((e=>{const n=this.#zr.getElementByKey(e.getKey());n&&(n.classList.toggle(zh.tableCellHighlight,!0),Object.assign(n.dataset,t))}))}#no(){this.unregisterUpdateListener=this.#zr.registerUpdateListener((()=>{this.tableController.updateSelectedTable();this.tableController.currentTableNode?this.#_o():this.#xo()}))}#go(e){this.tableController.executeTableCommand(e),this.#yo()}#_o(){this.style.display="flex",this.#yo()}#xo(){this.style.display="none",this.#bo()}#yo(){this.#So(),this.#Co(),this.#wo(),this.#po()}#wo(){this.querySelector("details[open]")?.removeAttribute("open")}#So(){const e=this.tableController.currentTableNode;if(!e)return;const t=this.#zr.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.#Ce.getBoundingClientRect(),i=n.top-r.top,o=(n.left+n.right)/2-r.left;this.style.top=`${i}px`,this.style.left=`${o}px`}#Co(){const e=this.tableController.currentTableNode;if(!e)return;const t=kp(this.#zr,e);if(!t)return;const n=t.rows,r=t.columns;this.rowCount.textContent=`${n} row${1===n?"":"s"}`,this.columnCount.textContent=`${r} column${1===r?"":"s"}`}#vo(){const e=this.tableController.currentCell;if(!e)return;const t=this.#zr.getElementByKey(e.getKey());t&&t.classList.add(zh.tableCellFocus)}#bo(){this.#Ce.querySelectorAll(`.${zh.tableCellFocus}`)?.forEach((e=>{e.classList.remove(zh.tableCellFocus)})),this.#Ce.querySelectorAll(`.${zh.tableCellHighlight}`)?.forEach((e=>{e.classList.remove(zh.tableCellHighlight),e.removeAttribute("data-action"),e.removeAttribute("data-child-type"),e.removeAttribute("data-direction")})),this.#vo()}#ho(e){const{action:t,childType:n}=e,r=[t,n,"insert"==t?e.direction:null].filter(Boolean).join("-");return ey[r]}}function ny(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(/<br\s*\/?>/gi,"\n");const r=o.languages?.[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=o.highlight(n,r,t),s=$h("code",{"data-language":t,innerHTML:i});e.replaceWith(s)}(e)}))}const ry=Fa.configure;setTimeout((function(){const e={"lexxy-toolbar":$a,"lexxy-editor":zm,"lexxy-link-dropdown":Hm,"lexxy-highlight-dropdown":Vm,"lexxy-prompt":Ym,"lexxy-code-language-picker":Xm,"lexxy-table-tools":ty};Object.entries(e).forEach((([e,t])=>{customElements.define(e,t)}))}),0);export{Vh as ActionTextAttachmentNode,Zh as ActionTextAttachmentUploadNode,sf as CustomActionTextAttachmentNode,Bp as Extension,Xh as HorizontalDividerNode,ry as configure,ny as highlightAll,ny as highlightCode};
11
+ const{entries:a,setPrototypeOf:c,isFrozen:u,getPrototypeOf:d,getOwnPropertyDescriptor:h}=Object;let{freeze:g,seal:p,create:f}=Object,{apply:m,construct:y}="undefined"!=typeof Reflect&&Reflect;g||(g=function(e){return e}),p||(p=function(e){return e}),m||(m=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),y||(y=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const b=R(Array.prototype.forEach),_=R(Array.prototype.lastIndexOf),x=R(Array.prototype.pop),C=R(Array.prototype.push),S=R(Array.prototype.splice),w=R(String.prototype.toLowerCase),v=R(String.prototype.toString),k=R(String.prototype.match),E=R(String.prototype.replace),T=R(String.prototype.indexOf),N=R(String.prototype.trim),A=R(Object.prototype.hasOwnProperty),L=R(RegExp.prototype.test),O=(F=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y(F,t)});var F;function R(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return m(e,t,r)}}function I(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:w;c&&c(e,null);let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(u(t)||(t[r]=e),i=e)}e[i]=!0}return e}function P(e){for(let t=0;t<e.length;t++){A(e,t)||(e[t]=null)}return e}function M(e){const t=f(null);for(const[n,r]of a(e)){A(e,n)&&(Array.isArray(r)?t[n]=P(r):r&&"object"==typeof r&&r.constructor===Object?t[n]=M(r):t[n]=r)}return t}function D(e,t){for(;null!==e;){const n=h(e,t);if(n){if(n.get)return R(n.get);if("function"==typeof n.value)return R(n.value)}e=d(e)}return function(){return null}}const B=g(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),z=g(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$=g(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),H=g(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),K=g(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),U=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),W=g(["#text"]),V=g(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),j=g(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),q=g(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Z=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),G=p(/\{\{[\w\W]*|[\w\W]*\}\}/gm),J=p(/<%[\w\W]*|[\w\W]*%>/gm),Y=p(/\$\{[\w\W]*/gm),X=p(/^data-[\-\w.\u00B7-\uFFFF]+$/),Q=p(/^aria-[\-\w]+$/),ee=p(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),te=p(/^(?:\w+script|data):/i),ne=p(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),re=p(/^html$/i),ie=p(/^[a-z][.\w]*(-[.\w]+)+$/i);var oe=Object.freeze({__proto__:null,ARIA_ATTR:Q,ATTR_WHITESPACE:ne,CUSTOM_ELEMENT:ie,DATA_ATTR:X,DOCTYPE_NAME:re,ERB_EXPR:J,IS_ALLOWED_URI:ee,IS_SCRIPT_OR_DATA:te,MUSTACHE_EXPR:G,TMPLIT_EXPR:Y});const se=1,le=3,ae=7,ce=8,ue=9,de=function(){return"undefined"==typeof window?null:window};var he=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de();const n=t=>e(t);if(n.version="3.3.0",n.removed=[],!t||!t.document||t.document.nodeType!==ue||!t.Element)return n.isSupported=!1,n;let{document:r}=t;const i=r,o=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:l,Node:c,Element:u,NodeFilter:d,NamedNodeMap:h=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:y}=t,F=u.prototype,R=D(F,"cloneNode"),P=D(F,"remove"),G=D(F,"nextSibling"),J=D(F,"childNodes"),Y=D(F,"parentNode");if("function"==typeof l){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let X,Q="";const{implementation:te,createNodeIterator:ne,createDocumentFragment:ie,getElementsByTagName:he}=r,{importNode:ge}=i;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};n.isSupported="function"==typeof a&&"function"==typeof Y&&te&&void 0!==te.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:me,TMPLIT_EXPR:ye,DATA_ATTR:be,ARIA_ATTR:_e,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Se}=oe;let{IS_ALLOWED_URI:we}=oe,ve=null;const ke=I({},[...B,...z,...$,...K,...W]);let Ee=null;const Te=I({},[...V,...j,...q,...Z]);let Ne=Object.seal(f(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,Le=null;const Oe=Object.seal(f(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Re=!0,Ie=!1,Pe=!0,Me=!1,De=!0,Be=!1,ze=!1,$e=!1,He=!1,Ke=!1,Ue=!1,We=!0,Ve=!1,je=!0,qe=!1,Ze={},Ge=null;const Je=I({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ye=null;const Xe=I({},["audio","video","img","source","image","track"]);let Qe=null;const et=I({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tt="http://www.w3.org/1998/Math/MathML",nt="http://www.w3.org/2000/svg",rt="http://www.w3.org/1999/xhtml";let it=rt,ot=!1,st=null;const lt=I({},[tt,nt,rt],v);let at=I({},["mi","mo","mn","ms","mtext"]),ct=I({},["annotation-xml"]);const ut=I({},["title","style","font","a","script"]);let dt=null;const ht=["application/xhtml+xml","text/html"];let gt=null,pt=null;const ft=r.createElement("form"),mt=function(e){return e instanceof RegExp||e instanceof Function},yt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!pt||pt!==e){if(e&&"object"==typeof e||(e={}),e=M(e),dt=-1===ht.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,gt="application/xhtml+xml"===dt?v:w,ve=A(e,"ALLOWED_TAGS")?I({},e.ALLOWED_TAGS,gt):ke,Ee=A(e,"ALLOWED_ATTR")?I({},e.ALLOWED_ATTR,gt):Te,st=A(e,"ALLOWED_NAMESPACES")?I({},e.ALLOWED_NAMESPACES,v):lt,Qe=A(e,"ADD_URI_SAFE_ATTR")?I(M(et),e.ADD_URI_SAFE_ATTR,gt):et,Ye=A(e,"ADD_DATA_URI_TAGS")?I(M(Xe),e.ADD_DATA_URI_TAGS,gt):Xe,Ge=A(e,"FORBID_CONTENTS")?I({},e.FORBID_CONTENTS,gt):Je,Ae=A(e,"FORBID_TAGS")?I({},e.FORBID_TAGS,gt):M({}),Le=A(e,"FORBID_ATTR")?I({},e.FORBID_ATTR,gt):M({}),Ze=!!A(e,"USE_PROFILES")&&e.USE_PROFILES,Fe=!1!==e.ALLOW_ARIA_ATTR,Re=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Me=e.SAFE_FOR_TEMPLATES||!1,De=!1!==e.SAFE_FOR_XML,Be=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,Ke=e.RETURN_DOM_FRAGMENT||!1,Ue=e.RETURN_TRUSTED_TYPE||!1,$e=e.FORCE_BODY||!1,We=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,qe=e.IN_PLACE||!1,we=e.ALLOWED_URI_REGEXP||ee,it=e.NAMESPACE||rt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,ct=e.HTML_INTEGRATION_POINTS||ct,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&mt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ne.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ne.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(Re=!1),Ke&&(He=!0),Ze&&(ve=I({},W),Ee=[],!0===Ze.html&&(I(ve,B),I(Ee,V)),!0===Ze.svg&&(I(ve,z),I(Ee,j),I(Ee,Z)),!0===Ze.svgFilters&&(I(ve,$),I(Ee,j),I(Ee,Z)),!0===Ze.mathMl&&(I(ve,K),I(Ee,q),I(Ee,Z))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Oe.tagCheck=e.ADD_TAGS:(ve===ke&&(ve=M(ve)),I(ve,e.ADD_TAGS,gt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Oe.attributeCheck=e.ADD_ATTR:(Ee===Te&&(Ee=M(Ee)),I(Ee,e.ADD_ATTR,gt))),e.ADD_URI_SAFE_ATTR&&I(Qe,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ge===Je&&(Ge=M(Ge)),I(Ge,e.FORBID_CONTENTS,gt)),je&&(ve["#text"]=!0),Be&&I(ve,["html","head","body"]),ve.table&&(I(ve,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw O('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw O('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');X=e.TRUSTED_TYPES_POLICY,Q=X.createHTML("")}else void 0===X&&(X=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}}(y,o)),null!==X&&"string"==typeof Q&&(Q=X.createHTML(""));g&&g(e),pt=e}},bt=I({},[...z,...$,...H]),_t=I({},[...K,...U]),xt=function(e){C(n.removed,{element:e});try{Y(e).removeChild(e)}catch(t){P(e)}},Ct=function(e,t){try{C(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){C(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(He||Ke)try{xt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},St=function(e){let t=null,n=null;if($e)e="<remove></remove>"+e;else{const t=k(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===dt&&it===rt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=X?X.createHTML(e):e;if(it===rt)try{t=(new m).parseFromString(i,dt)}catch(e){}if(!t||!t.documentElement){t=te.createDocument(it,"template",null);try{t.documentElement.innerHTML=ot?Q:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),it===rt?he.call(t,Be?"html":"body")[0]:Be?t.documentElement:o},wt=function(e){return ne.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},vt=function(e){return e instanceof p&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},kt=function(e){return"function"==typeof c&&e instanceof c};function Et(e,t,r){b(e,(e=>{e.call(n,t,r,pt)}))}const Tt=function(e){let t=null;if(Et(pe.beforeSanitizeElements,e,null),vt(e))return xt(e),!0;const r=gt(e.nodeName);if(Et(pe.uponSanitizeElement,e,{tagName:r,allowedTags:ve}),De&&e.hasChildNodes()&&!kt(e.firstElementChild)&&L(/<[/\w!]/g,e.innerHTML)&&L(/<[/\w!]/g,e.textContent))return xt(e),!0;if(e.nodeType===ae)return xt(e),!0;if(De&&e.nodeType===ce&&L(/<[/\w]/g,e.data))return xt(e),!0;if(!(Oe.tagCheck instanceof Function&&Oe.tagCheck(r))&&(!ve[r]||Ae[r])){if(!Ae[r]&&At(r)){if(Ne.tagNameCheck instanceof RegExp&&L(Ne.tagNameCheck,r))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(r))return!1}if(je&&!Ge[r]){const t=Y(e)||e.parentNode,n=J(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=R(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,G(e))}}}return xt(e),!0}return e instanceof u&&!function(e){let t=Y(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});const n=w(e.tagName),r=w(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===nt?t.namespaceURI===rt?"svg"===n:t.namespaceURI===tt?"svg"===n&&("annotation-xml"===r||at[r]):Boolean(bt[n]):e.namespaceURI===tt?t.namespaceURI===rt?"math"===n:t.namespaceURI===nt?"math"===n&&ct[r]:Boolean(_t[n]):e.namespaceURI===rt?!(t.namespaceURI===nt&&!ct[r])&&!(t.namespaceURI===tt&&!at[r])&&!_t[n]&&(ut[n]||!bt[n]):!("application/xhtml+xml"!==dt||!st[e.namespaceURI]))}(e)?(xt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!L(/<\/no(script|embed|frames)/i,e.innerHTML)?(Me&&e.nodeType===le&&(t=e.textContent,b([fe,me,ye],(e=>{t=E(t,e," ")})),e.textContent!==t&&(C(n.removed,{element:e.cloneNode()}),e.textContent=t)),Et(pe.afterSanitizeElements,e,null),!1):(xt(e),!0)},Nt=function(e,t,n){if(We&&("id"===t||"name"===t)&&(n in r||n in ft))return!1;if(Re&&!Le[t]&&L(be,t));else if(Fe&&L(_e,t));else if(Oe.attributeCheck instanceof Function&&Oe.attributeCheck(t,e));else if(!Ee[t]||Le[t]){if(!(At(e)&&(Ne.tagNameCheck instanceof RegExp&&L(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&L(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t,e))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&L(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Qe[t]);else if(L(we,E(n,Ce,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==T(n,"data:")||!Ye[e]){if(Ie&&!L(xe,E(n,Ce,"")));else if(n)return!1}else;return!0},At=function(e){return"annotation-xml"!==e&&k(e,Se)},Lt=function(e){Et(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||vt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:l,value:a}=o,c=gt(s),u=a;let d="value"===s?u:N(u);if(r.attrName=c,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,Et(pe.uponSanitizeAttribute,e,r),d=r.attrValue,!Ve||"id"!==c&&"name"!==c||(Ct(s,e),d="user-content-"+d),De&&L(/((--!?|])>)|<\/(style|title|textarea)/i,d)){Ct(s,e);continue}if("attributename"===c&&k(d,"href")){Ct(s,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ct(s,e);continue}if(!Pe&&L(/\/>/i,d)){Ct(s,e);continue}Me&&b([fe,me,ye],(e=>{d=E(d,e," ")}));const h=gt(e.nodeName);if(Nt(h,c,d)){if(X&&"object"==typeof y&&"function"==typeof y.getAttributeType)if(l);else switch(y.getAttributeType(h,c)){case"TrustedHTML":d=X.createHTML(d);break;case"TrustedScriptURL":d=X.createScriptURL(d)}if(d!==u)try{l?e.setAttributeNS(l,s,d):e.setAttribute(s,d),vt(e)?xt(e):x(n.removed)}catch(t){Ct(s,e)}}else Ct(s,e)}Et(pe.afterSanitizeAttributes,e,null)},Ot=function e(t){let n=null;const r=wt(t);for(Et(pe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Et(pe.uponSanitizeShadowNode,n,null),Tt(n),Lt(n),n.content instanceof s&&e(n.content);Et(pe.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,l=null,a=null;if(ot=!e,ot&&(e="\x3c!--\x3e"),"string"!=typeof e&&!kt(e)){if("function"!=typeof e.toString)throw O("toString is not a function");if("string"!=typeof(e=e.toString()))throw O("dirty is not a string, aborting")}if(!n.isSupported)return e;if(ze||yt(t),n.removed=[],"string"==typeof e&&(qe=!1),qe){if(e.nodeName){const t=gt(e.nodeName);if(!ve[t]||Ae[t])throw O("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)r=St("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===se&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!He&&!Me&&!Be&&-1===e.indexOf("<"))return X&&Ue?X.createHTML(e):e;if(r=St(e),!r)return He?null:Ue?Q:""}r&&$e&&xt(r.firstChild);const u=wt(qe?e:r);for(;l=u.nextNode();)Tt(l),Lt(l),l.content instanceof s&&Ot(l.content);if(qe)return e;if(He){if(Ke)for(a=ie.call(r.ownerDocument);r.firstChild;)a.appendChild(r.firstChild);else a=r;return(Ee.shadowroot||Ee.shadowrootmode)&&(a=ge.call(i,a,!0)),a}let d=Be?r.outerHTML:r.innerHTML;return Be&&ve["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&L(re,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),Me&&b([fe,me,ye],(e=>{d=E(d,e," ")})),X&&Ue?X.createHTML(d):d},n.setConfig=function(){yt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ze=!0},n.clearConfig=function(){pt=null,ze=!1},n.isValidAttribute=function(e,t,n){pt||yt({});const r=gt(e),i=gt(t);return Nt(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&C(pe[e],t)},n.removeHook=function(e,t){if(void 0!==t){const n=_(pe[e],t);return-1===n?void 0:S(pe[e],n,1)[0]}return x(pe[e])},n.removeHooks=function(e){pe[e]=[]},n.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},n}();function ge(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function pe(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const fe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,me=fe&&"documentMode"in document?document.documentMode:null,ye=fe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),be=fe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_e=!(!fe||!("InputEvent"in window)||me)&&"getTargetRanges"in new window.InputEvent("input"),xe=fe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ce=fe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Se=fe&&/Android/.test(navigator.userAgent),we=fe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ve=fe&&Se&&we,ke=fe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ye&&!we,Ee=0,Te=1,Ne=2,Ae=1,Le=2,Oe=3,Fe=4,Re=5,Ie=6,Pe=xe||Ce||ke?" ":"​",Me="\n\n",De=be?" ":Pe,Be="֑-߿יִ-﷽ﹰ-ﻼ",ze="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",$e=new RegExp("^[^"+ze+"]*["+Be+"]"),He=new RegExp("^[^"+Be+"]*["+ze+"]"),Ke={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Ue={directionless:1,unmergeable:2},We={center:2,end:6,justify:4,left:1,right:3,start:5},Ve={[Le]:"center",[Ie]:"end",[Fe]:"justify",[Ae]:"left",[Oe]:"right",[Re]:"start"},je={normal:0,segmented:2,token:1},qe={[Ee]:"normal",[Ne]:"segmented",[Te]:"token"},Ze="$config";function Ge(e,t,n,r,i,o){let s=e.getFirstChild();for(;null!==s;){const e=s.__key;s.__parent===t&&(Eo(s)&&Ge(s,e,n,r,i,o),n.has(e)||o.delete(e),i.push(e)),s=s.getNextSibling()}}let Je=!1,Ye=0;function Xe(e){Ye=e.timeStamp}function Qe(e,t,n){const r="BR"===e.nodeName,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&void 0!==bs(e,n)}function et(e,t,n){const r=ll(Xs(n));let i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);const s=e.nodeValue;null!==s&&Os(t,s,i,o,!1)}function tt(e,t,n){if(wi(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return ss(t)&&n.isAttached()}function nt(e,t,n,r){for(let i=e;i&&!Cl(i);i=qs(i)){const e=bs(i,t);if(void 0!==e){const t=ms(e,n);if(t)return Ao(t)||!cl(i)?void 0:[i,t]}else if(i===r)return[r,ws(n)]}}function rt(e,t,n){Je=!0;const r=performance.now()-Ye>100;try{So(e,(()=>{const i=$i()||function(e){return e.getEditorState().read((()=>{const e=$i();return null!==e?e.clone():null}))}(e),o=new Map,s=e.getRootElement(),l=e._editorState,a=e._blockCursorElement;let c=!1,u="";for(let n=0;n<t.length;n++){const d=t[n],h=d.type,g=d.target,p=nt(g,e,l,s);if(!p)continue;const[f,m]=p;if("characterData"===h)r&&gi(m)&&ss(g)&&tt(i,g,m)&&et(g,m,e);else if("childList"===h){c=!0;const t=d.addedNodes;for(let n=0;n<t.length;n++){const r=t[n],i=ys(r),o=r.parentNode;if(null!=o&&r!==a&&null===i&&!Qe(r,o,e)){if(be){const e=(cl(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}o.removeChild(r)}}const n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){const r=n[i];(Qe(r,g,e)||a===r)&&(g.appendChild(r),t++)}r!==t&&o.set(f,m)}}}if(o.size>0)for(const[t,n]of o)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){const n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){const n=r[t],o=n.parentNode;null==o||"BR"!==n.nodeName||Qe(n,i,e)||o.removeChild(n)}}n.takeRecords()}null!==i&&(c&&vs(i),be&&Ws(e)&&i.insertRawText(u))}))}finally{Je=!1}}function it(e){const t=e._observer;null!==t&&rt(e,t.takeRecords(),t)}function ot(e){!function(e){0===Ye&&Xs(e).addEventListener("textInput",Xe,!0)}(e),e._observer=new MutationObserver(((t,n)=>{rt(e,t,n)}))}let st=class{key;parse;unparse;isEqual;defaultValue;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||ft).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0)}};function lt(e,t){return new st(e,t)}function at(e,t,n="latest"){const r=("latest"===n?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function ct(e,t,n){let r;if(so(),"function"==typeof n){const i=e.getLatest(),o=at(i,t);if(r=n(o),t.isEqual(o,r))return i}else r=n;const i=e.getWritable();return ht(i).updateFromKnown(t,r),i}function ut(e){const t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:e}=wl(r);if(e&&e.stateConfigs)for(const r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}let dt=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(e,t,n){let r=n.size;if(t)for(const i in t){const t=e.get(i);t&&n.has(t)||r++}return r}(o,n,r);this.size=s}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return pt(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;const{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=e.get(i);n?t.has(n)||t.set(n,n.parse(o)):(r=r||{},r[i]=o)}return r}(n.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){const n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=pt(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){const n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function ht(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new dt(t,gt(t));return t.__state=n,n}function gt(e){return e.__state?e.__state.sharedNodeState:Zo(fl(),e.getType()).sharedNodeState}function pt(e){if(e)for(const t in e)return e}function ft(e){return e}function mt(e,t,n){for(const[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);const t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function yt(e,t,n){const{unknownState:r}=t,i=n?n.unknownState:void 0;if(r)for(const[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0;return!1}function bt(e,t){const n=e.__state;return n&&n.node===e?n.getWritable(t):n}function _t(e,t){const n=e.__mode,r=e.__format,i=e.__style,o=t.__mode,s=t.__format,l=t.__style,a=e.__state,c=t.__state;return(null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===e.__state||a===c||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;const n=new Set;return!(e&&mt(n,e,t)||t&&mt(n,t,e)||e&&yt(n,e,t)||t&&yt(n,t,e))}(a,c))}function xt(e,t){const n=e.mergeWithSibling(t),r=co()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Ct(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&gi(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(_t(t,r)){r=xt(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&gi(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(_t(r,n)){r=xt(r,n);break}break}n.remove()}}else r.remove()}function St(e){return wt(e.anchor),wt(e.focus),e}function wt(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),gi(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!Eo(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let vt,kt,Et,Tt,Nt,At,Lt,Ot,Ft,Rt,It="",Pt=null,Mt=null,Dt=!1,Bt=!1;function zt(e,t){const n=Lt.get(e);if(null!==t){const n=tn(e);n.parentNode===t&&t.removeChild(n)}if(Ot.has(e)||kt._keyToDOMMap.delete(e),Eo(n)){const e=Jt(n,Lt);$t(e,0,e.length-1,null)}void 0!==n&&Hs(Rt,Et,Tt,n,"destroyed")}function $t(e,t,n,r){for(let i=t;i<=n;++i){const t=e[i];void 0!==t&&zt(t,r)}}function Ht(e,t){e.setProperty("text-align",t)}const Kt="40px";function Ut(e,t){const n=vt.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(0===t)return void e.style.setProperty("padding-inline-start","");const r=getComputedStyle(kt._rootElement||e).getPropertyValue("--lexical-indent-base-value")||Kt;e.style.setProperty("padding-inline-start",`calc(${t} * ${r})`)}function Wt(e,t){const n=e.style;0===t?Ht(n,""):1===t?Ht(n,"left"):2===t?Ht(n,"center"):3===t?Ht(n,"right"):4===t?Ht(n,"justify"):5===t?Ht(n,"start"):6===t&&Ht(n,"end")}function Vt(e,t){const n=function(e){const t=e.__dir;if(null!==t)return t;if(Oo(e))return null;const n=e.getParentOrThrow();return Oo(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function jt(e,t){const n=Ot.get(e);void 0===n&&ge(60);const r=n.createDOM(vt,kt);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,r,kt),gi(n)?r.setAttribute("data-lexical-text","true"):Ao(n)&&r.setAttribute("data-lexical-decorator","true"),Eo(n)){const e=n.__indent,t=n.__size;if(Vt(r,n),0!==e&&Ut(r,e),0!==t){const e=t-1;qt(Jt(n,Ot),n,0,e,n.getDOMSlot(r))}const i=n.__format;0!==i&&Wt(r,i),n.isInline()||Gt(null,n,r)}else{const t=n.getTextContent();if(Ao(n)){const t=n.decorate(kt,vt);null!==t&&Xt(e,t),r.contentEditable="false"}It+=t}return null!==t&&t.insertChild(r),Hs(Rt,Et,Tt,n,"created"),r}function qt(e,t,n,r,i){const o=It;It="";let s=n;for(;s<=r;++s){jt(e[s],i);const t=Ot.get(e[s]);null!==t&&gi(t)?null===Pt&&(Pt=t.getFormat(),Mt=t.getStyle()):Eo(t)&&s<r&&!t.isInline()&&(It+=Me)}i.element.__lexicalTextContent=It,It=o+It}function Zt(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return Gr(e)?"line-break":Ao(e)&&e.isInline()?"decorator":null}return"empty"}return null}function Gt(e,t,n){const r=Zt(e,Lt),i=Zt(t,Ot);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function Jt(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&ge(101),n.push(r),r=e.__next}return n}function Yt(e,t){const n=Lt.get(e);let r=Ot.get(e);void 0!==n&&void 0!==r||ge(61);const i=Dt||At.has(e)||Nt.has(e),o=js(kt,e);if(n===r&&!i){let e;if(Eo(n)){const t=o.__lexicalTextContent;"string"==typeof t?e=t:(e=n.getTextContent(),o.__lexicalTextContent=e)}else e=n.getTextContent();return It+=e,o}if(n!==r&&i&&Hs(Rt,Et,Tt,r,"updated"),r.updateDOM(n,o,vt)){const n=jt(e,null);return null===t&&ge(62),t.replaceChild(n,o),zt(e,null),n}if(Eo(n)){Eo(r)||ge(334,e);const t=r.__indent;(Dt||t!==n.__indent)&&Ut(o,t);const s=r.__format;if((Dt||s!==n.__format)&&Wt(o,s),i)(function(e,t,n){var r;Pt=null,Mt=null,function(e,t,n){const r=It,i=e.__size,o=t.__size;It="";const s=n.element;if(1===i&&1===o){const n=e.__first,i=t.__first;if(n===i)Yt(n,s);else{const e=tn(n),t=jt(i,null);try{s.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const o=`${r.toString()} Parent: ${s.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(o)}throw r}zt(n,null)}const o=Ot.get(i);gi(o)&&null===Pt&&(Pt=o.getFormat(),Mt=o.getStyle())}else{const r=Jt(e,Lt),l=Jt(t,Ot);if(r.length!==i&&ge(227),l.length!==o&&ge(228),0===i)0!==o&&qt(l,0,0,o-1,n);else if(0===o){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;$t(r,0,i-1,e?null:s),e&&(s.textContent="")}}else!function(e,t,n,r,i,o){const s=r-1,l=i-1;let a,c,u=o.getFirstChild(),d=0,h=0;for(;d<=s&&h<=l;){const e=t[d],r=n[h];if(e===r)u=Qt(Yt(r,o.element)),d++,h++;else{if(void 0===c&&(c=en(n,h)),void 0===a)a=en(t,d);else if(!a.has(e)){d++;continue}if(!c.has(e)){u=Qt(tn(e)),zt(e,o.element),d++,a.delete(e);continue}if(a.has(r)){const e=js(kt,r);e!==u&&o.withBefore(u).insertChild(e),u=Qt(Yt(r,o.element)),d++,h++}else jt(r,o.withBefore(u)),h++}const i=Ot.get(r);null!==i&&gi(i)?null===Pt&&(Pt=i.getFormat(),Mt=i.getStyle()):Eo(i)&&h<=l&&!i.isInline()&&(It+=Me)}const g=d>s,p=h>l;if(g&&!p){const e=n[l+1],t=void 0===e?null:kt.getElementByKey(e);qt(n,0,h,l,o.withBefore(t))}else p&&!g&&$t(t,d,s,o.element)}(0,r,l,i,o,n)}s.__lexicalTextContent=It,It=r+It}(e,t,t.getDOMSlot(n)),r=t,null==Pt||Pt===r.__textFormat||Bt||r.setTextFormat(Pt),function(e){null==Mt||Mt===e.__textStyle||Bt||e.setTextStyle(Mt)}(t)})(n,r,o),Oo(r)||r.isInline()||Gt(n,r,o);else{const e=o.__lexicalTextContent;let t;"string"==typeof e?t=e:(t=n.getTextContent(),o.__lexicalTextContent=t),It+=t}if((Dt||r.__dir!==n.__dir)&&(Vt(o,r),Oo(r)&&!Dt))for(const e of r.getChildren())Eo(e)&&Vt(js(kt,e.getKey()),e)}else{const t=r.getTextContent();if(Ao(r)){const t=r.decorate(kt,vt);null!==t&&Xt(e,t)}It+=t}if(!Bt&&Oo(r)&&r.__cachedText!==It){const e=r.getWritable();e.__cachedText=It,r=e}return o}function Xt(e,t){let n=kt._pendingDecorators;const r=kt._decorators;if(null===n){if(r[e]===t)return;n=xs(kt)}n[e]=t}function Qt(e){let t=e.nextSibling;return null!==t&&t===kt._blockCursorElement&&(t=t.nextSibling),t}function en(e,t){const n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function tn(e){const t=Ft.get(e);return void 0===t&&ge(75,e),t}function nn(e){return{type:e}}const rn=nn("SELECTION_CHANGE_COMMAND"),on=nn("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),sn=nn("CLICK_COMMAND"),ln=nn("BEFORE_INPUT_COMMAND"),an=nn("INPUT_COMMAND"),cn=nn("COMPOSITION_START_COMMAND"),un=nn("COMPOSITION_END_COMMAND"),dn=nn("DELETE_CHARACTER_COMMAND"),hn=nn("INSERT_LINE_BREAK_COMMAND"),gn=nn("INSERT_PARAGRAPH_COMMAND"),pn=nn("CONTROLLED_TEXT_INSERTION_COMMAND"),fn=nn("PASTE_COMMAND"),mn=nn("REMOVE_TEXT_COMMAND"),yn=nn("DELETE_WORD_COMMAND"),bn=nn("DELETE_LINE_COMMAND"),_n=nn("FORMAT_TEXT_COMMAND"),xn=nn("UNDO_COMMAND"),Cn=nn("REDO_COMMAND"),Sn=nn("KEYDOWN_COMMAND"),wn=nn("KEY_ARROW_RIGHT_COMMAND"),vn=nn("MOVE_TO_END"),kn=nn("KEY_ARROW_LEFT_COMMAND"),En=nn("MOVE_TO_START"),Tn=nn("KEY_ARROW_UP_COMMAND"),Nn=nn("KEY_ARROW_DOWN_COMMAND"),An=nn("KEY_ENTER_COMMAND"),Ln=nn("KEY_SPACE_COMMAND"),On=nn("KEY_BACKSPACE_COMMAND"),Fn=nn("KEY_ESCAPE_COMMAND"),Rn=nn("KEY_DELETE_COMMAND"),In=nn("KEY_TAB_COMMAND"),Pn=nn("INSERT_TAB_COMMAND"),Mn=nn("INDENT_CONTENT_COMMAND"),Dn=nn("OUTDENT_CONTENT_COMMAND"),Bn=nn("DROP_COMMAND"),zn=nn("FORMAT_ELEMENT_COMMAND"),$n=nn("DRAGSTART_COMMAND"),Hn=nn("DRAGOVER_COMMAND"),Kn=nn("DRAGEND_COMMAND"),Un=nn("COPY_COMMAND"),Wn=nn("CUT_COMMAND"),Vn=nn("SELECT_ALL_COMMAND"),jn=nn("CLEAR_EDITOR_COMMAND"),qn=nn("CLEAR_HISTORY_COMMAND"),Zn=nn("CAN_REDO_COMMAND"),Gn=nn("CAN_UNDO_COMMAND"),Jn=nn("FOCUS_COMMAND"),Yn=nn("BLUR_COMMAND"),Xn=nn("KEY_MODIFIER_COMMAND"),Qn=Object.freeze({}),er=[["keydown",function(e,t){tr=e.timeStamp,nr=e.key,t.isComposing()||Vs(t,Sn,e)}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;ul(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&So(t,(()=>{Yo(n)||(ar=!0)}))}],["compositionstart",function(e,t){Vs(t,cn,e)}],["compositionend",function(e,t){be?ur=!0:Ce||!xe&&!ke?Vs(t,un,e):(dr=!0,hr=e.data)}],["input",function(e,t){e.stopPropagation(),So(t,(()=>{t.dispatchCommand(an,e)}),{event:e}),ir=null}],["click",function(e,t){So(t,(()=>{const n=$i(),r=ll(Xs(t)),i=Hi();if(r)if(wi(n)){const t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!Oo(o)&&1===Ss().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&o!==n.focus.getNode()){const e=vl(o,(e=>Eo(e)&&!e.isInline()));Eo(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(cl(n)||ss(n))&&vs(zi(i,r,t,e))}Vs(t,sn,e)}))}],["cut",Qn],["copy",Qn],["dragstart",Qn],["dragover",Qn],["dragend",Qn],["paste",Qn],["focus",Qn],["blur",Qn],["drop",Qn]];_e&&er.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType;"deleteCompositionText"===n||be&&Ws(t)||"insertCompositionText"!==n&&Vs(t,ln,e)}(e,t)]);let tr=0,nr=null,rr=0,ir=null;const or=new WeakMap,sr=new WeakMap;let lr=!1,ar=!1,cr=!1,ur=!1,dr=!1,hr="",gr=null,pr=[0,"",0,"root",0];function fr(e,t,n,r,i){const o=e.anchor,s=e.focus,l=o.getNode(),a=co(),c=ll(Xs(a)),u=null!==c?c.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==s.key||!gi(l)||(!i&&(!_e||rr<r+50)||l.isDirty()&&g<2||Es(n))&&o.offset!==s.offset&&!l.isComposing()||os(l)||l.isDirty()&&g>1||(i||!_e)&&null!==h&&!l.isComposing()&&u!==as(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==e.format||l.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),i=is(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(gi(t)||Eo(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,l)}function mr(e,t){return ss(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function yr(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}=e;lr&&(lr=!1,mr(r,i)&&mr(o,s)&&!gr)||So(t,(()=>{if(!n)return void vs(null);if(!Qo(t,r,o))return;let l=$i();if(gr&&wi(l)&&l.isCollapsed()){const e=l.anchor,t=gr.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(l=gr.clone(),vs(l))}if(gr=null,wi(l)){const n=l.anchor,r=n.getNode();if(l.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(l.dirty=!0);const i=Xs(t).event,o=i?i.timeStamp:performance.now(),[s,a,c,u,d]=pr,h=Ss(),g=!1===t.isComposing()&&""===h.getTextContent();if(o<d+200&&n.offset===c&&n.key===u)br(l,s,a);else if("text"===n.type)gi(r)||ge(141),_r(l,r);else if("element"===n.type&&!g){Eo(r)||ge(259);const e=n.getNode();e.isEmpty()?function(e,t){br(e,t.getTextFormat(),t.getTextStyle())}(l,e):br(l,0,"")}}else{const e=n.key,t=l.focus.key,r=l.getNodes(),o=r.length,a=l.isBackward(),c=a?s:i,u=a?i:s,d=a?t:e,h=a?e:t;let g=2047,p=!1;for(let e=0;e<o;e++){const t=r[e],n=t.getTextContentSize();if(gi(t)&&0!==n&&!(0===e&&t.__key===d&&c===n||e===o-1&&t.__key===h&&0===u)&&(p=!0,g&=t.getFormat(),0===g))break}l.format=p?g:0}}Vs(t,rn,void 0)}))}function br(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function _r(e,t){br(e,t.getFormat(),t.getStyle())}function xr(e){if(!e.getTargetRanges)return null;const t=e.getTargetRanges();return 0===t.length?null:t[0]}function Cr(e){const t=e.inputType,n=xr(e),r=co(),i=$i();if("deleteContentBackward"===t){if(null===i){const e=Hi();if(!wi(e))return!0;vs(e.clone())}if(wi(i)){const t=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===nr&&o<tr+30&&r.isComposing()&&t){if(ps(null),tr=0,setTimeout((()=>{So(r,(()=>{ps(null)}))}),30),wi(i)){const e=i.anchor.getNode();e.markDirty(),gi(e)||ge(142),_r(i,e)}}else{ps(null),e.preventDefault();const n=i.anchor.getNode(),o=n.getTextContent(),s=n.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===o.length;let a=ve&&t&&!l&&s;if(a&&i.isCollapsed()&&(a=!Ao(Us(i.anchor,!0))),!a){Vs(r,dn,!0);const e=$i();ve&&wi(e)&&e.isCollapsed()&&(gr=e,setTimeout((()=>gr=null)))}}return!0}}var o;if(!wi(i))return!0;const s=e.data;null!==ir&&Ls(!1,r,ir),i.dirty&&null===ir||!i.isCollapsed()||Oo(i.anchor.getNode())||null===n||i.applyDOMRange(n),ir=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if("insertText"===t||"insertTranspose"===t){if("\n"===s)e.preventDefault(),Vs(r,hn,!1);else if(s===Me)e.preventDefault(),Vs(r,gn,void 0);else if(null==s&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=s&&fr(i,n,s,e.timeStamp,!0)?(e.preventDefault(),Vs(r,pn,s)):ir=s;return rr=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":Vs(r,pn,e);break;case"insertFromComposition":ps(null),Vs(r,pn,e);break;case"insertLineBreak":ps(null),Vs(r,hn,!1);break;case"insertParagraph":ps(null),cr&&!Ce?(cr=!1,Vs(r,hn,!1)):Vs(r,gn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":Vs(r,fn,e);break;case"deleteByComposition":(function(e,t){return e!==t||Eo(e)||Eo(t)||!is(e)||!is(t)})(c,u)&&Vs(r,mn,e);break;case"deleteByDrag":case"deleteByCut":Vs(r,mn,e);break;case"deleteContent":Vs(r,dn,!1);break;case"deleteWordBackward":Vs(r,yn,!0);break;case"deleteWordForward":Vs(r,yn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":Vs(r,bn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":Vs(r,bn,!1);break;case"formatStrikeThrough":Vs(r,_n,"strikethrough");break;case"formatBold":Vs(r,_n,"bold");break;case"formatItalic":Vs(r,_n,"italic");break;case"formatUnderline":Vs(r,_n,"underline");break;case"historyUndo":Vs(r,xn,void 0);break;case"historyRedo":Vs(r,Cn,void 0)}return!0}function Sr(e){if(cl(e.target)&&Yo(e.target))return!0;const t=co(),n=$i(),r=e.data,i=xr(e);if(null!=r&&wi(n)&&fr(n,i,r,e.timeStamp,!1)){ur&&(kr(t,r),ur=!1);const i=n.anchor.getNode(),o=ll(Xs(t));if(null===o)return!0;const s=n.isBackward(),l=s?n.anchor.offset:n.focus.offset,a=s?n.focus.offset:n.anchor.offset;_e&&!n.isCollapsed()&&gi(i)&&null!==o.anchorNode&&i.getTextContent().slice(0,l)+r+i.getTextContent().slice(l+a)===As(o.anchorNode)||Vs(t,pn,r);const c=r.length;be&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),ve&&t.isComposing()&&(tr=0,ps(null))}else Ls(!1,t,null!==r?r:void 0),ur&&(kr(t,r||void 0),ur=!1);return function(){so();it(co())}(),!0}function wr(e){const t=co(),n=$i();if(wi(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();ps(r.key),Gs(Wr),(e.timeStamp<tr+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||gi(i)&&i.getStyle()!==n.style)&&Vs(t,pn,De)}return!0}function vr(e){return kr(co(),e.data),Gs(Vr),!0}function kr(e,t){const n=e._compositionKey;if(ps(null),null!==n&&null!=t){if(""===t){const t=ms(n),r=as(e.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&gi(t)){const n=ll(Xs(e));let i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Os(t,r.nodeValue,i,o,!0)}return}if("\n"===t[t.length-1]){const t=$i();if(wi(t)||ki(t)){if(wi(t)){const e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return void Vs(e,An,null)}}}Ls(!0,e,t)}function Er(e){const t=co();if(null==e.key)return!0;if(dr){if(Ds(e))return So(t,(()=>{kr(t,hr)})),dr=!1,hr="",!0;dr=!1,hr=""}if(function(e){return Is(e,"ArrowRight",{shiftKey:"any"})}(e))Vs(t,wn,e);else if(function(e){return Is(e,"ArrowRight",Ps)}(e))Vs(t,vn,e);else if(function(e){return Is(e,"ArrowLeft",{shiftKey:"any"})}(e))Vs(t,kn,e);else if(function(e){return Is(e,"ArrowLeft",Ps)}(e))Vs(t,En,e);else if(function(e){return Is(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))Vs(t,Tn,e);else if(function(e){return Is(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))Vs(t,Nn,e);else if(function(e){return Is(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))cr=!0,Vs(t,An,e);else if(function(e){return" "===e.key}(e))Vs(t,Ln,e);else if(function(e){return ye&&Is(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),cr=!0,Vs(t,hn,!0);else if(function(e){return Is(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))cr=!1,Vs(t,An,e);else if(function(e){return Is(e,"Backspace",{shiftKey:"any"})||ye&&Is(e,"h",{ctrlKey:!0})}(e))Ds(e)?Vs(t,On,e):(e.preventDefault(),Vs(t,dn,!0));else if(function(e){return"Escape"===e.key}(e))Vs(t,Fn,e);else if(function(e){return Is(e,"Delete",{})||ye&&Is(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),Vs(t,dn,!1)):Vs(t,Rn,e);else if(function(e){return Is(e,"Backspace",Ms)}(e))e.preventDefault(),Vs(t,yn,!0);else if(function(e){return Is(e,"Delete",Ms)}(e))e.preventDefault(),Vs(t,yn,!1);else if(function(e){return ye&&Is(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),Vs(t,bn,!0);else if(function(e){return ye&&(Is(e,"Delete",{metaKey:!0})||Is(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),Vs(t,bn,!1);else if(function(e){return Is(e,"b",Ps)}(e))e.preventDefault(),Vs(t,_n,"bold");else if(function(e){return Is(e,"u",Ps)}(e))e.preventDefault(),Vs(t,_n,"underline");else if(function(e){return Is(e,"i",Ps)}(e))e.preventDefault(),Vs(t,_n,"italic");else if(function(e){return Is(e,"Tab",{shiftKey:"any"})}(e))Vs(t,In,e);else if(function(e){return Is(e,"z",Ps)}(e))e.preventDefault(),Vs(t,xn,void 0);else if(function(e){return ye?Is(e,"z",{metaKey:!0,shiftKey:!0}):Is(e,"y",{ctrlKey:!0})||Is(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),Vs(t,Cn,void 0);else{const n=t._editorState._selection;null===n||wi(n)?Bs(e)&&(e.preventDefault(),Vs(t,Vn,e)):function(e){return Is(e,"c",Ps)}(e)?(e.preventDefault(),Vs(t,Un,e)):function(e){return Is(e,"x",Ps)}(e)?(e.preventDefault(),Vs(t,Wn,e)):Bs(e)&&(e.preventDefault(),Vs(t,Vn,e))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Xn,e),!0}function Tr(e){let t=e.__lexicalEventHandles;return void 0===t&&(t=[],e.__lexicalEventHandles=t),t}const Nr=new Map;function Ar(e){const t=function(e){const t=Ys(e);return t?t.getSelection():null}(e.target);if(null===t)return;const n=ts(t.anchorNode);if(null===n)return;ar&&(ar=!1,So(n,(()=>{const r=Hi(),i=t.anchorNode;(cl(i)||ss(i))&&vs(zi(r,t,n,e))})));const r=Ts(n),i=r[r.length-1],o=i._key,s=Nr.get(o),l=s||i;l!==n&&yr(t,l,!1),yr(t,n,!0),n!==i?Nr.set(o,n):s&&Nr.delete(o)}function Lr(e){e._lexicalHandled=!0}function Or(e){return!0===e._lexicalHandled}function Fr(e){const t=or.get(e);if(void 0===t)return;const n=sr.get(t);if(void 0===n)return;const r=n-1;r>=0||ge(164),or.delete(e),sr.set(t,r),0===r&&t.removeEventListener("selectionchange",Ar);const i=ns(e);es(i)?(function(e){if(null!==e._parentEditor){const t=Ts(e),n=t[t.length-1]._key;Nr.get(n)===e&&Nr.delete(n)}else Nr.delete(e._key)}(i),e.__lexicalEditor=null):i&&ge(198);const o=Tr(e);for(let e=0;e<o.length;e++)o[e]();e.__lexicalEventHandles=[]}function Rr(e,t,n){so();const r=e.__key,i=e.getParent();if(null===i)return;const o=function(e){const t=$i();if(!wi(t)||!Eo(e))return t;const{anchor:n,focus:r}=t,i=n.getNode(),o=r.getNode();return Js(i,e)&&n.set(e.__key,0,"element"),Js(o,e)&&r.set(e.__key,0,"element"),t}(e);let s=!1;if(wi(o)&&t){const t=o.anchor,n=o.focus;t.key===r&&(Wi(t,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0),n.key===r&&(Wi(n,e,i,e.getPreviousSibling(),e.getNextSibling()),s=!0)}else ki(o)&&t&&e.isSelected()&&e.selectPrevious();if(wi(o)&&t&&!s){const t=e.getIndexWithinParent();hs(e),Ki(o,i,t,-1)}else hs(e);n||tl(i)||i.canBeEmpty()||!i.isEmpty()||Rr(i,t),t&&o&&Oo(i)&&i.isEmpty()&&i.selectEnd()}const Ir=Symbol.for("ephemeral");function Pr(e){return e[Ir]||!1}class Mr{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=wl(this);return void 0===e&&ge(64,this.name),e}static clone(e){ge(65,this.name)}$config(){return{}}config(e,t){const n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),ds(this,e)}getType(){return this.__type}isInline(){ge(137,this.constructor.name)}isAttached(){let e=this.__key;for(;null!==e;){if("root"===e)return!0;const t=ms(e);if(null===t)break;e=t.__parent}return!1}isSelected(e){const t=e||$i();if(null==t)return!1;const n=t.getNodes().some((e=>e.__key===this.__key));if(gi(this))return n;if(wi(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Ao(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:ms(e)}getParentOrThrow(){const e=this.getParent();return null===e&&ge(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(tl(t))return Eo(e)||e===this&&Ao(e)||ge(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&ge(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:ms(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:ms(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=Eo(this)?this:this.getParent(),n=Eo(e)?e:e.getParent(),r=t&&n?ta(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=ta(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Xl(t):("same"!==t.type&&"ancestor"!==t.type&&ge(279),!1)))}isParentOf(e){const t=ta(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){const t=this.isBefore(e),n=[],r=new Set;let i=this;for(;null!==i;){const o=i.__key;if(r.has(o)||(r.add(o),n.push(i)),i===e)break;const s=Eo(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==s){i=s;continue}const l=t?i.getNextSibling():i.getPreviousSibling();if(null!==l){i=l;continue}const a=i.getParentOrThrow();if(r.has(a.__key)||n.push(a),a===e)break;let c=null,u=a;do{if(null===u&&ge(68),c=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),null===u)break;null!==c||r.has(u.__key)||n.push(u)}while(null===c);i=c}return t||n.reverse(),n}isDirty(){const e=co()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(Pr(this))return this;const e=ms(this.__key);return null===e&&ge(113),e}getWritable(){if(Pr(this))return this;so();const e=ao(),t=co(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=$i();if(null!==s&&s.setCachedNodes(null),o.has(r))return gs(i),i;const l=_l(i);return o.add(r),gs(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){ge(70)}updateDOM(e,t,n){ge(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){ge(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable(),r=t.$;let i=r;for(const e of gt(n).flatKeys)e in t&&(void 0!==i&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&ht(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){Rr(this,!0,e)}replace(e,t){so();let n=$i();null!==n&&(n=n.clone()),il(this,e);const r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),l=this.getParentOrThrow().getWritable(),a=l.__size;hs(s);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(Rr(r,!1,!0),null===c?l.__first=o:c.getWritable().__next=o,s.__prev=d,null===u?l.__last=o:u.getWritable().__prev=o,s.__next=h,s.__parent=g,l.__size=a,t&&(Eo(this)&&Eo(s)||ge(139),this.getChildren().forEach((e=>{s.append(e)}))),wi(n)){vs(n);const e=n.anchor,t=n.focus;e.key===i&&Ci(e,s),t.key===i&&Ci(t,s)}return fs()===i&&ps(o),s}insertAfter(e,t=!0){so(),il(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),o=$i();let s=!1,l=!1;if(null!==i){const t=e.getIndexWithinParent();if(hs(r),wi(o)){const e=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,l="element"===r.type&&r.key===e&&r.offset===t+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===a?c.__last=u:a.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&wi(o)){const e=this.getIndexWithinParent();Ki(o,c,e+1);const t=c.__key;s&&o.anchor.set(t,e+2,"element"),l&&o.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){so(),il(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;hs(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,a=this.getIndexWithinParent();null===o?s.__first=i:o.getWritable().__next=i,s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const c=$i();return t&&wi(c)&&Ki(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return zo()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){so();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Eo(n))return n.select();if(!gi(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){so();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Eo(n))return n.select(0,0);if(!gi(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}const Dr="historic",Br="history-merge",zr="paste",$r="collaboration",Hr="skip-scroll-into-view",Kr="skip-dom-selection",Ur="skip-selection-focus",Wr="composition-start",Vr="composition-end";class jr extends Mr{static getType(){return"linebreak"}static clone(e){return new jr(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&gl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Jr(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&Jr(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&gl(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&Jr(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&Jr(r))return!0}return!1}(e)?null:{conversion:qr,priority:0}}}static importJSON(e){return Zr().updateFromJSON(e)}}function qr(e){return{node:Zr()}}function Zr(){return rl(new jr)}function Gr(e){return e instanceof jr}function Jr(e){return ss(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function Yr(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function Xr(e,t){return 1&t?"strong":2&t?"em":"span"}function Qr(e,t,n,r,i){const o=r.classList;let s=$s(i,"base");void 0!==s&&o.add(...s),s=$s(i,"underlineStrikethrough");let l=!1;const a=8&t&&4&t;void 0!==s&&(8&n&&4&n?(l=!0,a||o.add(...s)):a&&o.remove(...s));for(const e in Ke){const r=Ke[e];if(s=$s(i,e),void 0!==s)if(n&r){if(l&&("underline"===e||"strikethrough"===e)){t&r&&o.remove(...s);continue}(0===(t&r)||a&&"underline"===e||"strikethrough"===e)&&o.add(...s)}else t&r&&o.remove(...s)}}function ei(e,t,n){const r=t.firstChild,i=n.isComposing(),o=e+(i?Pe:"");if(null==r)t.textContent=o;else{const e=r.nodeValue;if(e!==o)if(i||be){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,o=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;o+i<n&&o+i<r&&e[n-o-1]===t[r-o-1];)o++;return[i,n-i-o,t.slice(i,r-o)]}(e,o);0!==n&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=o}}function ti(e,t,n,r,i,o){ei(i,e,t);const s=o.theme.text;void 0!==s&&Qr(0,0,r,e,s)}function ni(e,t){const n=document.createElement(t);return n.appendChild(e),n}class ri extends Mr{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(e){return new ri(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return qe[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===fs()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Ke[e];return 0!==(this.getFormat()&t)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return cs(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){const n=this.__format,r=Yr(0,n),i=Xr(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l)),ti(l,this,0,n,this.__text,e);const a=this.__style;return""!==a&&(s.style.cssText=a),s}updateDOM(e,t,n){const r=this.__text,i=e.__format,o=this.__format,s=Yr(0,i),l=Yr(0,o),a=Xr(0,i),c=Xr(0,o);if((null===s?a:s)!==(null===l?c:l))return!0;if(s===l&&a!==c){const e=t.firstChild;null==e&&ge(48);const i=document.createElement(c);return ti(i,this,0,o,r,n),t.replaceChild(i,e),!1}let u=t;null!==l&&null!==s&&(u=t.firstChild,null==u&&ge(49)),ei(r,u,this);const d=n.theme.text;void 0!==d&&i!==o&&Qr(0,i,o,u,d);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:ai,priority:0}),b:()=>({conversion:oi,priority:0}),code:()=>({conversion:di,priority:0}),em:()=>({conversion:di,priority:0}),i:()=>({conversion:di,priority:0}),mark:()=>({conversion:di,priority:0}),s:()=>({conversion:di,priority:0}),span:()=>({conversion:ii,priority:0}),strong:()=>({conversion:di,priority:0}),sub:()=>({conversion:di,priority:0}),sup:()=>({conversion:di,priority:0}),u:()=>({conversion:di,priority:0})}}static importJSON(e){return hi().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return cl(t)||ge(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=ni(t,"b")),this.hasFormat("italic")&&(t=ni(t,"i")),this.hasFormat("strikethrough")&&(t=ni(t,"s")),this.hasFormat("underline")&&(t=ni(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?Ke[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Ue[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=cs(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=je[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){so();let n=e,r=t;const i=$i(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const e=o.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!wi(i))return Mi(s,n,s,r,"text","text");{const e=fs();e!==i.anchor.key&&e!==i.focus.key||ps(s),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=e;l<0&&(l=s+l,l<0&&(l=0));const a=$i();if(r&&wi(a)){const t=e+s;a.setTextNodeRange(i,t,i,t)}const c=o.slice(0,l)+n+o.slice(l+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){so();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=fs(),o=n.length;e.sort(((e,t)=>e-t)),e.push(o);const s=[],l=e.length;for(let t=0,r=0;t<o&&r<=l;r++){const i=e[r];i>t&&(s.push(n.slice(t,i)),t=i)}const a=s.length;if(1===a)return[t];const c=s[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const b=$i();if(wi(b)){const[e,t]=b.isBackward()?[b.focus,b.anchor]:[b.anchor,b.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=hi(c),d.__format=h,d.__style=g,d.__detail=p,d.__state=bt(t,d),f=!0):d=t.setTextContent(c);const _=[d];for(let e=1;e<a;e++){const n=hi(s[e]);n.__format=h,n.__style=g,n.__detail=p,n.__state=bt(t,n);const o=n.__key;i===r&&ps(o),_.push(n)}const x=m?m.offset:null,C=y?y.offset:null;let S=0;for(const e of _){if(!m&&!y)break;const t=S+e.getTextContentSize();if(null!==m&&null!==x&&x<=t&&x>=S&&(m.set(e.getKey(),x-S,"text"),x<t&&(m=null)),null!==y&&null!==C&&C<=t&&C>=S){y.set(e.getKey(),C-S,"text");break}S=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&gs(t),null!==n&&gs(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,_),this.remove()):e.splice(t,1,_),wi(b)&&Ki(b,u,t,a-1)}return _}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||ge(50);const n=this.__key,r=e.__key,i=this.__text,o=i.length;fs()===r&&ps(n);const s=$i();if(wi(s)){const i=s.anchor,l=s.focus;null!==i&&i.key===r&&Vi(i,t,n,e,o),null!==l&&l.key===r&&Vi(l,t,n,e,o)}const l=e.__text,a=t?l+i:i+l;this.setTextContent(a);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function ii(e){return{forChild:pi(e.style),node:null}}function oi(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:pi(t.style,n?void 0:"bold"),node:null}}const si=new WeakMap;function li(e){if(!cl(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function ai(e){const t=e;null===e.parentElement&&ge(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=si.get(n))&&!li(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e<r.length;e++)si.set(r[e],i);return i}(t)){const e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n];"\n"===r||"\r\n"===r?t.push(Zr()):"\t"===r?t.push(mi()):""!==r&&t.push(hi(r))}return{node:t}}if(n=n.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===n)return{node:null};if(" "===n[0]){let e=t,r=!0;for(;null!==e&&null!==(e=ci(e,!1));){const t=e.textContent||"";if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(" "===n[n.length-1]){let e=t,r=!0;for(;null!==e&&null!==(e=ci(e,!0));)if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return""===n?{node:null}:{node:hi(n)}}function ci(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,cl(n)){const e=n.style.display;if(""===e&&!hl(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(ss(n))return n;if("BR"===n.nodeName)return null}}const ui={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function di(e){const t=ui[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:pi(e.style,t),node:null}}function hi(e=""){return rl(new ri(e))}function gi(e){return e instanceof ri}function pi(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===e.fontStyle,l=r.includes("underline"),a=e.verticalAlign;return e=>gi(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),o&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==a||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==a||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class fi extends ri{static getType(){return"tab"}static clone(e){return new fi(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=$s(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return mi().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&pe(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||ge(286),this}setDetail(e){return 2!==e&&ge(127),this}setMode(e){return"normal"!==e&&ge(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function mi(){return rl(new fi)}function yi(e){return e instanceof fi}class bi{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:Yl(da(na(this,"next")),da(na(e,"next")))<0}getNode(){const e=ms(this.key);return null===e&&ge(20),e}set(e,t,n,r){const i=this._selection,o=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,oo()||(fs()===o&&ps(e),null!==i&&(i.setCachedNodes(null),i.dirty=!0)))}}function _i(e,t,n){return new bi(e,t,n)}function xi(e,t){let n=t.__key,r=e.offset,i="element";if(gi(t)){i="text";const e=t.getTextContentSize();r>e&&(r=e)}else if(!Eo(t)){const e=t.getNextSibling();if(gi(e))n=e.__key,r=0,i="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Ci(e,t){if(Eo(t)){const n=t.getLastDescendant();Eo(n)||gi(n)?xi(e,n):xi(e,t)}else xi(e,t)}class Si{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!ki(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Si(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let i;if(gi(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=this._nodes,n=[];for(const e of t){const t=ms(e);null!==t&&n.push(t)}return oo()||(this._cachedNodes=n),n}getTextContent(){const e=this.getNodes();let t="";for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){const e=this.getNodes();if(($i()||Hi())===this&&e[0]){const t=zl(e[0],"next");ia(Gl(t,t))}for(const t of e)t.remove()}}function wi(e){return e instanceof vi}class vi{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!wi(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(null!==e)return e;const t=function(e){const t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);const i=new Set,o=new Set;for(const n of e)if(Pl(n)){const{origin:e}=n;0===t.length?i.add(e):(o.add(e),t.push(e))}else{const{origin:e}=n;Eo(e)&&o.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Il(e.focus)&&Eo(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=Ul(e.focus.origin,"previous");Pl(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Wl(n))i.delete(n.origin),t.pop();for(;t.length>1;){const e=t[t.length-1];if(!Eo(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=da(e.anchor),r=da(e.anchor.getFlipped()),i=e=>Rl(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(pa(sa(this),"next"));return oo()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=Ti(this);let a="",c=!0;for(let u=0;u<e.length;u++){const d=e[u];if(Eo(d)&&!d.isInline())c||(a+="\n"),c=!d.isEmpty();else if(c=!1,gi(d)){let e=d.getTextContent();d===t?d===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(e=s<l?e.slice(s,l):e.slice(l,s)):e=o?e.slice(s):e.slice(l):d===n&&(e=o?e.slice(0,l):e.slice(0,s)),a+=e}else!Ao(d)&&!Gr(d)||d===n&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=co(),n=t.getEditorState()._selection,r=Ii(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(null===r)return;const[i,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(o.key,o.offset,o.type,!0),St(this)}clone(){const e=this.anchor,t=this.focus;return new vi(_i(e.key,e.offset,e.type),_i(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=cs(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Ke[e];return 0!==(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){const r=t[e];"\n"===r||"\r\n"===r?n.push(Zr()):"\t"===r?n.push(mi()):n.push(hi(r))}this.insertNodes(n)}insertText(e){const t=this.anchor,n=this.focus,r=this.format,i=this.style;let o=t,s=n;!this.isCollapsed()&&n.isBefore(t)&&(o=n,s=t),"element"===o.type&&function(e,t,n,r){const i=e.getNode(),o=i.getChildAtIndex(e.offset),s=hi();if(s.setFormat(n),s.setStyle(r),$o(o))o.splice(0,0,[s]);else{const e=Oo(i)?zo().append(s):s;null===o?i.append(e):o.insertBefore(e)}e.is(t)&&t.set(s.__key,0,"text"),e.set(s.__key,0,"text")}(o,s,r,i),"element"===s.type&&ra(s,da(na(s,"next")));const l=o.offset;let a=s.offset;const c=this.getNodes(),u=c.length;let d=c[0];gi(d)||ge(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let p=c[u-1];if(1===u&&"element"===s.type&&(a=h,s.set(o.key,a,"text")),this.isCollapsed()&&l===h&&(os(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(gi(t)&&t.canInsertTextBefore()&&!os(t)||(t=hi(),t.setFormat(r),t.setStyle(i),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===l&&(os(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(gi(t)&&!os(t)||(t=hi(),t.setFormat(r),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&l!==h){const e=hi(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&""!==e){const t=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Eo(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Ri(this.anchor,this.focus),void this.insertText(e)}if(1===u){if(is(d)){const t=hi(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(l!==a||t===r&&n===i){if(yi(d)){const t=hi(e);return t.setFormat(r),t.setStyle(i),t.select(),void d.replace(t)}}else{if(""!==d.getTextContent()){const t=hi(e);if(t.setFormat(r),t.setStyle(i),t.select(),0===l)d.insertBefore(t,!1);else{const[e]=d.splitText(l);e.insertAfter(t,!1)}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(r),d.setStyle(i)}const o=a-l;d=d.spliceText(l,o,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length))}else{const t=new Set([...d.getParentKeys(),...p.getParentKeys()]),n=Eo(d)?d:d.getParentOrThrow();let r=Eo(p)?p:p.getParentOrThrow(),i=p;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow()}while(r.isInline());if("text"===s.type&&(0!==a||""===p.getTextContent())||"element"===s.type&&p.getIndexWithinParent()<a)if(gi(p)&&!is(p)&&a!==p.getTextContentSize()){if(p.isSegmented()){const e=hi(p.getTextContent());p.replace(e),p=e}Oo(s.getNode())||"text"!==s.type||(p=p.spliceText(0,a,"")),t.add(p.__key)}else{const e=p.getParentOrThrow();e.canBeEmpty()||1!==e.getChildrenSize()?p.remove():e.remove()}else t.add(p.__key);const o=r.getChildren(),g=new Set(c),f=n.is(r),m=n.isInline()&&null===d.getNextSibling()?n:d;for(let e=o.length-1;e>=0;e--){const t=o[e];if(t.is(d)||Eo(t)&&t.isParentOf(d))break;t.isAttached()&&(!g.has(t)||t.is(i)?f||m.insertAfter(t,!1):t.remove())}if(!f){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(is(d))if(l===h)d.select();else{const t=hi(e);t.select(),d.replace(t)}else d=d.spliceText(l,h-l,e,!0),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<u;e++){const n=c[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){const e=$i()===this;oa(this,ua(sa(this))),e&&$i()!==this&&vs(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void ps(null);const n=this.getNodes(),r=[];for(const e of n)gi(e)&&r.push(e);const i=t=>{n.forEach((n=>{if(Eo(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},o=r.length;if(0===o)return this.toggleFormat(e),ps(null),void i(t);const s=this.anchor,l=this.focus,a=this.isBackward(),c=a?l:s,u=a?s:l;let d=0,h=r[0],g="element"===c.type?0:c.offset;if("text"===c.type&&g===h.getTextContentSize()&&(d=1,h=r[1],g=0),null==h)return;const p=h.getFormatFlags(e,t);i(p);const f=o-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(os(h)||0===g&&y===h.getTextContentSize())h.setFormat(p);else{const e=h.splitText(g,y),t=0===g?e[0]:e[1];t.setFormat(p),"text"===c.type&&c.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,y-g,"text")}return void(this.format=p)}0===g||os(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const b=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||os(m)||([m]=m.splitText(y)),m.setFormat(b));for(let t=d+1;t<f;t++){const n=r[t],i=n.getFormatFlags(e,b);n.setFormat(i)}"text"===c.type&&c.set(h.__key,g,"text"),"text"===u.type&&u.set(m.__key,y,"text"),this.format=p|b}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const t=$i();return wi(t)||ge(134),t.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=vl(t,pl),r=e[e.length-1];if(Eo(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=Ji(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(Eo(e)||Ao(e))&&!e.isInline()))){Eo(n)||ge(211,t.constructor.name,t.getType());const i=Ji(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=zo();let n=null;for(let r=0;r<e.length;r++){const i=e[r],o=Gr(i);if(o||Ao(i)&&i.isInline()||Eo(i)&&i.isInline()||gi(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),t.append(n),o))continue;null!==n&&n.append(i)}else t.append(i),n=null}return t}(e),o=i.getLastDescendant(),s=i.getChildren(),l=Eo(n)&&n.isEmpty()?null:this.insertParagraph(),a=s[s.length-1];let c=s[0];var u;Eo(u=c)&&pl(u)&&!u.isEmpty()&&Eo(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(Eo(n)||ge(211,t.constructor.name,t.getType()),n.append(...c.getChildren()),c=s[1]),c&&(null===n&&ge(212,t.constructor.name,t.getType()),function(e,t){const n=t.getParentOrThrow().getLastChild();let r=t;const i=[t];for(;r!==n;)r.getNextSibling()||ge(140),r=r.getNextSibling(),i.push(r);let o=e;for(const e of i)o=o.insertAfter(e)}(n,c));const d=vl(o,pl);l&&Eo(d)&&(l.canMergeWhenEmpty()||pl(a))&&(d.append(...l.getChildren()),l.remove()),Eo(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=Eo(n)?n.getLastChild():null;Gr(h)&&d!==n&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const e=zo();return Ss().splice(this.anchor.offset,0,[e]),e.select(),e}const e=Ji(this),t=vl(this.anchor.getNode(),pl);Eo(t)||ge(213);const n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){const t=Zr();if(this.insertNodes([t]),e){const e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){const e=[...this.getNodes()],t=e.length;let n=e[0],r=e[t-1];const[i,o]=Ti(this),s=this.isBackward(),[l,a]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[c,u]=s?[o,i]:[i,o];if(0===t)return[];if(1===t){if(gi(n)&&!this.isCollapsed()){const e=n.splitText(c,u),t=0===c?e[0]:e[1];return t?(l.set(t.getKey(),0,"text"),a.set(t.getKey(),t.getTextContentSize(),"text"),[t]):[]}return[n]}if(gi(n)&&(c===n.getTextContentSize()?e.shift():0!==c&&([,n]=n.splitText(c),e[0]=n,l.set(n.getKey(),0,"text"))),gi(r)){const t=r.getTextContent().length;0===u?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,a.set(r.getKey(),r.getTextContentSize(),"text"))}return e}modify(e,t,n){if(Xi(this,e,t,n))return;const r="move"===e,i=co(),o=ll(Xs(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,a=this.focus.getNode();if(null===l||null===s||!Eo(a)||a.isInline()||a.canBeEmpty()||sl(s,i,l),this.dirty){let e=js(i,this.anchor.key),t=js(i,this.focus.key);"text"===this.anchor.type&&(e=as(e)),"text"===this.focus.type&&(t=as(t)),e&&t&&ji(o,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(o,e,t?"backward":"forward",n),o.rangeCount>0){const e=o.getRangeAt(0),n=this.anchor.getNode(),i=Oo(n)?n:el(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let e=0;e<n.length;e++){const t=n[e];Js(t,i)?r.push(t):s=!0}if(s&&r.length>0)if(t){const e=r[0];Eo(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];Eo(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}o.anchorNode===e.startContainer&&o.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,o=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,o,!0)}(this)}}"lineboundary"===n&&Xi(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Eo(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(Eo(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let n=t.getNode();if(this.forwardDeletion(t,n,e))return;const r=ql(na(t,e?"previous":"next"));if(r.getTextSlices().every((e=>null===e||0===e.distance))){let e={type:"initial"};for(const t of r.iterNodeCarets("shadowRoot"))if(Pl(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Eo(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=da(t);oa(this,Gl(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(Il(t)){if(Eo(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(Ao(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Eo(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=Bi();e.add(t.origin.getKey()),vs(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return oa(this,Gl(!t.origin.isEmpty()&&n.isEmpty()?la(zl(n,t.direction)):r.anchor,t)),this.removeText()}}const i=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&Ni(this,t.getNode()))return}else{const r="text"===i.type?i.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){const t=i.offset,o=r.getTextContentSize();if(r.is(n)||e&&t!==o||!e&&0!==t)return void Li(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,o=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==o)return void Li(n,e,i)}!function(e,t){const n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&"text"===n.type&&"text"===r.type){const e=n.offset,o=r.offset,s=e<o,l=s?e:o,a=s?o:e,c=a-1;l!==c&&function(e){return!(Es(e)||Ai(e))}(i.getTextContent().slice(l,a))&&(t?r.set(r.key,c,r.type):n.set(n.key,c,n.type))}}(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const e=this.anchor.getNode();e.isEmpty()&&Oo(e.getParent())&&null===e.getPreviousSibling()&&Ni(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function ki(e){return e instanceof Si}function Ei(e){const t=e.offset;if("text"===e.type)return t;const n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Ti(e){const t=e.getStartEndPoints();if(null===t)return[0,0];const[n,r]=t;return"element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[Ei(n),Ei(r)]}function Ni(e,t){for(let n=t;n;n=n.getParent()){if(Eo(n)){if(n.collapseAtStart(e))return!0;if(tl(n))break}if(n.getPreviousSibling())break}return!1}const Ai=(()=>{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Li(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let e=0;e<o;e++){const r=e===o-1;if(l=s,s+=i[e].length,t&&s===n||s>n||r){i.splice(e,1),r&&(l=void 0);break}}const a=i.join("").trim();""===a?r.remove():(r.setTextContent(a),r.select(l,l))}function Oi(e,t,n,r){let i,o=t;if(cl(e)){let s=!1;const l=e.childNodes,a=l.length,c=r._blockCursorElement;o===a&&(s=!0,o=a-1);let u=l[o],d=!1;if(u===c)u=l[o+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&o--}if(i=ks(u),gi(i))o=Hl(i,s?"next":"previous");else{let l=ks(e);if(null===l)return null;if(Eo(l)){const a=r.getElementByKey(l.getKey());null===a&&ge(214);const c=l.getDOMSlot(a);[l,o]=c.resolveChildIndex(l,a,e,t),Eo(l)||ge(215),s&&o>=l.getChildrenSize()&&(o=Math.max(0,l.getChildrenSize()-1));let u=l.getChildAtIndex(o);if(Eo(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=s?u.getLastDescendant():u.getFirstDescendant();null===e?l=u:(u=e,l=Eo(u)?u:u.getParentOrThrow()),o=0}gi(u)?(i=u,l=null,o=Hl(u,s?"next":"previous")):u!==l&&s&&!d&&(Eo(l)||ge(216),o=Math.min(l.getChildrenSize(),o+1))}else{const n=l.getIndexWithinParent();o=0===t&&Ao(l)&&ks(e)===l?n:n+1,l=l.getParentOrThrow()}if(Eo(l))return _i(l.__key,o,"element")}}else i=ks(e);return gi(i)?_i(i.__key,Hl(i,o,"clamp"),"text"):null}function Fi(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(t){if((n||!t)&&null===r&&Eo(o)&&o.isInline()){const t=o.getPreviousSibling();gi(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Eo(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):gi(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(t&&Eo(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Eo(o)&&o.isInline()&&!o.canInsertTextAfter()){const t=o.getNextSibling();gi(t)&&e.set(t.__key,0,"text")}}}function Ri(e,t,n){if("text"===e.type&&"text"===t.type){const n=e.isBefore(t),r=e.is(t);Fi(e,n,r),Fi(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function Ii(e,t,n,r,i,o){if(null===e||null===n||!Qo(i,e,n))return null;const s=Oi(e,t,wi(o)?o.anchor:null,i);if(null===s)return null;const l=Oi(n,r,wi(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const t=ks(e),r=ks(n);if(Ao(t)&&Ao(r))return null}return Ri(s,l),[s,l]}function Pi(e){return Eo(e)&&!e.isInline()}function Mi(e,t,n,r,i,o){const s=ao(),l=new vi(_i(e,t,i),_i(n,r,o),0,"");return l.dirty=!0,s._selection=l,l}function Di(){const e=_i("root",0,"element"),t=_i("root",0,"element");return new vi(e,t,0,"")}function Bi(){return new Si(new Set)}function zi(e,t,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,a=!Je&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let c,u,d,h;if(wi(e)&&!a)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,(l||void 0===s)&&wi(e)&&!Qo(n,c,u))return e.clone();const g=Ii(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;let m=0,y="";if(wi(e)){const t=e.anchor;if(p.key===t.key)m=e.format,y=e.style;else{const e=p.getNode();gi(e)?(m=e.getFormat(),y=e.getStyle()):Eo(e)&&(m=e.getTextFormat(),y=e.getTextStyle())}}return new vi(p,f,m,y)}function $i(){return ao()._selection}function Hi(){return co()._editorState._selection}function Ki(e,t,n,r=1){const i=e.anchor,o=e.focus,s=i.getNode(),l=o.getNode();if(!t.is(s)&&!t.is(l))return;const a=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n<t&&r<0){const n=Math.max(0,t+r);i.set(a,n,"element"),o.set(a,n,"element"),Ui(e)}}else{const s=e.isBackward(),l=s?o:i,c=l.getNode(),u=s?i:o,d=u.getNode();if(t.is(c)){const e=l.offset;(n<=e&&r>0||n<e&&r<0)&&l.set(a,Math.max(0,e+r),"element")}if(t.is(d)){const e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(a,Math.max(0,e+r),"element")}}Ui(e)}function Ui(e){const t=e.anchor,n=t.offset,r=e.focus,i=r.offset,o=t.getNode(),s=r.getNode();if(e.isCollapsed()){if(!Eo(o))return;const e=o.getChildrenSize(),i=n>=e,s=i?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(gi(s)){let e=0;i&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}}else{if(Eo(o)){const e=o.getChildrenSize(),r=n>=e,i=r?o.getChildAtIndex(e-1):o.getChildAtIndex(n);if(gi(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(Eo(s)){const e=s.getChildrenSize(),t=i>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(i);if(gi(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function Wi(e,t,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,gi(r)?(s=r.getTextContentSize(),l="text"):Eo(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,gi(i)?l="text":Eo(i)&&(l="element")),null!==o&&null!==l?e.set(o,s,l):(s=t.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function Vi(e,t,n,r,i){"text"===e.type?e.set(n,e.offset+(t?0:i),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function ji(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function qi(e,t,n){const r=js(e,t.getKey());if(Eo(t)){const e=t.getDOMSlot(r);return[e.element,n+e.getFirstChildOffset()]}return[r,n]}function Zi(e,t,n,r,i,o,s){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(i.has($r)&&d!==o||null!==d&&Xo(d))return;if(!wi(t))return void(null!==e&&Qo(n,l,a)&&r.removeAllRanges());const h=t.anchor,g=t.focus,p=h.getNode(),f=g.getNode(),[m,y]=qi(n,p,h.offset),[b,_]=qi(n,f,g.offset),x=t.format,C=t.style,S=t.isCollapsed();let w=m,v=b,k=!1;var E,T,N,A,L;if("text"===h.type?(w=as(m),k=p.getFormat()!==x||p.getStyle()!==C):wi(e)&&"text"===e.anchor.type&&(k=!0),"text"===g.type&&(v=as(b)),null!==w&&null!==v&&(S&&(null===e||k||wi(e)&&(e.format!==x||e.style!==C))&&(E=x,T=C,N=y,A=h.key,L=performance.now(),pr=[E,T,N,A,L]),c!==y||u!==_||l!==w||a!==v||"Range"===r.type&&S||(null!==d&&o.contains(d)||i.has(Ur)||o.focus({preventScroll:!0}),"element"===h.type))){if(ji(r,w,y,v,_),!be||!t.isCollapsed()||null===o||i.has(Ur)||null!==document.activeElement&&o.contains(document.activeElement)||o.focus({preventScroll:!0}),!i.has(Hr)&&t.isCollapsed()&&null!==o&&o===document.activeElement){const e=wi(t)&&"element"===t.anchor.type?w.childNodes[y]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=Zs(n),i=Ys(r);if(null===r||null===i)return;let{top:o,bottom:s}=t,l=0,a=0,c=n;for(;null!==c;){const t=c===r.body;if(t)l=0,a=Xs(e).innerHeight;else{const e=c.getBoundingClientRect();l=e.top,a=e.bottom}let n=0;if(o<l?n=-(l-o):s>a&&(n=s-a),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;o-=t,s-=t}if(t)break;c=qs(c)}}(n,t,o)}}lr=!0}}function Gi(e){let t=$i()||Hi();null===t&&(t=Ss().selectEnd()),t.insertNodes(e)}function Ji(e){let t=e;e.isCollapsed()||t.removeText();const n=$i();wi(n)&&(t=n),wi(t)||ge(161);const r=t.anchor;let i=r.getNode(),o=r.offset;for(;!pl(i);){const e=i;if([i,o]=Yi(i,o),e.is(i))break}return o}function Yi(e,t){const n=e.getParent();if(!n){const e=zo();return Ss().append(e),e.select(),[Ss(),0]}if(gi(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const i=0===t?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!Eo(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new vi(_i(e.__key,t,"element"),_i(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Xi(e,t,n,r,i="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){const[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}const o=na(e.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===t;let a=o,c="decorators-and-blocks"===i;if(!ha(a)){for(const e of a){c=!1;const{origin:t}=e;if(!Ao(t)||t.isIsolated()||(a=e,!s||!t.isInline()))break}if(c)for(const e of ql(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Pl(e))e.origin.isInline()||(a=e);else{if(Eo(e.origin))continue;Ao(e.origin)&&!e.origin.isInline()&&(a=e)}break}}if(a===o)return!1;if(l&&!s&&Ao(a.origin)&&a.origin.isKeyboardSelectable()){const e=Bi();return e.add(a.origin.getKey()),vs(e),!0}return a=da(a),l&&ra(e.anchor,a),ra(e.focus,a),c||!s}let Qi=null,eo=null,to=!1,no=!1,ro=0;const io={characterData:!0,childList:!0,subtree:!0};function oo(){return to||null!==Qi&&Qi._readOnly}function so(){to&&ge(13)}function lo(){ro>99&&ge(14)}function ao(){return null===Qi&&ge(195,uo()),Qi}function co(){return null===eo&&ge(196,uo()),eo}function uo(){let e=0;const t=new Set,n=Wo.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=ns(r);if(es(i))e++;else if(i){let e=String(i.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function ho(e,t,n){const r=t.__type,i=Zo(e,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let e=0;e<s&&(o[e](t),t.isAttached());e++);}function go(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function po(e,t){if(!t)return;const n=e._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const e of r)n.add(e)}function fo(e){return mo(e,co()._nodes)}function mo(e,t){const n=e.type,r=t.get(n);void 0===r&&ge(17,n);const i=r.klass;e.type!==i.getType()&&ge(18,i.name);const o=i.importJSON(e),s=e.children;if(Eo(o)&&Array.isArray(s))for(let e=0;e<s.length;e++){const n=mo(s[e],t);o.append(n)}return o}function yo(e,t,n){const r=Qi,i=to,o=eo;Qi=t,to=!0,eo=e;try{return n()}finally{Qi=r,to=i,eo=o}}function bo(e,t){const n=e._pendingEditorState,r=e._rootElement,i=e._headless||null===r;if(null===n)return;const o=e._editorState,s=o._selection,l=n._selection,a=0!==e._dirtyType,c=Qi,u=to,d=eo,h=e._updating,g=e._observer;let p=null;if(e._pendingEditorState=null,e._editorState=n,!i&&a&&null!==g){eo=e,Qi=n,to=!1,e._updating=!0;try{const t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;g.disconnect(),p=function(e,t,n,r,i,o){It="",Dt=2===r,kt=n,vt=n._config,Et=n._nodes,Tt=kt._listeners.mutation,Nt=i,At=o,Lt=e._nodeMap,Ot=t._nodeMap,Bt=t._readOnly,Ft=new Map(n._keyToDOMMap);const s=new Map;return Rt=s,Yt("root",null),kt=void 0,Et=void 0,Nt=void 0,At=void 0,Lt=void 0,Ot=void 0,vt=void 0,Ft=void 0,Rt=void 0,s}(o,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),no)throw t;return Ho(e,null,r,n),ot(e),e._dirtyType=2,no=!0,bo(e,o),void(no=!1)}finally{g.observe(r,io),e._updating=h,Qi=c,to=u,eo=d}}n._readOnly||(n._readOnly=!0);const f=e._dirtyLeaves,m=e._dirtyElements,y=e._normalizedNodes,b=e._updateTags,_=e._deferred;a&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){const n=e._decorators;let r=e._pendingDecorators||n;const i=t._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=xs(e)),delete r[o])}(e,n);const x=i?null:ll(Xs(e));if(e._editable&&null!==x&&(a||null===l||l.dirty||!l.is(s))&&null!==r&&!b.has(Kr)){eo=e,Qi=n;try{if(null!==g&&g.disconnect(),a||null===l||l.dirty){const t=e._blockCursorElement;null!==t&&sl(t,e,r),Zi(s,l,e,x,b,r)}!function(e,t,n){let r=e._blockCursorElement;if(wi(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,a=null;if(s===o.getChildrenSize())ol(o.getChildAtIndex(s-1))&&(l=!0);else{const t=o.getChildAtIndex(s);if(null!==t&&ol(t)){const n=t.getPreviousSibling();(null===n||ol(n))&&(l=!0,a=e.getElementByKey(t.__key))}}if(l){const n=e.getElementByKey(o.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=xa(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===a?n.appendChild(r):n.insertBefore(r,a))}}null!==r&&sl(r,e,t)}(e,r,l)}finally{null!==g&&g.observe(r,io),eo=d,Qi=c}}null!==p&&function(e,t,n,r,i){const o=Array.from(e._listeners.mutation),s=o.length;for(let e=0;e<s;e++){const[s,l]=o[e];for(const e of l){const o=t.get(e);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,p,b,f,o),wi(l)||null===l||null!==s&&s.is(l)||e.dispatchCommand(rn,void 0);const C=e._pendingDecorators;null!==C&&(e._decorators=C,e._pendingDecorators=null,_o("decorator",e,!0,C)),function(e,t,n){const r=Cs(t),i=Cs(n);r!==i&&_o("textcontent",e,!0,i)}(e,t||o,n),_o("update",e,!0,{dirtyElements:m,dirtyLeaves:f,editorState:n,mutatedNodes:p,normalizedNodes:y,prevEditorState:t||o,tags:b}),function(e,t){if(e._deferred=[],0!==t.length){const n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}(e,_),function(e){const t=e._updates;if(0!==t.length){const n=t.shift();if(n){const[t,r]=n;Co(e,t,r)}}}(e)}function _o(e,t,n,...r){const i=t._updating;t._updating=n;try{const n=Array.from(t._listeners[e]);for(let e=0;e<n.length;e++)n[e].apply(null,r)}finally{t._updating=i}}function xo(e,t){const n=e._updates;let r=t||!1;for(;0!==n.length;){const t=n.shift();if(t){const[n,i]=t,o=e._pendingEditorState;let s;void 0!==i&&(s=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(null===o&&ge(191),o._flushSync=!0),s&&e._deferred.push(s),po(e,i.tag)),null==o?Co(e,n,i):n()}}return r}function Co(e,t,n){const r=e._updateTags;let i,o=!1,s=!1;void 0!==n&&(i=n.onUpdate,po(e,n.tag),o=n.skipTransforms||!1,s=n.discrete||!1),i&&e._deferred.push(i);const l=e._editorState;let a=e._pendingEditorState,c=!1;(null===a||a._readOnly)&&(a=e._pendingEditorState=Fo(a||l),c=!0),a._flushSync=s;const u=Qi,d=to,h=eo,g=e._updating;Qi=a,to=!1,e._updating=!0,eo=e;const p=e._headless||null===e.getRootElement();jo(null);try{c&&(p?null!==l._selection&&(a._selection=l._selection.clone()):a._selection=function(e,t){const n=e.getEditorState()._selection,r=ll(Xs(e));return wi(n)||null==n?zi(n,r,e,t):n.clone()}(e,n&&n.event||null));const r=e._compositionKey;t(),o=xo(e,o),function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(wi(r)){const e=r.anchor,t=r.focus;let i;if("text"===e.type&&(i=e.getNode(),i.selectionTransform(n,r)),"text"===t.type){const e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(a,e),0!==e._dirtyType&&(o?function(e,t){const n=t._dirtyLeaves,r=e._nodeMap;for(const e of n){const t=r.get(e);gi(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Ct(t)}}(a,e):function(e,t){const n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,o=fs(),s=new Map;let l=n,a=l.size,c=r,u=c.size;for(;a>0||u>0;){if(a>0){t._dirtyLeaves=new Set;for(const e of l){const r=i.get(e);gi(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Ct(r),void 0!==r&&go(r,o)&&ho(t,r,s),n.add(e)}if(l=t._dirtyLeaves,a=l.size,a>0){ro++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,c.delete("root")&&c.set("root",!0);for(const e of c){const n=e[0],l=e[1];if(r.set(n,l),!l)continue;const a=i.get(n);void 0!==a&&go(a,o)&&ho(t,a,s)}l=t._dirtyLeaves,a=l.size,c=t._dirtyElements,u=c.size,ro++}t._dirtyLeaves=n,t._dirtyElements=r}(a,e),xo(e),function(e,t,n,r){const i=e._nodeMap,o=t._nodeMap,s=[];for(const[e]of r){const t=o.get(e);void 0!==t&&(t.isAttached()||(Eo(t)&&Ge(t,e,i,o,s,r),i.has(e)||r.delete(e),s.push(e)))}for(const e of s)o.delete(e);for(const e of n){const t=o.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),o.delete(e))}}(l,a,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(a._flushSync=!0);const i=a._selection;if(wi(i)){const e=a._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||ge(19)}else ki(i)&&0===i._nodes.size&&(a._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=l,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void bo(e)}finally{Qi=u,to=d,eo=h,e._updating=g,ro=0}const f=0!==e._dirtyType||e._deferred.length>0||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(a,e);f?a._flushSync?(a._flushSync=!1,bo(e)):c&&Jo((()=>{bo(e)})):(a._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function So(e,t,n){eo===e&&void 0===n?t():Co(e,t,n)}class wo{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new wo(this.element,e,this.after)}withAfter(e){return new wo(this.element,this.before,e)}withElement(e){return this.element===e?this:new wo(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&ge(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&ge(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&ge(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(ke||Ce||xe);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",e.alt="",n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const i=vo(t,n);i.push(r);const o=vo(t,this.element);let s=e.getIndexWithinParent();for(let e=0;e<o.length;e++){const t=i[e],n=o[e];if(void 0===t||t<n)break;if(t>n){s+=1;break}}return[e.getParentOrThrow(),s]}}function vo(e,t){const n=[];let r=t;for(;r!==e&&null!==r;r=r.parentNode){let e=0;for(let t=r.previousSibling;null!==t;t=t.previousSibling)e++;n.push(e)}return r!==e&&ge(225),n.reverse()}class ko extends Mr{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Ve[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=co()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(gi(t)&&e.push(t),Eo(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Eo(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Eo(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return Eo(e)&&e.getLastDescendant()||e||null}const r=t[e];return Eo(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:ms(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&ge(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:ms(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&ge(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;null!==n&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContent(),Eo(i)&&r!==n-1&&!i.isInline()&&(e+=Me)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){const i=t[r];e+=i.getTextContentSize(),Eo(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(""!==e){const t=We[e];return 0!==(this.getFormat()&t)}return!1}hasTextFormat(e){const t=Ke[e];return 0!==(this.getTextFormat()&t)}getFormatFlags(e,t){return cs(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){so();const n=$i();let r=e,i=t;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===e&&0===t){const e=this.getFirstChild();if(gi(e)||Eo(e))return e.select(0,0)}else if(!(void 0!==e&&e!==o||void 0!==t&&t!==o)){const e=this.getLastChild();if(gi(e)||Eo(e))return e.select()}void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return wi(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):Mi(s,r,s,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach((e=>e.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e?We[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){Pr(this)&&ge(324,this.__key,this.__type);const r=this.getChildrenSize(),i=this.getWritable();e+t<=r||ge(226,String(e),String(t),String(r));const o=i.__key,s=[],l=[],a=this.getChildAtIndex(e+t);let c=null,u=r-t+n.length;if(0!==e)if(e===r)c=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(c=t.getPreviousSibling())}if(t>0){let e=null===c?this.getFirstChild():c.getNextSibling();for(let n=0;n<t;n++){null===e&&ge(100);const t=e.getNextSibling(),n=e.__key;hs(e.getWritable()),l.push(n),e=t}}let d=c;for(const e of n){null!==d&&e.is(d)&&(c=d=d.getPreviousSibling());const t=e.getWritable();t.__parent===o&&u--,hs(t);const n=e.__key;if(null===d)i.__first=n,t.__prev=null;else{const e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===o&&ge(76),t.__parent=o,s.push(n),d=e}if(e+t===r)null!==d&&(d.getWritable().__next=null,i.__last=d.__key);else if(null!==a){const e=a.getWritable();if(null!==d){const t=d.getWritable();e.__prev=d.__key,t.__next=a.__key}else e.__prev=null}if(i.__size=u,l.length){const e=$i();if(wi(e)){const t=new Set(l),n=new Set(s),{anchor:r,focus:i}=e;To(r,t,n)&&Wi(r,r.getNode(),this,c,a),To(i,t,n)&&Wi(i,i.getNode(),this,c,a),0!==u||this.canBeEmpty()||tl(this)||this.remove()}}return i}getDOMSlot(e){return new wo(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(cl(t)){const e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0===t&&""===n||tl(this)||this.getChildren().some(gi)||(0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function Eo(e){return e instanceof ko}function To(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class No extends Mr{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ao(e){return e instanceof No}class Lo extends ko{__cachedText;static getType(){return"root"}static clone(){return new Lo}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ge(51)}getTextContent(){const e=this.__cachedText;return!oo()&&0!==co()._dirtyType||null===e?super.getTextContent():e}remove(){ge(52)}replace(e){ge(53)}insertBefore(e){ge(54)}insertAfter(e){ge(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)Eo(e)||Ao(e)||ge(282);return super.splice(e,t,n)}static importJSON(e){return Ss().updateFromJSON(e)}collapseAtStart(){return!0}}function Oo(e){return e instanceof Lo}function Fo(e){return new Po(new Map(e._nodeMap))}function Ro(){return new Po(new Map([["root",new Lo]]))}function Io(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ge(130,n.name),Eo(e)){const r=t.children;Array.isArray(r)||ge(59,n.name);const i=e.getChildren();for(let e=0;e<i.length;e++){const t=Io(i[e]);r.push(t)}}return t}class Po{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(e,t){return yo(t&&t.editor||null,this,e)}clone(e){const t=new Po(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return yo(null,this,(()=>({root:Io(Ss())})))}}class Mo extends ko{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Do extends ko{static getType(){return"paragraph"}static clone(e){return new Do(e.__key)}createDOM(e){const t=document.createElement("p"),n=$s(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Bo,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(cl(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return zo().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(void 0===e.textFormat||void 0===e.textStyle){const t=this.getChildren().find(gi);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const n=zo();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||gi(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Bo(e){const t=zo();if(e.style&&(t.setFormat(e.style.textAlign),xl(e,t)),""===t.getFormatType()){const n=e.getAttribute("align");n&&n&&n in We&&t.setFormat(n)}return{node:t}}function zo(){return rl(new Do)}function $o(e){return e instanceof Do}function Ho(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Ro(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const o=e._observer;null!==o&&(o.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function Ko(e){const t=new Set,n=new Set;let r=e;for(;r;){const{ownNodeConfig:e}=wl(r),i=r.transform;if(!n.has(i)){n.add(i);const e=r.transform();e&&t.add(e)}if(e){const n=e.$transform;n&&t.add(n),r=e.extends}else{const e=Object.getPrototypeOf(r);r=e.prototype instanceof Mr&&e!==Mr?e:void 0}}return t}function Uo(e){const t=e||{},n=eo,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,o=t.disableEvents||!1,s=Ro(),l=t.namespace||(null!==i?i._config.namespace:Ns()),a=t.editorState,c=[Lo,ri,jr,fi,Do,Mo,...t.nodes||[]],{onError:u,html:d}=t,h=void 0===t.editable||t.editable;let g;if(void 0===e&&null!==n)g=n._nodes;else{g=new Map;for(let e=0;e<c.length;e++){let t=c[e],n=null,r=null;if("function"!=typeof t){const e=t;t=e.replace,n=e.with,r=e.withKlass||null}wl(t);const i=t.getType(),o=Ko(t);g.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:ut(c[e]),transforms:o})}}const p=new Wo(s,i,g,{disableEvents:o,namespace:l,theme:r},u||console.error,function(e,t){const n=new Map,r=new Set,i=e=>{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&i(n)})),t&&i(t),n}(g,d?d.import:void 0),h,e);return void 0!==a&&(p._pendingEditorState=a,p._dirtyType=2),function(e){e.registerCommand(ln,Cr,0),e.registerCommand(an,Sr,0),e.registerCommand(cn,wr,0),e.registerCommand(un,vr,0),e.registerCommand(Sn,Er,0)}(p),p}class Wo{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ns(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){void 0===n&&ge(35);const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=r.get(e);void 0===i&&ge(36,String(e));const o=i[n];return o.add(t),()=>{o.delete(t),i.every((e=>0===e.size))&&r.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let o=i.get(t);void 0===o&&(o=new Set,i.set(t,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{o.delete(r),0===o.size&&i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&ge(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=bl(n).get(t.getType());if(!r)return;const i=new Map;for(const e of r.keys())i.set(e,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(null!=i){const e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){const n=bl(e.getEditorState()),r=[];for(const e of t){const t=n.get(e);t&&r.push(t)}0!==r.length&&e.update((()=>{for(const e of r)for(const t of e.keys()){const e=ms(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:Br}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return Vs(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=$s(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,Ho(this,t,e,r),null!==t&&(this._config.disableEvents||Fr(t),null!=n&&t.classList.remove(...n)),null!==e){const t=Ys(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,ot(this),this._updateTags.add(Br),bo(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument;or.set(e,n);const r=sr.get(n)??0;r<1&&n.addEventListener("selectionchange",Ar),sr.set(n,r+1),e.__lexicalEditor=t;const i=Tr(e);for(let n=0;n<er.length;n++){const[r,o]=er[n],s="function"==typeof o?e=>{Or(e)||(Lr(e),(t.isEditable()||"click"===r)&&o(e,t))}:e=>{if(Or(e))return;Lr(e);const n=t.isEditable();switch(r){case"cut":return n&&Vs(t,Wn,e);case"copy":return Vs(t,Un,e);case"paste":return n&&Vs(t,fn,e);case"dragstart":return n&&Vs(t,$n,e);case"dragover":return n&&Vs(t,Hn,e);case"dragend":return n&&Vs(t,Kn,e);case"focus":return n&&Vs(t,Jn,e);case"blur":return n&&Vs(t,Yn,e);case"drop":return n&&Vs(t,Bn,e)}};e.addEventListener(r,s),i.push((()=>{e.removeEventListener(r,s)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Br),bo(this);_o("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&ge(38);let n=e;n._readOnly&&(n=Fo(e),n._selection=e._selection?e._selection.clone():null),it(this);const r=this._pendingEditorState,i=this._updateTags,o=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=o&&i.add(o),bo(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||bo(this)}parseEditorState(e,t){return function(e,t,n){const r=Ro(),i=Qi,o=to,s=eo,l=t._dirtyElements,a=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,Qi=r,to=!1,eo=t,jo(null);try{const i=t._nodes;mo(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=l,t._dirtyLeaves=a,t._cloneNotNeeded=c,t._dirtyType=u,Qi=i,to=o,eo=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return bo(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):Co(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),So(this,(()=>{const r=$i(),i=Ss();null!==r?r.dirty||vs(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),Gs("focus"),function(e){so(),co()._deferred.push(e)}((()=>{n.removeAttribute("autocapitalize"),e&&e()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=ll(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,_o("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Wo.version="0.41.0+prod.esm";let Vo=null;function jo(e){Vo=e}let qo=1;function Zo(e,t){const n=Go(e,t);return void 0===n&&ge(30,t),n}function Go(e,t){return e._nodes.get(t)}const Jo="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function Yo(e){return Ao(_s(e))}function Xo(e){const t=document.activeElement;if(!cl(t))return!1;const n=t.nodeName;return Ao(_s(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==ns(t))}function Qo(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!Xo(t)&&ts(t)===e}catch(e){return!1}}function es(e){return e instanceof Wo}function ts(e){let t=e;for(;null!=t;){const e=ns(t);if(es(e))return e;t=qs(t)}return null}function ns(e){return e?e.__lexicalEditor:null}function rs(e){return $e.test(e)?"rtl":He.test(e)?"ltr":null}function is(e){return yi(e)||e.isToken()}function os(e){return is(e)||e.isSegmented()}function ss(e){return ul(e)&&3===e.nodeType}function ls(e){return ul(e)&&9===e.nodeType}function as(e){let t=e;for(;null!=t;){if(ss(t))return t;t=t.firstChild}return null}function cs(e,t,n){const r=Ke[t];if(null!==n&&(e&r)===(n&r))return e;let i=e^r;return"subscript"===t?i&=-65:"superscript"===t?i&=-33:"lowercase"===t?(i&=-513,i&=-1025):"uppercase"===t?(i&=-257,i&=-1025):"capitalize"===t&&(i&=-257,i&=-513),i}function us(e){return gi(e)||Gr(e)||Ao(e)}function ds(e,t){const n=function(){const e=Vo;return Vo=null,e}();if(null!=(t=t||n&&n.__key))return void(e.__key=t);so(),lo();const r=co(),i=ao(),o=""+qo++;i._nodeMap.set(o,e),Eo(e)?r._dirtyElements.set(o,!0):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,e.__key=o}function hs(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),o=e.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,a=null!==i?i.getWritable():null,c=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==a&&(a.__next=s),null!==c&&(c.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function gs(e){lo(),Pr(e)&&ge(323,e.__key,e.__type);const t=e.getLatest(),n=t.__parent,r=ao(),i=co(),o=r._nodeMap,s=i._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,o,s);const l=t.__key;i._dirtyType=1,Eo(e)?s.set(l,!0):i._dirtyLeaves.add(l)}function ps(e){so();const t=co(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=ms(n);null!==e&&e.getWritable()}if(null!==e){const t=ms(e);null!==t&&t.getWritable()}}}function fs(){return oo()?null:co()._compositionKey}function ms(e,t){const n=(t||ao())._nodeMap.get(e);return void 0===n?null:n}function ys(e,t){const n=bs(e,co());return void 0!==n?ms(n,t):null}function bs(e,t){return e[`__lexicalKey_${t._key}`]}function _s(e,t){let n=e;for(;null!=n;){const e=ys(n,t);if(null!==e)return e;n=qs(n)}return null}function xs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Cs(e){return e.read((()=>Ss().getTextContent()))}function Ss(){return ws(ao())}function ws(e){return e._nodeMap.get("root")}function vs(e){so();const t=ao();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function ks(e){const t=co(),n=function(e,t){let n=e;for(;null!=n;){const e=bs(n,t);if(void 0!==e)return e;n=qs(n)}return null}(e,t);return null===n?e===t.getRootElement()?ms("root"):null:ms(n)}function Es(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Ts(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function Ns(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function As(e){return ss(e)?e.nodeValue:null}function Ls(e,t,n){const r=ll(Xs(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=As(i);const r=_s(i);if(null!==t&&gi(r)){if((t===Pe||t===De)&&n){const e=n.length;t=n,o=e,s=e}null!==t&&Os(r,t,o,s,e)}}}function Os(e,t,n,r,i){let o=e;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let l=t;if((s||i)&&(t.endsWith(Pe)&&(l=t.slice(0,-Pe.length)),i)){const e=De;let t;for(;-1!==(t=l.indexOf(e));)l=l.slice(0,t)+l.slice(t+e.length),null!==n&&n>t&&(n=Math.max(t,n-e.length)),null!==r&&r>t&&(r=Math.max(t,r-e.length))}const a=o.getTextContent();if(i||l!==a){if(""===l){if(ps(null),xe||Ce||ke)o.remove();else{const e=co();setTimeout((()=>{e.update((()=>{o.isAttached()&&o.remove()}))}),20)}return}const t=o.getParent(),i=Hi(),a=o.getTextContentSize(),c=fs(),u=o.getKey();if(o.isToken()||null!==c&&u===c&&!s||wi(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===e.__key&&i.focus.offset===a&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const d=$i();if(!wi(d)||null===n||null===r)return void Fs(o,l,d);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){const e=hi(o.getTextContent());o.replace(e),o=e}Fs(o,l,d)}}}function Fs(e,t,n){if(e.setTextContent(t),wi(n)){const t=e.getKey();for(const r of["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===t&&(i.offset=Hl(e,i.offset,"clamp"))}}}function Rs(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function Is(e,t,n){if(!function(e,t){return Rs(e,t,"altKey")&&Rs(e,t,"ctrlKey")&&Rs(e,t,"shiftKey")&&Rs(e,t,"metaKey")}(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1)return!1;if(1===e.key.length&&e.key.charCodeAt(0)<=127)return!1;const r="Key"+t.toUpperCase();return e.code===r}const Ps={ctrlKey:!ye,metaKey:ye},Ms={altKey:ye,ctrlKey:!ye};function Ds(e){return"Backspace"===e.key}function Bs(e){return Is(e,"a",Ps)}function zs(e){const t=Ss();if(wi(e)){const t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),St(e),e}{const e=t.select(0,t.getChildrenSize());return vs(St(e)),e}}function $s(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const i=e[t];if("string"==typeof i){const e=xa(i);return n[t]=e,e}return i}function Hs(e,t,n,r,i){if(0===n.size)return;const o=r.__type,s=r.__key,l=t.get(o);void 0===l&&ge(33,o);const a=l.klass;let c=e.get(a);void 0===c&&(c=new Map,e.set(a,c));const u=c.get(s),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(s,d?"updated":i)}function Ks(e,t,n){const r=e.getParent();let i=n,o=e;return null!==r&&(t&&0===n?(i=o.getIndexWithinParent(),o=r):t||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(t?i-1:i)}function Us(e,t){const n=e.offset;if("element"===e.type)return Ks(e.getNode(),t,n);{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?Ks(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function Ws(e){const t=Xs(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Vs(e,t,n){return function(e,t,n){const r=Ts(e);for(let i=4;i>=0;i--)for(let o=0;o<r.length;o++){const s=r[o],l=s._commands.get(t);if(void 0!==l){const t=l[i];if(void 0!==t){const r=Array.from(t),i=r.length;let o=!1;if(So(s,(()=>{for(let t=0;t<i;t++)if(r[t](n,e))return void(o=!0)})),o)return o}}}return!1}(e,t,n)}function js(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&ge(75,t),n}function qs(e){const t=e.assignedSlot||e.parentElement;return dl(t)?t.host:t}function Zs(e){return ls(e)?e:cl(e)?e.ownerDocument:null}function Gs(e){so(),co()._updateTags.add(e)}function Js(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function Ys(e){const t=Zs(e);return t?t.defaultView:null}function Xs(e){const t=e._window;return null===t&&ge(78),t}function Qs(e){return Eo(e)&&e.isInline()||Ao(e)&&e.isInline()}function el(e){let t=e.getParentOrThrow();for(;null!==t;){if(tl(t))return t;t=t.getParentOrThrow()}return t}function tl(e){return Oo(e)||Eo(e)&&e.isShadowRoot()}function nl(e){const t=e.constructor.clone(e);return ds(t,null),t.afterCloneFrom(e),t}function rl(e){const t=co(),n=e.getType(),r=Go(t,n);void 0===r&&ge(200,e.constructor.name,n);const{replace:i,replaceWithKlass:o}=r;if(null!==i){const t=i(e),r=t.constructor;return null!==o?t instanceof o||ge(201,o.name,o.getType(),r.name,r.getType(),e.constructor.name,n):t instanceof e.constructor&&r!==e.constructor||ge(202,r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&ge(203,e.constructor.name,n,r.name,r.getType()),t}return e}function il(e,t){!Oo(e.getParent())||Eo(t)||Ao(t)||ge(99)}function ol(e){return(Ao(e)||Eo(e)&&!e.canBeEmpty())&&!e.isInline()}function sl(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;null!==r&&r.removeChild(e)}function ll(e){return fe?(e||window).getSelection():null}function al(e){return cl(e)&&"A"===e.tagName}function cl(e){return ul(e)&&1===e.nodeType}function ul(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function dl(e){return ul(e)&&11===e.nodeType}function hl(e){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==e.nodeName.match(t)}function gl(e){const t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==e.nodeName.match(t)}function pl(e){if(Ao(e)&&!e.isInline())return!0;if(!Eo(e)||tl(e))return!1;const t=e.getFirstChild(),n=null===t||Gr(t)||gi(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function fl(){return co()}const ml=new WeakMap,yl=new Map;function bl(e){if(!e._readOnly&&e.isEmpty())return yl;e._readOnly||ge(192);let t=ml.get(e);return t||(t=function(e){const t=new Map;for(const[n,r]of e._nodeMap){const e=r.__type;let i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),ml.set(e,t)),t}function _l(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function xl(e,t){const n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function Cl(e){return!0===e.__lexicalUnmanaged}function Sl(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Mr[t]}function wl(e){const t=Ze in e.prototype?e.prototype[Ze]():void 0,n=function(e){if(!(e===Mr||e.prototype instanceof Mr)){let t="<unknown>",n="<unknown>";try{t=e.getType()}catch(e){}try{Wo.version&&(n=JSON.parse(Wo.version))}catch(e){}ge(290,e.name,t,n)}return e===No||e===ko||e===Mr}(e),r=!n&&Sl(e,"getType")?e.getType():void 0;let i,o=r;if(t)if(r)i=t[r];else for(const[e,n]of Object.entries(t))o=e,i=n;if(!n&&o&&(Sl(e,"getType")||(e.getType=()=>o),Sl(e,"clone")||(e.clone=t=>(jo(t),new e)),Sl(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Sl(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}const vl=(e,t)=>{let n=e;for(;null!=n&&!Oo(n);){if(t(n))return n;n=n.getParent()}return null},kl={next:"previous",previous:"next"};class El{origin;constructor(e){this.origin=e}[Symbol.iterator](){return Jl({hasNext:Il,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return zl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return zl(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,t,n="next"){const r=n===this.direction?t:Array.from(t).reverse();let i=this;const o=this.getParentAtCaret(),s=new Map;for(let t=i.getAdjacentCaret();null!==t&&s.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();s.set(e.getKey(),e)}for(const e of r){if(s.size>0){const t=i.getNodeAtCaret();if(t)if(s.delete(t.getKey()),s.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(o)&&e.remove(),t.replace(e)}else null===t&&ge(263,Array.from(s).join(" "))}else i.insert(e);i=zl(e,this.direction)}for(const e of s.values())e.remove();return this}}class Tl extends El{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Ul(e,this.direction)}getParentCaret(e="root"){return zl(Ll(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Al(this.direction);return zl(this.getNodeAtCaret(),e)||Ul(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Tl&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Nl={root:Oo,shadowRoot:tl};function Al(e){return kl[e]}function Ll(e,t="root"){return Nl[t](e)?null:e}class Ol extends El{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:zl(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Eo(this.origin)?Ul(this.origin,this.direction):null}getParentCaret(e="root"){return zl(Ll(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Al(this.direction);return zl(this.getNodeAtCaret(),e)||Ul(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Ol&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Ol||e instanceof Fl)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Fl extends El{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:$l(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return zl(Ll(this.getParentAtCaret(),e),this.direction)}getFlipped(){return $l(this.origin,Al(this.direction),this.offset)}isSamePointCaret(e){return e instanceof Fl&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Ol||e instanceof Fl)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return zl(this.origin,this.direction)}}function Rl(e){return e instanceof Fl}function Il(e){return e instanceof Ol}function Pl(e){return e instanceof Tl}const Ml={next:class extends Fl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Fl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Dl={next:class extends Ol{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ol{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Bl={next:class extends Tl{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Tl{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function zl(e,t){return e?new Dl[t](e):null}function $l(e,t,n){return e?new Ml[t](e,Hl(e,n)):null}function Hl(e,t,n="error"){const r=e.getTextContentSize();let i="next"===t?r:"previous"===t?0:t;return(i<0||i>r)&&("clamp"!==n&&pe(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function Kl(e,t){return new jl(e,t)}function Ul(e,t){return Eo(e)?new Bl[t](e):null}function Wl(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class Vl{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new Vl(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Rl(t)?function(e,t){const{direction:n,origin:r}=e;return Kl(e,Hl(r,"focus"===t?Al(n):n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){const{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[Kl(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Rl(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Rl(n),i=t=>t.isSameNodeCaret(n)?null:Wl(t)||t.getParentCaret(e);return Jl({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class jl{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return $l(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function ql(e){return Gl(e,zl(Ss(),e.direction))}function Zl(e){return Gl(e,e)}function Gl(e,t){return e.direction!==t.direction&&ge(265),new Vl(e,t,e.direction)}function Jl(e){const{initial:t,hasNext:n,step:r,map:i}=e;let o=t;return{[Symbol.iterator](){return this},next(){if(!n(o))return{done:!0,value:void 0};const e={done:!1,value:i(o)};return o=r(o),e}}}function Yl(e,t){const n=ta(e.origin,t.origin);switch(null===n&&ge(275,e.origin.getKey(),t.origin.getKey()),n.type){case"same":{const n="text"===e.type,r="text"===t.type;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:"child"===e.type?-1:1}case"ancestor":return"child"===e.type?-1:1;case"descendant":return"child"===t.type?1:-1;case"branch":return Xl(n)}}function Xl(e){const{a:t,b:n}=e,r=t.__key,i=n.__key;let o=t,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return-1;if(s.__key===r)return 1}return null===o?1:-1}function Ql(e,t){return t.is(e)}function ea(e){return Eo(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function ta(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};const n=new Map;for(let[t,r]=ea(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=ea(t);r;i=r,r=r.getParent()){const o=n.get(r);if(void 0!==o)return null===o?(Ql(e,r)||ge(276),{commonAncestor:r,type:"ancestor"}):null===i?(Ql(t,r)||ge(277),{commonAncestor:r,type:"descendant"}):((Eo(o)||Ql(e,o))&&(Eo(i)||Ql(t,i))&&r.is(o.getParent())&&r.is(i.getParent())||ge(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function na(e,t){const{type:n,key:r,offset:i}=e,o=function(e){const t=ms(e);return null===t&&ge(63,e),t}(e.key);return"text"===n?(gi(o)||ge(266,o.getType(),r),$l(o,t,i)):(Eo(o)||ge(267,o.getType(),r),function(e,t,n){let r=Ul(e,"next");for(let e=0;e<t;e++){const e=r.getAdjacentCaret();if(null===e)break;r=e}return ga(r,n)}(o,e.offset,t))}function ra(e,t){const{origin:n,direction:r}=t,i="next"===r;Rl(t)?e.set(n.getKey(),t.offset,"text"):Il(t)?gi(n)?e.set(n.getKey(),Hl(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),"element"):(Pl(t)&&Eo(n)||ge(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function ia(e){const t=$i(),n=wi(t)?t:Di();return oa(n,e),vs(n),n}function oa(e,t){ra(e.anchor,t.anchor),ra(e.focus,t.focus)}function sa(e){const{anchor:t,focus:n}=e,r=na(t,"next"),i=na(n,"next"),o=Yl(r,i)<=0?"next":"previous";return Gl(ga(r,o),ga(i,o))}function la(e){const{direction:t,origin:n}=e,r=zl(n,Al(t)).getNodeAtCaret();return r?zl(r,t):Ul(n.getParentOrThrow(),t)}function aa(e,t="root"){const n=[e];for(let r=Pl(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(la(r));return n}function ca(e){return!!e&&e.origin.isAttached()}function ua(e,t="removeEmptySlices"){if(e.isCollapsed())return e;const n="root",r="next";let i=t;const o=pa(e,r),s=aa(o.anchor,n),l=aa(o.focus.getFlipped(),n),a=new Set,c=[];for(const e of o.iterNodeCarets(n))if(Pl(e))a.add(e.origin.getKey());else if(Il(e)){const{origin:t}=e;Eo(t)&&!a.has(t.getKey())||c.push(t)}for(const e of c)e.remove();for(const e of o.getTextSlices()){if(!e)continue;const{origin:t}=e.caret,n=t.getTextContentSize(),o=la(zl(t,r)),a=t.getMode();if(Math.abs(e.distance)===n&&"removeEmptySlices"===i||"token"===a&&0!==e.distance)o.remove();else if(0!==e.distance){i="removeEmptySlices";let t=e.removeTextSlice();const n=e.caret.origin;if("segmented"===a){const e=t.origin,n=hi(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());o.replaceOrInsert(n),t=$l(n,r,t.offset)}n.is(s[0].origin)&&(s[0]=t),n.is(l[0].origin)&&(l[0]=t.getFlipped())}}let u,d;for(const e of s)if(ca(e)){u=da(e);break}for(const e of l)if(ca(e)){d=da(e);break}const h=function(e,t,n){if(!e||!t)return null;const r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let a;for(a=0;a<l&&o[a]===s[a];a++);const c=(e,t)=>{let n;for(let r=a;r<e.length;r++){const i=e[r];if(tl(i))return;!n&&t(i)&&(n=i)}return n},u=c(o,pl),d=u&&c(s,(e=>n.has(e.getKey())&&pl(e)));return u&&d?[u,d]:null}(u,d,a);if(h){const[e,t]=h;Ul(e,"previous").splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){const e=n;n=n.getParent(),e.remove(!0)}}const g=[u,d,...s,...l].find(ca);if(g)return Zl(ga(da(g),e.direction));ge(269,JSON.stringify(s.map((e=>e.origin.__key))))}function da(e){const t=function(e){let t=e;for(;Pl(t);){const e=Wl(t);if(!Pl(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(gi(t.origin))return Rl(t)?t:$l(t.origin,n,n);const r=t.getAdjacentCaret();return Il(r)&&gi(r.origin)?$l(r.origin,n,Al(n)):t}function ha(e){return Rl(e)&&e.offset!==Hl(e.origin,e.direction)}function ga(e,t){return e.direction===t?e:e.getFlipped()}function pa(e,t){return e.direction===t?e:Gl(ga(e.focus,t),ga(e.anchor,t))}function fa(e,t="root"){let n=0,r=e,i=Wl(r);for(;null===i;){if(n--,i=r.getParentCaret(t),!i)return null;r=i,i=Wl(r)}return i&&[i,n]}function ma(e){const{origin:t,offset:n,direction:r}=e;if(n===Hl(t,r))return e.getSiblingCaret();if(n===Hl(t,Al(r)))return la(e.getSiblingCaret());const[i]=t.splitText(n);return gi(i)||ge(281),ga(zl(i,"next"),r)}function ya(e,t){return!0}function ba(e,{$copyElementNode:t=nl,$splitTextPointCaretNext:n=ma,rootMode:r="shadowRoot",$shouldSplit:i=ya}={}){if(Rl(e))return n(e);const o=e.getParentCaret(r);if(o){const{origin:n}=o;if(Pl(e)&&(!n.canBeEmpty()||!i(n,"first")))return la(o);const r=function(e){const t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||n.canBeEmpty()&&i(n,"last"))&&o.insert(t(n).splice(0,0,r))}return o}function _a(e,t){if(!t||e===t)return e;for(const n in t)if(e[n]!==t[n])return{...e,...t};return e}function xa(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function Ca(e,...t){const n=xa(...t);n.length>0&&e.classList.add(...n)}function Sa(e,...t){const n=xa(...t);n.length>0&&e.classList.remove(...n)}function wa(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function va(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const ka=new Map;function Ea(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,r]=e.split(/:([^]+)/);n&&r&&(t[n.trim()]=r.trim())}return t}function Ta(e){let t=ka.get(e);return void 0===t&&(t=Ea(e),ka.set(e,t)),t}function Na(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Aa(e){const t=fl().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function La(e){return Aa(Oo(e)?e:e.getParentOrThrow())}function Oa(e){const t=La(e);return null!==t&&"rtl"===t.direction}function Fa(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!os(t)&&null!==r){const[i,o]=r,s=e.isBackward(),l=i.getNode(),a=o.getNode(),c=t.is(l),u=t.is(a);if(c||u){const[r,i]=Ti(e),o=l.is(a),c=t.is(s?a:l),u=t.is(s?l:a);let d,h=0;o?(h=r>i?i:r,d=r>i?r:i):c?(h=s?i:r,d=void 0):u&&(h=0,d=s?r:i);const g=t.__text.slice(h,d);g!==t.__text&&("clone"===n&&(t=function(e){return(t=_l(e))[Ir]=!0,t;var t}(t)),t.__text=g)}}return t}function Ra(e){const t=e.getStyle(),n=Ea(t);ka.set(t,n)}function Ia(e,t){(wi(e)?e.isCollapsed():gi(e)||Eo(e))||va(280);const n=Ta(wi(e)?e.style:gi(e)?e.getStyle():e.getTextStyle()),r=Object.entries(t).reduce(((t,[r,i])=>("function"==typeof i?t[r]=i(n[r],e):null===i?delete t[r]:t[r]=i,t)),{...n}),i=Na(r);wi(e)||gi(e)?e.setStyle(i):e.setTextStyle(i),ka.set(i,r)}function Pa(e,t){if(wi(e)&&e.isCollapsed()){Ia(e,t);const n=e.anchor.getNode();Eo(n)&&n.isEmpty()&&Ia(n,t)}!function(e){const t=$i();if(!t)return;const n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(wi(t))for(const e of sa(t).getTextSlices())e&&n.set(e.caret.origin.getKey(),e.getSliceIndices());const i=t.getNodes();for(const t of i){if(!gi(t)||!t.canHaveFormat())continue;const[n,i]=r(t);i!==n&&(os(t)||0===n&&i===t.getTextContentSize()?e(t):e(t.splitText(n,i)[0===n?0:1]))}wi(t)&&"text"===t.anchor.type&&"text"===t.focus.type&&t.anchor.key===t.focus.key&&function(e){if(e.isBackward()){const{anchor:t,focus:n}=e,{key:r,offset:i,type:o}=t;t.set(n.key,n.offset,n.type),n.set(r,i,o)}}(t)}((e=>{Ia(e,t)}));const n=e.getNodes();if(n.length>0){const e=new Set;for(const r of n){if(!Eo(r)||!r.canBeEmpty()||0!==r.getChildrenSize())continue;const n=r.getKey();e.has(n)||(e.add(n),Ia(r,t))}}}function Ma(e){const t=Da(e);return null!==t&&"vertical-rl"===t.writingMode}function Da(e){const t=e.anchor.getNode();return Eo(t)?Aa(t):La(t)}function Ba(e,t){let n=Ma(e)?!t:t;za(e)&&(n=!n);const r=na(e.focus,n?"previous":"next");if(ha(r))return!1;for(const e of ql(r)){if(Pl(e))return!e.origin.isInline();if(!Eo(e.origin)){if(Ao(e.origin))return!0;break}}return!1}function za(e){const t=Da(e);return null!==t&&"rtl"===t.direction}function $a(e,t,n){const r=za(e);let i;i=Ma(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}function Ha(e,t,n){const r=Ta(e.getStyle());return null!==r&&r[t]||n}function Ka(e,t,n=""){let r=null;const i=e.getNodes(),o=e.anchor,s=e.focus,l=e.isBackward(),a=l?s.offset:o.offset,c=l?s.getNode():o.getNode();if(wi(e)&&e.isCollapsed()&&""!==e.style){const n=Ta(e.style);if(null!==n&&t in n)return n[t]}for(let e=0;e<i.length;e++){const o=i[e];if((0===e||0!==a||!o.is(c))&&gi(o)){const e=Ha(o,t,n);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?n:r}function Ua(e,t){const n={...e,...t};for(const[r,i]of Object.entries(t))Wa(e[r],i)&&(n[r]=Ua(e[r],i));return n}function Wa(...e){return e.every((e=>e&&e.constructor==Object))}class Va{#e={};constructor(...e){this.merge(...e)}merge(...e){return this.#e=e.reduce(Ua,this.#e)}get(e){return e.split(".").reduce(((e,t)=>e[t]),this.#e)}}function ja(e,t){return[...Array(1+t-e).keys()].map((t=>t+e))}const qa=new Va({attachmentTagName:"action-text-attachment",attachmentContentTypeNamespace:"actiontext",authenticatedUploads:!1,extensions:[]}),Za=new Va({default:{attachments:!0,markdown:!0,multiLine:!0,richText:!0,toolbar:!0,highlight:{buttons:{color:ja(1,9).map((e=>`var(--highlight-${e})`)),"background-color":ja(1,9).map((e=>`var(--highlight-bg-${e})`))},permit:{color:[],"background-color":[]}}}});var Ga={global:qa,presets:Za,configure({global:e,...t}){e&&qa.merge(e),Za.merge(t)}};const Ja=["a","b","blockquote","br","code","div","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","li","mark","ol","p","pre","q","s","strong","u","ul","table","tbody","tr","th","td"],Ya=["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","style","title","url","width"],Xa=["color","background-color"];function Qa(){const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content}function ec(e,t){const n=document.activeElement;if(e.includes(n)){new tc(e,t.key).selectNext(n)&&t.preventDefault()}}he.addHook("uponSanitizeAttribute",(function(e,t){if("style"===t.attrName&&t.attrValue){const e={...Ta(t.attrValue)},n={};for(const t in e)Xa.includes(t)&&(n[t]=e[t]);Object.keys(n).length?t.attrValue=Na(n):t.keepAttr=!1}})),he.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));class tc{constructor(e,t){this.elements=e,this.key=t}selectNext(e){const t=this.#t(e);if(t){const e=this.elements.filter((e=>e!==t));return this.#n(e),this.#r(t),!0}return!1}#t(e){switch(this.key){case"ArrowRight":case"ArrowDown":return this.#i(e);case"ArrowLeft":case"ArrowUp":return this.#o(e);case"Home":return this.#s();case"End":return this.#l()}}#s(e=this.elements){return e.find(nc)}#l(e=this.elements){return e.findLast(nc)}#i(e){const t=this.elements.slice(this.#a(e)+1);return this.#s(t)}#o(e){const t=this.elements.slice(0,this.#a(e));return this.#l(t)}#a(e){return this.elements.indexOf(e)}#r(e){nc(e)&&(e.tabIndex=0,e.focus())}#n(e){e.forEach((e=>e.tabIndex=-1))}}function nc(e){return e&&!e.disabled&&e.checkVisibility()}var rc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.05273 1.88232C10.6866 1.88237 12.0033 2.20353 12.9529 2.89673L13.1272 3.0293C13.974 3.70864 14.4008 4.63245 14.4009 5.76562C14.4008 6.49354 14.2316 7.15281 13.8845 7.73145C13.6683 8.09188 13.3997 8.40162 13.0818 8.66016C13.5902 8.92606 14.0196 9.28599 14.3635 9.74121C14.8586 10.3834 15.0945 11.1743 15.0945 12.0879C15.0944 13.3698 14.5922 14.3931 13.5879 15.1106L13.5857 15.1128C12.5967 15.805 11.196 16.125 9.43799 16.125H3.10547V1.88232L9.05273 1.88232ZM6.36108 13.4084H9.28418C10.224 13.4084 10.8634 13.2491 11.2581 12.9851C11.6259 12.7389 11.8198 12.3768 11.8198 11.8367C11.8197 11.2968 11.6259 10.9351 11.2581 10.689C10.8634 10.425 10.2241 10.2649 9.28418 10.2649H6.36108V13.4084ZM6.36108 7.56812H8.78247C9.5163 7.56809 10.0547 7.45371 10.429 7.25757L10.5791 7.16895C10.9438 6.92178 11.1255 6.57934 11.1255 6.09302C11.1254 5.59017 10.9414 5.25227 10.5835 5.02002L10.5784 5.01636L10.5732 5.01343C10.1994 4.75387 9.61878 4.59818 8.78247 4.59814H6.36108V7.56812Z"/>\n </svg>',ic='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.1379 3.91187L14.1086 4.06421H11.4668L9.49805 13.9431H12.0981L11.7473 15.7852L11.7188 15.9375H4.16675L4.51758 14.0955L4.54614 13.9431H7.18799L9.17505 4.06421H6.55664L6.90747 2.22217L6.93677 2.06982H14.4888L14.1379 3.91187Z"/>\n </svg>',oc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.3723 11.8015C14.3771 11.8858 14.3811 11.9756 14.3811 12.0681C14.3811 12.811 14.1777 13.4959 13.7725 14.1174L13.7717 14.1189C13.3624 14.7329 12.7463 15.2162 11.9377 15.5742L11.9348 15.5757C11.1214 15.9223 10.1306 16.092 8.96997 16.092C7.9356 16.092 6.93308 15.9348 5.96338 15.6204L5.96045 15.6189C5.00593 15.292 4.24112 14.8699 3.67676 14.3459L3.57568 14.2522L3.63501 14.1277L4.45605 12.397L4.64282 12.5654C5.13492 13.0083 5.76733 13.3759 6.54492 13.6648C7.33475 13.9406 8.14322 14.0786 8.96997 14.0786C10.0731 14.0786 10.8638 13.8932 11.3708 13.5513C11.8757 13.1982 12.1172 12.7464 12.1172 12.1838C12.1172 12.0662 12.1049 11.9556 12.0828 11.8513L12.0344 11.625H14.3621L14.3723 11.8015Z"/>\n <path d="M9.2981 1.91602C10.111 1.91604 10.9109 2.02122 11.6975 2.23096C12.4855 2.44111 13.1683 2.74431 13.7417 3.14429L13.8655 3.23071L13.8083 3.36987L13.1726 4.91235L13.0869 5.1189L12.8987 4.99878C12.3487 4.64881 11.761 4.38633 11.1365 4.21143L11.1328 4.20996C10.585 4.04564 10.0484 3.95419 9.52295 3.93384L9.2981 3.92944C8.22329 3.92944 7.44693 4.12611 6.94043 4.49121C6.44619 4.85665 6.20874 5.31616 6.20874 5.88135L6.21533 6.03296C6.24495 6.37662 6.37751 6.65526 6.61011 6.87964L6.72144 6.97632C6.98746 7.19529 7.30625 7.37584 7.68018 7.51538L8.05151 7.63184C8.45325 7.75061 8.94669 7.87679 9.53247 8.01123L9.53467 8.01196C10.1213 8.15305 10.6426 8.29569 11.0991 8.4375H15C15.5178 8.4375 15.9375 8.85723 15.9375 9.375C15.9375 9.89277 15.5178 10.3125 15 10.3125H3C2.48223 10.3125 2.0625 9.89277 2.0625 9.375C2.0625 8.85723 2.48223 8.4375 3 8.4375H4.93726C4.83783 8.34526 4.74036 8.24896 4.64795 8.146L4.64502 8.14233C4.1721 7.58596 3.94482 6.85113 3.94482 5.95825C3.94483 5.20441 4.14059 4.51965 4.53369 3.90967L4.53516 3.90747C4.94397 3.29427 5.55262 2.81114 6.34863 2.45288C7.15081 2.0919 8.13683 1.91602 9.2981 1.91602Z"/>\n </svg>',sc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.5 2C12.0523 2 12.5 2.44772 12.5 3V3.5C12.5 4.05228 12.0523 4.5 11.5 4.5H8V15C8 15.5523 7.55228 16 7 16H6.5C5.94772 16 5.5 15.5523 5.5 15V4.5H2C1.44772 4.5 1 4.05228 1 3.5V3C1 2.44772 1.44772 2 2 2H11.5ZM16 7C16.5523 7 17 7.44772 17 8V8.5C17 9.05228 16.5523 9.5 16 9.5H15V15C15 15.5523 14.5523 16 14 16H13.5C12.9477 16 12.5 15.5523 12.5 15V9.5H11.5C10.9477 9.5 10.5 9.05228 10.5 8.5V8C10.5 7.44772 10.9477 7 11.5 7H16Z"/>\n </svg>',lc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M16.4564 14.4272C17.1356 15.5592 16.3204 17.0002 15.0003 17.0004C13.68 17.0004 12.864 15.5593 13.5433 14.4272L15.0003 12.0004L16.4564 14.4272ZM5.1214 1.70746C5.51192 1.31693 6.14494 1.31693 6.53546 1.70746L9.7171 4.8891L13.2532 8.42426C14.2295 9.40056 14.2295 10.9841 13.2532 11.9604L9.7171 15.4955C8.74078 16.4718 7.15822 16.4718 6.18195 15.4955L2.64679 11.9604C1.67048 10.9841 1.67048 9.40057 2.64679 8.42426L6.18195 4.8891C6.30299 4.76805 6.43323 4.66177 6.57062 4.57074L5.1214 3.12152C4.73091 2.73104 4.73099 2.09799 5.1214 1.70746ZM8.30304 6.30316C8.10776 6.10815 7.79119 6.10799 7.59601 6.30316L4.06085 9.83929L3.9964 9.91742C3.88661 10.0838 3.88645 10.3019 3.9964 10.4682L4.02277 10.5004H11.8763C12.0312 10.3043 12.02 10.0205 11.8392 9.83929L8.30304 6.30316Z"/>\n </svg>',ac='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.8885 7.23091L13.9479 6.17155C14.5337 5.58576 14.5337 4.63602 13.9479 4.05023C13.3621 3.46444 12.4124 3.46444 11.8266 4.05023L8.29235 7.58446C7.9263 7.95051 7.90312 8.52994 8.2233 8.92271L8.36141 9.07463C8.68158 9.4674 8.65841 10.0468 8.29235 10.4129C7.90183 10.8034 7.26866 10.8034 6.87814 10.4129C5.70657 9.24131 5.70657 7.34182 6.87814 6.17025L10.4124 2.63602C11.7792 1.26918 13.9953 1.26918 15.3621 2.63602C16.729 4.00285 16.729 6.21893 15.3621 7.58576L14.3028 8.64512C13.9122 9.03564 13.2791 9.03564 12.8885 8.64512C12.498 8.2546 12.498 7.62143 12.8885 7.23091Z"/>\n <path d="M5.11038 10.7664L4.04843 11.8284C3.46264 12.4142 3.46264 13.3639 4.04842 13.9497C4.63421 14.5355 5.58396 14.5355 6.16975 13.9497L9.70657 10.4129C10.0726 10.0468 10.0958 9.46741 9.77563 9.07464L9.63752 8.92272C9.31734 8.52995 9.34052 7.95052 9.70657 7.58446C10.0971 7.19394 10.7303 7.19394 11.1208 7.58446C12.2924 8.75604 12.2924 10.6555 11.1208 11.8271L7.58396 15.3639C6.21712 16.7308 4.00105 16.7308 2.63421 15.3639C1.26738 13.9971 1.26738 11.781 2.63421 10.4142L3.69617 9.35223C4.08669 8.96171 4.71986 8.96171 5.11038 9.35223C5.5009 9.74275 5.5009 10.3759 5.11038 10.7664Z"/>\n </svg>',cc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M4.96387 4.23438C6.8769 4.23438 8.42767 5.78522 8.42773 7.69824C8.42773 8.32925 8.25769 8.92015 7.96289 9.42969L7.96387 9.43066L5.11816 14.3584C4.77659 14.95 4.02038 15.153 3.42871 14.8115C2.83701 14.4699 2.63397 13.7128 2.97559 13.1211L4.16113 11.0674C2.63532 10.7052 1.5 9.33485 1.5 7.69824C1.50006 5.78524 3.05086 4.2344 4.96387 4.23438ZM13.0361 4.23438C14.9491 4.23449 16.4999 5.7853 16.5 7.69824C16.5 8.32921 16.3299 8.92017 16.0352 9.42969L16.0361 9.43066L13.1904 14.3584C12.8488 14.9501 12.0917 15.1531 11.5 14.8115C10.9085 14.4698 10.7063 13.7127 11.0479 13.1211L12.2324 11.0674C10.7069 10.7049 9.57227 9.33461 9.57227 7.69824C9.57233 5.78522 11.1231 4.23438 13.0361 4.23438Z"/>\n </svg>',uc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.29289 3.79295C6.68342 3.40243 7.31643 3.40243 7.70696 3.79295C8.09748 4.18348 8.09748 4.81649 7.70696 5.20702L3.91399 8.99999L7.70696 12.793C8.09748 13.1835 8.09748 13.8165 7.70696 14.207C7.31643 14.5975 6.68342 14.5975 6.29289 14.207L1.79289 9.70702C1.40237 9.31649 1.40237 8.68348 1.79289 8.29295L6.29289 3.79295Z"/>\n <path d="M11.707 3.79295C11.3164 3.40243 10.6834 3.40243 10.2929 3.79295C9.90237 4.18348 9.90237 4.81649 10.2929 5.20702L14.0859 8.99999L10.2929 12.793C9.90237 13.1835 9.90237 13.8165 10.2929 14.207C10.6834 14.5975 11.3164 14.5975 11.707 14.207L16.207 9.70702C16.5975 9.31649 16.5975 8.68348 16.207 8.29295L11.707 3.79295Z"/>\n </svg>',dc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M3 12.5C3.82843 12.5 4.5 13.1716 4.5 14C4.5 14.8284 3.82843 15.5 3 15.5C2.17157 15.5 1.5 14.8284 1.5 14C1.5 13.1716 2.17157 12.5 3 12.5ZM15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM3 7.5C3.82843 7.5 4.5 8.17157 4.5 9C4.5 9.82843 3.82843 10.5 3 10.5C2.17157 10.5 1.5 9.82843 1.5 9C1.5 8.17157 2.17157 7.5 3 7.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM3 2.5C3.82843 2.5 4.5 3.17157 4.5 4C4.5 4.82843 3.82843 5.5 3 5.5C2.17157 5.5 1.5 4.82843 1.5 4C1.5 3.17157 2.17157 2.5 3 2.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>\n </svg>',hc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.5 13C16.0523 13 16.5 13.4477 16.5 14C16.5 14.5523 16.0523 15 15.5 15H7C6.44772 15 6 14.5523 6 14C6 13.4477 6.44772 13 7 13H15.5ZM15.5 8C16.0523 8 16.5 8.44772 16.5 9C16.5 9.55228 16.0523 10 15.5 10H7C6.44772 10 6 9.55228 6 9C6 8.44772 6.44772 8 7 8H15.5ZM15.5 3C16.0523 3 16.5 3.44772 16.5 4C16.5 4.55228 16.0523 5 15.5 5H7C6.44772 5 6 4.55228 6 4C6 3.44772 6.44772 3 7 3H15.5Z"/>\n <path d="M2.98657 16.0967C2.68042 16.0967 2.41187 16.0465 2.18091 15.9463C1.95174 15.846 1.77002 15.7046 1.63574 15.522C1.50146 15.3376 1.42448 15.1227 1.40479 14.8774L1.4021 14.8452H2.34204L2.34741 14.8748C2.35815 14.9589 2.39038 15.035 2.44409 15.103C2.49959 15.1711 2.5721 15.2248 2.66162 15.2642C2.75293 15.3035 2.86035 15.3232 2.98389 15.3232C3.10563 15.3232 3.21037 15.3027 3.2981 15.2615C3.38761 15.2185 3.45654 15.1603 3.50488 15.0869C3.55322 15.0135 3.57739 14.9294 3.57739 14.8345V14.8291C3.57739 14.6715 3.51921 14.5516 3.40283 14.4692C3.28646 14.3869 3.12085 14.3457 2.90601 14.3457H2.48706V13.677H2.90063C3.02775 13.677 3.13607 13.6582 3.22559 13.6206C3.31689 13.583 3.38672 13.5302 3.43506 13.4622C3.48519 13.3941 3.51025 13.3153 3.51025 13.2258V13.2205C3.51025 13.1256 3.48877 13.0441 3.4458 12.9761C3.40462 12.9062 3.34375 12.8534 3.26318 12.8176C3.18441 12.78 3.08952 12.7612 2.97852 12.7612C2.86572 12.7612 2.76636 12.7809 2.68042 12.8203C2.59627 12.8579 2.52913 12.9125 2.479 12.9841C2.43066 13.054 2.40112 13.1363 2.39038 13.2312L2.3877 13.2581H1.49341L1.49609 13.2205C1.514 12.977 1.58561 12.7666 1.71094 12.5894C1.83805 12.4103 2.00903 12.2725 2.22388 12.1758C2.44051 12.0773 2.69206 12.0281 2.97852 12.0281C3.27393 12.0281 3.52995 12.0728 3.74658 12.1624C3.96322 12.2501 4.13062 12.3727 4.24878 12.5303C4.36694 12.6878 4.42603 12.8722 4.42603 13.0835V13.0889C4.42603 13.2518 4.38932 13.3941 4.31592 13.5159C4.2443 13.6358 4.14762 13.7343 4.02588 13.8113C3.90592 13.8883 3.77254 13.942 3.62573 13.9724V13.9912C3.91756 14.0199 4.14941 14.1121 4.32129 14.2678C4.49316 14.4236 4.5791 14.6295 4.5791 14.8855V14.8909C4.5791 15.1344 4.51375 15.3474 4.38306 15.53C4.25236 15.7109 4.06795 15.8505 3.82983 15.949C3.59172 16.0474 3.31063 16.0967 2.98657 16.0967Z"/>\n <path d="M1.54443 11V10.342L2.76099 9.20874C2.95076 9.03507 3.09757 8.89274 3.20142 8.78174C3.30705 8.66895 3.37956 8.57316 3.41895 8.49438C3.46012 8.41382 3.48071 8.33415 3.48071 8.25537V8.24463C3.48071 8.14795 3.46012 8.0638 3.41895 7.99219C3.37777 7.92057 3.31779 7.86507 3.23901 7.82568C3.16024 7.7863 3.06714 7.7666 2.95972 7.7666C2.84692 7.7666 2.74756 7.78988 2.66162 7.83643C2.57747 7.88298 2.51123 7.94743 2.46289 8.02979C2.41455 8.11035 2.39038 8.20345 2.39038 8.30908V8.33057L1.48804 8.32788V8.31177C1.48804 8.05396 1.5507 7.82837 1.67603 7.63501C1.80314 7.44165 1.97949 7.29126 2.20508 7.18384C2.43245 7.07463 2.69653 7.02002 2.99731 7.02002C3.28556 7.02002 3.53711 7.06836 3.75195 7.16504C3.96859 7.25993 4.13688 7.39331 4.25684 7.56519C4.37858 7.73706 4.43945 7.93758 4.43945 8.16675V8.18018C4.43945 8.3252 4.40902 8.46932 4.34814 8.61255C4.28727 8.75578 4.18701 8.90885 4.04736 9.07178C3.90771 9.23291 3.71883 9.41642 3.48071 9.62231L2.58374 10.4092L2.85498 9.98486V10.4092L2.58374 10.2319H4.49048V11H1.54443Z"/>\n <path d="M2.84155 6V3.01367H2.79053L1.85596 3.64478V2.79614L2.84155 2.12476H3.82715V6H2.84155Z"/>\n </svg>',gc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M13 13.5V6C13 4.067 11.433 2.5 9.5 2.5C7.567 2.5 6 4.067 6 6V13.5C6 14.6046 6.89543 15.5 8 15.5H8.23047C9.20759 15.5 10 14.7076 10 13.7305V7C10 6.72386 9.77614 6.5 9.5 6.5C9.22386 6.5 9 6.72386 9 7V12.5C9 13.0523 8.55228 13.5 8 13.5C7.44772 13.5 7 13.0523 7 12.5V7C7 5.61929 8.11929 4.5 9.5 4.5C10.8807 4.5 12 5.61929 12 7V13.7305C12 15.8122 10.3122 17.5 8.23047 17.5H8C5.79086 17.5 4 15.7091 4 13.5V6C4 2.96243 6.46243 0.5 9.5 0.5C12.5376 0.5 15 2.96243 15 6V13.5C15 14.0523 14.5523 14.5 14 14.5C13.4477 14.5 13 14.0523 13 13.5Z"/>\n </svg>',pc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M15 1C16.1046 1 17 1.89543 17 3V15C17 16.1046 16.1046 17 15 17H3C1.89543 17 1 16.1046 1 15V3C1 1.89543 1.89543 1 3 1H15ZM3 15H8V10H3V15ZM10 10V15H15V10H10ZM10 8H15V3H10V8ZM3 8H8V3H3V8Z"/>\n </svg>',fc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.75 12C13.1642 12 13.5 12.3358 13.5 12.75V14.25C13.5 14.6642 13.1642 15 12.75 15H5.25C4.83579 15 4.5 14.6642 4.5 14.25V12.75C4.5 12.3358 4.83579 12 5.25 12H12.75ZM15.4863 8C16.0461 8 16.5 8.44771 16.5 9C16.5 9.55229 16.0461 10 15.4863 10H2.51367C1.95392 10 1.5 9.55229 1.5 9C1.5 8.44771 1.95392 8 2.51367 8H15.4863ZM12.75 3C13.1642 3 13.5 3.33579 13.5 3.75V5.25C13.5 5.66421 13.1642 6 12.75 6H5.25C4.83579 6 4.5 5.66421 4.5 5.25V3.75C4.5 3.33579 4.83579 3 5.25 3H12.75Z"/>\n </svg>',mc='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.36612 5.36612C8.85427 4.87796 9.64554 4.87796 10.1337 5.36612C10.6218 5.85428 10.6218 6.64557 10.1337 7.13369L7.26748 9.9999H15.2499C18.1494 9.99996 20.4999 12.3504 20.4999 15.2499V19.2499C20.4999 19.9402 19.9402 20.4999 19.2499 20.4999C18.5596 20.4999 18 19.9402 17.9999 19.2499V15.2499C17.9999 13.7312 16.7686 12.5 15.2499 12.4999H7.26748L10.1337 15.3661C10.6218 15.8543 10.6218 16.6456 10.1337 17.1337C9.64557 17.6218 8.85428 17.6218 8.36612 17.1337L3.36612 12.1337C2.87796 11.6455 2.87796 10.8543 3.36612 10.3661L8.36612 5.36612Z"/>\n </svg>',yc='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M15.6338 5.1163C15.1456 4.62814 14.3543 4.62814 13.8662 5.1163C13.3781 5.60446 13.3781 6.39575 13.8662 6.88388L16.7324 9.75009H8.74997C5.85052 9.75014 3.49997 12.1006 3.49997 15.0001V19.0001C3.50002 19.6904 4.05969 20.25 4.74997 20.2501C5.4403 20.2501 5.99992 19.6904 5.99997 19.0001V15.0001C5.99997 13.4813 7.23123 12.2501 8.74997 12.2501H16.7324L13.8662 15.1163C13.3781 15.6045 13.3781 16.3958 13.8662 16.8839C14.3543 17.372 15.1456 17.3719 15.6338 16.8839L20.6338 11.8839C21.1219 11.3957 21.1219 10.6045 20.6338 10.1163L15.6338 5.1163Z" />\n </svg>',bc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M3 6.75C4.24264 6.75 5.25 7.75736 5.25 9C5.25 10.2426 4.24264 11.25 3 11.25C1.75736 11.25 0.75 10.2426 0.75 9C0.75 7.75736 1.75736 6.75 3 6.75ZM9 6.75C10.2426 6.75 11.25 7.75736 11.25 9C11.25 10.2426 10.2426 11.25 9 11.25C7.75736 11.25 6.75 10.2426 6.75 9C6.75 7.75736 7.75736 6.75 9 6.75ZM15 6.75C16.2426 6.75 17.25 7.75736 17.25 9C17.25 10.2426 16.2426 11.25 15 11.25C13.7574 11.25 12.75 10.2426 12.75 9C12.75 7.75736 13.7574 6.75 15 6.75Z"/>\n </svg>';class _c extends HTMLElement{static observedAttributes=["connected"];constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar",this.#c()}connectedCallback(){requestAnimationFrame((()=>this.#u())),this.setAttribute("role","toolbar"),this.#d()}disconnectedCallback(){this.#h(),this.#g(),this.#p()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#f()))}setEditor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.#m(),this.#y(),this.#b(),this.#_(),this.#x(),this.#C(),this.#u(),this.#S(),this.resolveEditorPromise(e),this.toggleAttribute("connected",!0)}async getEditorElement(){return this.editorElement||await this.editorPromise}#f(){this.disconnectedCallback(),this.connectedCallback()}#c(){this.editorPromise=new Promise((e=>{this.resolveEditorPromise=e}))}#d(){this.resizeObserver=new ResizeObserver((()=>this.#u())),this.resizeObserver.observe(this)}#h(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}#m(){this.addEventListener("click",this.#w.bind(this))}#w(e){this.#v(e,"[data-command]",this.#k.bind(this))}#v(e,t,n){const r=e.target.closest(t);r&&n(e,r)}#k(e,{dataset:{command:t,payload:n}}){const r=e instanceof PointerEvent&&-1===e.pointerId;this.editor.update((()=>{this.editor.dispatchCommand(t,n)}),{tag:r?Kr:void 0}),r||this.editor.focus()}#y(){this.editorElement.addEventListener("keydown",this.#E)}#g(){this.editorElement?.removeEventListener("keydown",this.#E)}#E=e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#T(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))};#T(e){const t=e.key.toLowerCase();return[...[e.ctrlKey?"ctrl":null,e.metaKey?"cmd":null,e.altKey?"alt":null,e.shiftKey?"shift":null].filter(Boolean),t].join("+")}#S(){this.editorElement.addEventListener("lexxy:focus",this.#N),this.editorElement.addEventListener("lexxy:blur",this.#A),this.addEventListener("keydown",this.#L)}#p(){this.editorElement.removeEventListener("lexxy:focus",this.#N),this.editorElement.removeEventListener("lexxy:blur",this.#A),this.removeEventListener("keydown",this.#L)}#N=()=>{this.#O[0].tabIndex=0};#A=()=>{this.#b(),this.#F()};#L=e=>{ec(this.#O,e)};#b(){this.#O.forEach((e=>{e.tabIndex=-1}))}#x(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#R(),this.#F()}))}))}#C(){this.editor.registerUpdateListener((()=>{this.#I()}))}#I(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#P("undo",0===e.undoStack.length),this.#P("redo",0===e.redoStack.length))}))}#R(){const e=$i();if(!wi(e))return;if(!e.anchor.getNode().getParent())return;const{isBold:t,isItalic:n,isStrikethrough:r,isHighlight:i,isInLink:o,isInQuote:s,isInHeading:l,isInCode:a,isInList:c,listType:u,isInTable:d}=this.selection.getFormat();this.#M("bold",t),this.#M("italic",n),this.#M("strikethrough",r),this.#M("highlight",i),this.#M("link",o),this.#M("quote",s),this.#M("heading",l),this.#M("code",a),this.#M("unordered-list",c&&"bullet"===u),this.#M("ordered-list",c&&"number"===u),this.#M("table",d),this.#I()}#M(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#P(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#D(){return this.scrollWidth-this.#B.clientWidth>this.clientWidth+1}#u=()=>{this.#z(),this.#$(),this.#B.style.display=this.#H.children.length?"block":"none",this.#B.setAttribute("nonce",Qa());const e=this.#H.children.length>0;this.toggleAttribute("overflowing",e),this.#H.toggleAttribute("disabled",!e)};#$(){const e=this.#K.reverse();let t=!1;for(const n of e){if(!this.#D()){t&&this.#H.prepend(n);break}this.#H.prepend(n),t=!0}}#z(){const e=Array.from(this.#H.children);e.sort(((e,t)=>this.#U(t)-this.#U(e))),e.forEach((e=>{const t=this.querySelector(`[data-position="${this.#U(e)+1}"]`)??this.#B;this.insertBefore(e,t)}))}#U(e){return parseInt(e.dataset.position??"999")}#_(){this.#W.forEach(((e,t)=>{void 0===e.dataset.position&&(e.dataset.position=t)}))}#F(){this.#V.forEach((e=>{e.open=!1}))}get#V(){return this.querySelectorAll("details")}get#B(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#H(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}get#K(){return Array.from(this.querySelectorAll(":scope > button"))}get#O(){return Array.from(this.querySelectorAll(":scope button, :scope > details > summary"))}get#W(){return Array.from(this.querySelectorAll(":scope > *:not(.lexxy-editor__toolbar-overflow)"))}static get defaultTemplate(){return`\n <button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">\n ${rc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">\n ${ic}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="strikethrough" data-command="strikethrough" title="Strikethrough">\n ${oc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="heading" data-command="rotateHeadingFormat" title="Heading">\n ${sc}\n </button>\n\n <details class="lexxy-editor__toolbar-dropdown" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="highlight" title="Color highlight">\n ${lc}\n </summary>\n <lexxy-highlight-dropdown class="lexxy-editor__toolbar-dropdown-content">\n <div class="lexxy-highlight-colors"></div>\n <button data-command="removeHighlight" class="lexxy-editor__toolbar-button lexxy-editor__toolbar-dropdown-reset">Remove all coloring</button>\n </lexxy-highlight-dropdown>\n </details>\n\n <details class="lexxy-editor__toolbar-dropdown" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="link" title="Link" data-hotkey="cmd+k ctrl+k">\n ${ac}\n </summary>\n <lexxy-link-dropdown class="lexxy-editor__toolbar-dropdown-content">\n <form method="dialog">\n <input type="url" placeholder="Enter a URL…" class="input">\n <div class="lexxy-editor__toolbar-dropdown-actions">\n <button type="submit" class="lexxy-editor__toolbar-button" value="link">Link</button>\n <button type="button" class="lexxy-editor__toolbar-button" value="unlink">Unlink</button>\n </div>\n </form>\n </lexxy-link-dropdown>\n </details>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="quote" data-command="insertQuoteBlock" title="Quote">\n ${cc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="code" data-command="insertCodeBlock" title="Code">\n ${uc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">\n ${dc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">\n ${hc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="upload" data-command="uploadAttachments" title="Upload file">\n ${gc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">\n ${pc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="divider" data-command="insertHorizontalDivider" title="Insert a divider">\n ${fc}\n </button>\n \n <div class="lexxy-editor__toolbar-spacer" role="separator"></div>\n \n <button class="lexxy-editor__toolbar-button" type="button" name="undo" data-command="undo" title="Undo">\n ${mc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo">\n ${yc}\n </button>\n\n <details class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-overflow" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" aria-label="Show more toolbar buttons">${bc}</summary>\n <div class="lexxy-editor__toolbar-dropdown-content lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons"></div>\n </details>\n `}}function xc(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Cc="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Sc=Cc&&"documentMode"in document?document.documentMode:null;function wc(e,t){return Array.from(function(e){return function(e,t){const n=Ss(),r=t||n,i=Eo(r)?Ul(r,e):zl(r,e),o=function(e){let t=-1;for(let n=e;null!==n;n=n.getParent())t++;return t}(r),s=function(e,t){const n=fa(zl(e,t));return n&&n[0]}(r,e);let l=o;return Jl({hasNext:e=>null!==e,initial:i,map:e=>({depth:l,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;Pl(e)&&l++;const t=fa(e);return!t||t[0].isSameNodeCaret(s)?null:(l+=t[1],t[0])}})}("next",e)}(e))}function vc(e){return e?e.getAdjacentCaret():null}function kc(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function Ec(e){const t=$i()||Hi();let n;if(wi(t))n=na(t.focus,"next");else{if(null!=t){const e=t.getNodes(),r=e[e.length-1];r&&(n=zl(r,"next"))}n=n||Ul(Ss(),"previous").getFlipped().insert(zo())}const r=function(e,t,n){let r=ga(t,"next");for(let e=r;e;e=ba(e,n))r=e;return Rl(r)&&xc(283),r.insert(e.isInline()?zo().append(e):e),ga(zl(e.getLatest(),"next"),t.direction)}(e,n),i=Wl(r);return ia(Zl(Pl(i)?da(i):r)),e.getLatest()}function Tc(e,t){const n=t();return e.replace(n),n.append(e),n}function Nc(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Ac(e){const t=$i();if(!wi(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){const i=r[t],o=i.getKey();if(n.has(o))continue;const s=vl(i,(e=>Eo(e)&&!e.isInline()));if(null===s)continue;const l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function Lc(e,t){Ul(e,"next").insert(t)}function Oc(e,t){return Fc(e,t,null)}function Fc(e,t,n){let r=!1;for(const i of Pc(e))t(i)?null!==n&&n(i):(r=!0,Eo(i)&&Fc(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function Rc(e,t){const n=[],r=Array.from(e).reverse();for(let e=r.pop();void 0!==e;e=r.pop())if(t(e))n.push(e);else if(Eo(e))for(const t of Pc(e))r.push(t);return n}function Ic(e){return Mc(Ul(e,"next"))}function Pc(e){return Mc(Ul(e,"previous"))}function Mc(e){return Jl({hasNext:Il,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}Cc&&"InputEvent"in window&&!Sc&&new window.InputEvent("input");const Dc=Symbol.for("preact-signals");function Bc(){if(Kc>1)return void Kc--;let e,t=!1;for(;void 0!==$c;){let n=$c;for($c=void 0,Uc++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Zc(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(Uc=0,Kc--,t)throw e}let zc,$c;function Hc(e){const t=zc;zc=void 0;try{return e()}finally{zc=t}}let Kc=0,Uc=0,Wc=0;function Vc(e){if(void 0===zc)return;let t=e.n;return void 0===t||t.t!==zc?(t={i:0,S:e,p:zc.s,n:void 0,t:zc,e:void 0,x:void 0,r:t},void 0!==zc.s&&(zc.s.n=t),zc.s=t,e.n=t,32&zc.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=zc.s,t.n=void 0,zc.s.n=t,zc.s=t),t):void 0}function jc(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function qc(e,t){return new jc(e,t)}function Zc(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Gc(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Jc(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function Yc(e,t){jc.call(this,void 0),this.x=e,this.s=void 0,this.g=Wc-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Xc(e){const t=e.u;if(e.u=void 0,"function"==typeof t){Kc++;const n=zc;zc=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Qc(e),t}finally{zc=n,Bc()}}}function Qc(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Xc(e)}function eu(e){if(zc!==this)throw new Error("Out-of-order effect");Jc(this),zc=e,this.f&=-2,8&this.f&&Qc(this),Bc()}function tu(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function nu(e,t){const n=new tu(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function ru(e,t={}){const n={};for(const r in e){const i=t[r],o=qc(void 0===i?e[r]:i);n[r]=o}return n}function iu(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}function ou(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function su(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,r=t;for(const e in r)n[e]=su(n[e],r[e]);return e}return t}jc.prototype.brand=Dc,jc.prototype.h=function(){return!0},jc.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Hc((()=>{var e;null==(e=this.W)||e.call(this)})))},jc.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Hc((()=>{var e;null==(e=this.Z)||e.call(this)})))}},jc.prototype.subscribe=function(e){return nu((()=>{const t=this.value,n=zc;zc=void 0;try{e(t)}finally{zc=n}}),{name:"sub"})},jc.prototype.valueOf=function(){return this.value},jc.prototype.toString=function(){return this.value+""},jc.prototype.toJSON=function(){return this.value},jc.prototype.peek=function(){const e=zc;zc=void 0;try{return this.value}finally{zc=e}},Object.defineProperty(jc.prototype,"value",{get(){const e=Vc(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Uc>100)throw new Error("Cycle detected");this.v=e,this.i++,Wc++,Kc++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{Bc()}}}}),Yc.prototype=new jc,Yc.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Wc)return!0;if(this.g=Wc,this.f|=1,this.i>0&&!Zc(this))return this.f&=-2,!0;const e=zc;try{Gc(this),zc=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return zc=e,Jc(this),this.f&=-2,!0},Yc.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}jc.prototype.S.call(this,e)},Yc.prototype.U=function(e){if(void 0!==this.t&&(jc.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},Yc.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Yc.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=Vc(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),tu.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.u=e)}finally{e()}},tu.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Xc(this),Gc(this),Kc++;const e=zc;return zc=this,eu.bind(this,e)},tu.prototype.N=function(){2&this.f||(this.f|=2,this.o=$c,$c=this)},tu.prototype.d=function(){this.f|=8,1&this.f||Qc(this)},tu.prototype.dispose=function(){this.d()},lt("format",{parse:e=>"number"==typeof e?e:0});function lu(e){return 0===e.id}function au(e){return 2===e.id}const cu=new Set;let uu=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):_a;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;au(t)||ou(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n);let o;this.state=i,this.extension.init&&(o=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,o,r)}build(e){const t=this.state;let n;4!==t.id&&ou(307,String(t.id),String(5)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;const n=this.state;5!==n.id&&ou(308,String(n.id),String(5));const r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{const e=this.state;7!==e.id&&ou(309,String(n.id),String(7)),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){const t=this.state;let n;return 6!==t.id&&ou(310,String(t.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return void 0===this._signal&&ou(311),this._signal}getInitResult(){void 0===this.extension.init&&ou(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||ou(313,String(e.id),String(4)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=3}(e)||ou(314,String(e.id),String(3)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&ou(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&ou(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||ou(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||cu}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map((([e])=>e))),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=5})(e)||ou(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const du={tag:Br};function hu(){const e=Ss();e.isEmpty()&&e.append(zo())}const gu={config:{setOptions:du,updateOptions:du},init:({$initialEditorState:e=hu})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const i=r.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:r}=i;if(function(e){return e instanceof Po}(r))e.setEditorState(r,n);else if("function"==typeof r)e.update((()=>{r(e)}),t);else if(r&&("string"==typeof r||"object"==typeof r)){const t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Lo,ri,jr,fi,Do]},pu=Symbol.for("@lexical/extension/LexicalBuilder");function fu(){}function mu(e){throw e}function yu(e){return Array.isArray(e)?e:[e]}const bu="0.41.0+prod.esm";let _u=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=bu,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(t){const n=[yu(gu)];for(const e of t)n.push(yu(e));return new e(n)}static maybeFromEditor(t){const n=t[pu];return n&&(n.PACKAGE_VERSION!==bu&&ou(292,n.PACKAGE_VERSION,bu),n instanceof e||ou(293)),n}static fromEditor(t){const n=e.maybeFromEditor(t);return void 0===n&&ou(294),n}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(Uo({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[pu]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=fu;function t(){try{e()}finally{e=fu}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=wa(this.registerEditor(n),(()=>n.setRootElement(null))),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&ou(295,e.name),t}addEdge(e,t,n){const r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&ou(296);const t=yu(e),[n]=t;"string"!=typeof n.name&&ou(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&ou(298,n.name),!r){r=new uu(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&ou(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&ou(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=yu(e);this.addEdge(n.name,t[0].name,t.slice(1)),this.addExtension(t)}for(const[e,t]of n.peerDependencies||[])this.addEdge(n.name,e,t?[t]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,r)=>{let i=n.state;if(au(i))return;const o=n.extension.name;var s;lu(i)||ou(300,o,r||"[unknown]"),lu(s=i)||ou(304,String(s.id),String(0)),i=Object.assign(s,{id:1}),n.state=i;const l=this.outgoingConfigEdges.get(o);if(l)for(const e of l.keys()){const n=this.extensionNameMap.get(e);n&&t(n,o)}i=function(e){return function(e){return 1===e.id}(e)||ou(305,String(e.id),String(1)),Object.assign(e,{id:2})}(i),n.state=i,e.push(n)};for(const e of this.extensionNameMap.values())lu(e.state)&&t(e);for(const t of e)for(const[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){const t=this.extensionNameMap.get(e);if(t)for(const e of n)t.configs.add(e)}for(const[e,...t]of this.roots)if(t.length>0){const n=this.extensionNameMap.get(e.name);void 0===n&&ou(301,e.name);for(const e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(const n of t){const t=n.register(e,i);t&&r.push(t)}for(const n of t){const t=n.afterRegistration(e);t&&r.push(t)}return wa(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,i={},o={},s=this.sortedExtensionReps();for(const l of s){const{extension:s}=l;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of iu(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&ou(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,l)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&su(o,s.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);const l=Object.keys(i).length>0,a=r.size>0;(l||a)&&(e.html={},l&&(e.html.import=i),a&&(e.html.export=r));for(const t of s)t.init(e);return e.onError||(e.onError=mu),e}};function xu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Cu(e){let t=1,n=e.getParent();for(;null!=n;){if(Bu(n)){const e=n.getParent();if(Vu(e)){t++,n=e.getParent();continue}xu(40)}return t}return t}function Su(e){let t=e.getParent();Vu(t)||xu(40);let n=t;for(;null!==n;)n=n.getParent(),Vu(n)&&(t=n);return t}function wu(e){let t=[];const n=e.getChildren().filter(Bu);for(let e=0;e<n.length;e++){const r=n[e],i=r.getFirstChild();Vu(i)?t=t.concat(wu(i)):t.push(r)}return t}function vu(e){return Bu(e)&&Vu(e.getFirstChild())}function ku(e){return Du().append(e)}function Eu(e,t){return Bu(e)&&(0===t.length||1===t.length&&e.is(t[0])&&0===e.getChildrenSize())}function Tu(e){const t=$i();if(null!==t){let n=t.getNodes();if(wi(t)){const r=t.getStartEndPoints();null===r&&xu(143);const[i]=r,o=i.getNode(),s=o.getParent();if(tl(o)){const e=o.getFirstChild();if(e)n=e.selectStart().getNodes();else{const e=zo();o.append(e),n=e.select().getNodes()}}else if(Eu(o,n)){const t=Wu(e);if(tl(s)){o.replace(t);const e=Du();Eo(o)&&(e.setFormat(o.getFormatType()),e.setIndent(o.getIndent())),t.append(e)}else if(Bu(o)){const e=o.getParentOrThrow();Nu(t,e.getChildren()),e.replace(t)}return}}const r=new Set;for(let t=0;t<n.length;t++){const i=n[t];if(Eo(i)&&i.isEmpty()&&!Bu(i)&&!r.has(i.getKey())){Au(i,e);continue}let o=us(i)?i.getParent():Bu(i)&&i.isEmpty()?i:null;for(;null!=o;){const t=o.getKey();if(Vu(o)){if(!r.has(t)){const n=Wu(e);Nu(n,o.getChildren()),o.replace(n),r.add(t)}break}{const n=o.getParent();if(tl(n)&&!r.has(t)){r.add(t),Au(o,e);break}o=n}}}}}function Nu(e,t){e.splice(e.getChildrenSize(),0,t)}function Au(e,t){if(Vu(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),i=Du();let o;if(Nu(i,e.getChildren()),Vu(n)&&t===n.getListType())n.append(i),Vu(r)&&t===r.getListType()&&(Nu(n,r.getChildren()),r.remove()),o=n;else if(Vu(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),o=r;else{const n=Wu(t);n.append(i),e.replace(n),o=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());const s=$i();return wi(s)&&(o.getKey()===s.anchor.key&&s.anchor.set(i.getKey(),s.anchor.offset,"element"),o.getKey()===s.focus.key&&s.focus.set(i.getKey(),s.focus.offset,"element")),e.remove(),o}function Lu(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&vu(n)&&vu(r)&&(Lu(n.getFirstChild(),r.getFirstChild()),r.remove());const i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function Ou(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())Bu(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),Vu(r.getFirstChild())||n++)}function Fu(e){const t=new Set;if(vu(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(vu(r)&&vu(i)){const n=i.getFirstChild();if(Vu(n)){n.append(e);const i=r.getFirstChild();Vu(i)&&(Nu(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(vu(r)){const t=r.getFirstChild();if(Vu(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(vu(i)){const t=i.getFirstChild();Vu(t)&&t.append(e)}else if(Vu(n)){const t=Du().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),o=Wu(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());t.append(o),o.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Ru(e){if(vu(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(Vu(n?n.getParent():void 0)&&Bu(n)&&Vu(t)){const r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{const r=t.getListType(),i=Du(),o=Wu(r);i.append(o),e.getPreviousSiblings().forEach((e=>o.append(e)));const s=Du(),l=Wu(r);s.append(l),Nu(l,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(s),n.replace(e)}}}let Iu=class extends ko{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(null==e.__checked)return;const t=e.getParent();Vu(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)},extends:ko,importDOM:{li:()=>({conversion:Pu,priority:0})}})}constructor(e=1,t=void 0,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){!function(e,t,n){const r=t.getParent();!Vu(r)||"check"!==r.getListType()||Vu(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}(t,this,e),t.value=this.__value,function(e,t,n){const r=[],i=[],o=t.list,s=o?o.listitem:void 0;let l;if(o&&o.nested&&(l=o.nested.listitem),void 0!==s&&r.push(...xa(s)),o){const e=n.getParent(),t=Vu(e)&&"check"===e.getListType(),s=n.getChecked();t&&!s||i.push(o.listitemUnchecked),t&&s||i.push(o.listitemChecked),t&&r.push(s?o.listitemChecked:o.listitemUnchecked)}if(void 0!==l){const e=xa(l);n.getChildren().some((e=>Vu(e)))?r.push(...e):i.push(...e)}i.length>0&&Sa(e,...i),r.length>0&&Ca(e,...r)}(t,n.theme,this);const r=e?e.__style:"",i=this.__style;r!==i&&(""===i?t.removeAttribute("style"):t.style.cssText=i),function(e,t,n){const r=Ta(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in Ta(n.__textStyle))t in r||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){const r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);const r=this.getDirection();return r&&(t.dir=r),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const n=e[t];if(Eo(n)&&this.canMergeWith(n)){const e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(Bu(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!Vu(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const t=Wu(n.getListType());let r=this.getNextSibling();for(;r;){const e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}return t&&(Eo(e)||xu(139),this.getChildren().forEach((t=>{e.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(Vu(n)||xu(39),Bu(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=Wu(n.getListType());r.forEach((e=>i.append(e))),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&vu(t)&&vu(n)&&(Lu(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=Du().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=zo();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=Bu(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,o=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(o,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(o,i.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return Vu(n)&&(t=n.getListType()),"check"===t?Boolean(e.__checked):void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(null===e||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Bu(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&xu(117),(e=Math.floor(e))>=0||xu(199);let t=this.getIndent();for(;t!==e;)t<e?(Fu(this),t++):(Ru(this),t--);return this}canInsertAfter(e){return Bu(e)}canReplaceWith(e){return Bu(e)}canMergeWith(e){return Bu(e)||$o(e)}extractWithChild(e,t){if(!wi(t))return!1;const n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Wu("bullet")}canMergeWhenEmpty(){return!0}};function Pu(e){if(e.classList.contains("task-list-item"))for(const t of e.children)if("INPUT"===t.tagName)return Mu(t);if(e.classList.contains("joplin-checkbox"))for(const t of e.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&"INPUT"===t.children[0].tagName)return Mu(t.children[0]);const t=e.getAttribute("aria-checked");return{node:Du("true"===t||"false"!==t&&void 0)}}function Mu(e){return"checkbox"!==e.getAttribute("type")?{node:null}:{node:Du(e.hasAttribute("checked"))}}function Du(e){return rl(new Iu(void 0,e))}function Bu(e){return e instanceof Iu}let zu=class extends ko{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{!function(e){const t=e.getNextSibling();Vu(t)&&e.getListType()===t.getListType()&&Lu(e,t)}(e),Ou(e)},extends:ko,importDOM:{ol:()=>({conversion:Ku,priority:0}),ul:()=>({conversion:Ku,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=Uu[e]||e;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag="number"===e?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,$u(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||($u(t,n.theme,this),e.__start!==this.__start&&t.setAttribute("start",String(this.__start)),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return cl(t)&&(1!==this.__start&&t.setAttribute("start",String(this.__start)),"check"===this.__listType&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e<n.length;e++){const t=n[e];Bu(t)||(r===n&&(r=[...n]),r[e]=Du().append(!Eo(t)||Vu(t)||t.isInline()?t:hi(t.getTextContent())))}return super.splice(e,t,r)}extractWithChild(e){return Bu(e)}};function $u(e,t,n){const r=[],i=[],o=t.list;if(void 0!==o){const e=o[`${n.__tag}Depth`]||[],t=Cu(n)-1,s=t%e.length,l=e[s],a=o[n.__tag];let c;const u=o.nested,d=o.checklist;if(void 0!==u&&u.list&&(c=u.list),void 0!==a&&r.push(a),void 0!==d&&"check"===n.__listType&&r.push(d),void 0!==l){r.push(...xa(l));for(let t=0;t<e.length;t++)t!==s&&i.push(n.__tag+t)}if(void 0!==c){const e=xa(c);t>1?r.push(...e):i.push(...e)}}i.length>0&&Sa(e,...i),r.length>0&&Ca(e,...r)}function Hu(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(Bu(r)){t.push(r);const e=r.getChildren();e.length>1&&e.forEach((e=>{Vu(e)&&t.push(ku(e))}))}else t.push(ku(r))}return t}function Ku(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=Wu("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list")||"1"===e.getAttribute("data-is-checklist"))return!0;for(const t of e.childNodes)if(cl(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?Wu("check"):Wu("bullet")),{after:Hu,node:n}}const Uu={ol:"number",ul:"bullet"};function Wu(e="number",t=1){return rl(new zu(e,t))}function Vu(e){return e instanceof zu}const ju=nn("UPDATE_LIST_START_COMMAND"),qu=nn("INSERT_UNORDERED_LIST_COMMAND"),Zu=nn("INSERT_ORDERED_LIST_COMMAND"),Gu=nn("REMOVE_LIST_COMMAND");function Ju(e,t){return wa(e.registerCommand(Zu,(()=>(Tu("number"),!0)),1),e.registerCommand(ju,(e=>{const{listNodeKey:t,newStart:n}=e,r=ms(t);return!!Vu(r)&&("number"===r.getListType()&&(r.setStart(n),Ou(r)),!0)}),1),e.registerCommand(qu,(()=>(Tu("bullet"),!0)),1),e.registerCommand(Gu,(()=>(function(){const e=$i();if(wi(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Eu(r,n))t.add(Su(r));else for(let e=0;e<n.length;e++){const r=n[e];if(us(r)){const e=kc(r,Iu);null!=e&&t.add(Su(e))}}for(const n of t){let t=n;const r=wu(n);for(const n of r){const r=zo().setTextStyle(e.style).setTextFormat(e.format);Nu(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&ra(e.anchor,da(Ul(r,"next"))),n.__key===e.focus.key&&ra(e.focus,da(Ul(r,"next"))),n.remove()}n.remove()}}}(),!0)),1),e.registerCommand(gn,(()=>function(e=!1){const t=$i();if(!wi(t)||!t.isCollapsed())return!1;const n=t.anchor.getNode();let r=null;if(Bu(n)&&0===n.getChildrenSize())r=n;else if(gi(n)){const e=n.getParent();Bu(e)&&e.getChildren().every((e=>gi(e)&&""===e.getTextContent().trim()))&&(r=e)}if(null===r)return!1;const i=Su(r),o=r.getParent();Vu(o)||xu(40);const s=o.getParent();let l;if(tl(s))l=zo(),i.insertAfter(l);else{if(!Bu(s))return!1;l=Du(),s.insertAfter(l)}l.setTextStyle(t.style).setTextFormat(t.format).select();const a=r.getNextSiblings();if(a.length>0){const t=e?function(e,t){return e.getStart()+t.getIndexWithinParent()}(o,r):1,n=Wu(o.getListType(),t);if(Bu(l)){const e=Du();e.append(n),l.insertAfter(e)}else l.insertAfter(n);n.append(...a)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!Bu(e)&&!Vu(e))break;t=e}t.remove()}(r),!0}(!1)),1),e.registerNodeTransform(Iu,(e=>{const t=e.getFirstChild();if(t){if(gi(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=$i();wi(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}})),e.registerNodeTransform(ri,(e=>{const t=e.getParent();if(Bu(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}const Yu=new Set(["http:","https:","mailto:","sms:","tel:"]);let Xu=class e extends ko{__url;__target;__rel;__title;static getType(){return"link"}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e="",t={},n){super(n);const{target:r=null,rel:i=null,title:o=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=o}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),Ca(t,e.theme.link),t}updateLinkDOM(e,t,n){if(al(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const n of["target","rel","title"]){const r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:Qu,priority:1})}}static importJSON(e){return ed().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=ad(e);try{const t=new URL(ad(e));if(!Yu.has(t.protocol))return"about:blank"}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const n=ed(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!wi(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function Qu(e){let t=null;if(al(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=ed(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function ed(e="",t){return rl(new Xu(e,t))}function td(e){return e instanceof Xu}let nd=class e extends Xu{__isUnlinked;constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}static getType(){return"autolink"}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return rd().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=rd(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function rd(e="",t){return rl(new nd(e,t))}function id(e){return e instanceof nd}function od(e,t){if("element"===e.type){const n=e.getNode();return Eo(n)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function sd(e,t={}){let n;if(e&&"object"==typeof e){const{url:r,...i}=e;n=r,t={...i,...t}}else n=e;const{target:r,title:i}=t,o=void 0===t.rel?"noreferrer":t.rel,s=$i();if(null===s||!wi(s)&&!ki(s))return;if(ki(s)){const e=s.getNodes();if(0===e.length)return;return void e.forEach((e=>{if(null===n){const t=vl(e,(e=>!id(e)&&td(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=vl(e,(e=>!id(e)&&td(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==o&&t.setRel(o);else{const t=ed(n,{rel:o,target:r});e.insertBefore(t),t.append(e)}}}))}if(s.isCollapsed()&&null===n)for(const e of s.getNodes()){const t=vl(e,(e=>!id(e)&&td(e)));return void(null!==t&&(t.getChildren().forEach((e=>{t.insertBefore(e)})),t.remove()))}const l=s.extract();if(null===n){const e=new Set;return void l.forEach((t=>{const n=vl(t,(e=>!id(e)&&td(e)));if(null!==n){const t=n.getKey();if(e.has(t))return;!function(e,t){const n=new Set(t.filter((t=>e.isParentOf(t))).map((e=>e.getKey()))),r=e.getChildren(),i=r=>n.has(r.getKey())||Eo(r)&&t.some((t=>e.isParentOf(t)&&r.isParentOf(t))),o=r.filter(i);if(o.length===r.length)return r.forEach((t=>e.insertBefore(t))),void e.remove();const s=r.findIndex(i),l=r.findLastIndex(i),a=0===s,c=l===r.length-1;if(a)o.forEach((t=>e.insertBefore(t)));else if(c)for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);else{for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);const t=r.slice(l+1);if(t.length>0){const n=ed(e.getURL(),{rel:e.getRel(),target:e.getTarget(),title:e.getTitle()});o[o.length-1].insertAfter(n),t.forEach((e=>n.append(e)))}}}(n,l),e.add(t)}}))}const a=new Set,c=e=>{a.has(e.getKey())||(a.add(e.getKey()),e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==o&&e.setRel(o),void 0!==i&&e.setTitle(i))};if(1===l.length){const e=l[0],t=vl(e,td);if(null!==t)return c(t)}!function(e){const t=$i();if(!wi(t))return e();const n=St(t),r=n.isBackward(),i=od(n.anchor,r?-1:0),o=od(n.focus,r?0:-1);if(e(),i||o){const e=$i();if(wi(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(o){const e=o.getParent();e&&t.focus.set(e.getKey(),o.getIndexWithinParent()+(r?0:1),"element")}vs(St(t))}}}((()=>{let e=null;for(const t of l){if(!t.isAttached())continue;const s=vl(t,td);if(s){c(s);continue}if(Eo(t)){if(!t.isInline())continue;if(td(t)){if(!(id(t)||null!==e&&e.getParentOrThrow().isParentOf(t))){c(t),e=t;continue}for(const e of t.getChildren())t.insertBefore(e);t.remove();continue}}const l=t.getPreviousSibling();td(l)&&l.is(e)?l.append(t):(e=ed(n,{rel:o,target:r,title:i}),t.insertAfter(e),e.append(t))}}))}const ld=/^\+?[0-9\s()-]{5,}$/;function ad(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:ld.test(e)?`tel:${e}`:`https://${e}`}function cd(e,t){const n=ls(t)?t.body.childNodes:t.childNodes;let r=[];const i=[];for(const t of n)if(!hd.has(t.nodeName)){const n=gd(t,e,i,!1);null!==n&&(r=r.concat(n))}return function(e){for(const t of e)t.getNextSibling()instanceof Mo&&t.insertAfter(Zr());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(i),r}function ud(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),r=Ss().getChildren();for(let i=0;i<r.length;i++)dd(e,r[i],n,t);return n.innerHTML}function dd(e,t,n,r=null){let i=null===r||t.isSelected(r);const o=Eo(t)&&t.excludeFromCopy("html");let s=t;null!==r&&gi(t)&&(s=Fa(r,t,"clone"));const l=Eo(s)?s.getChildren():[],a=Go(e,s.getType());let c;c=a&&void 0!==a.exportDOM?a.exportDOM(e,s):s.exportDOM(e);const{element:u,after:d}=c;if(!u)return!1;const h=document.createDocumentFragment();for(let n=0;n<l.length;n++){const o=l[n],s=dd(e,o,h,r);!i&&Eo(t)&&s&&t.extractWithChild(o,r,"html")&&(i=!0)}if(i&&!o){if((cl(u)||dl(u))&&u.append(h),n.append(u),d){const e=d.call(s,u);e&&(dl(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(h);return i}const hd=new Set(["STYLE","SCRIPT"]);function gd(e,t,n,r,i=new Map,o){let s=[];if(hd.has(e.nodeName))return s;let l=null;const a=function(e,t){const{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase());let i=null;if(void 0!==r)for(const t of r){const n=t(e);null!==n&&(null===i||(i.priority||0)<=(n.priority||0))&&(i=n)}return null!==i?i.conversion:null}(e,t),c=a?a(e):null;let u=null;if(null!==c){u=c.after;const t=c.node;if(l=Array.isArray(t)?t[t.length-1]:t,null!==l){for(const[,e]of i)if(l=e(l,o),!l)break;l&&s.push(...Array.isArray(t)?t:[l])}null!=c.forChild&&i.set(e.nodeName,c.forChild)}const d=e.childNodes;let h=[];const g=(null==l||!tl(l))&&(null!=l&&Pi(l)||r);for(let e=0;e<d.length;e++)h.push(...gd(d[e],t,n,g,new Map(i),l));return null!=u&&(h=u(h)),gl(e)&&(h=function(e,t,n){const r=e.style.textAlign,i=[];let o=[];for(let e=0;e<t.length;e++){const s=t[e];if(Pi(s))r&&!s.getFormat()&&s.setFormat(r),i.push(s);else if(o.push(s),e===t.length-1||e<t.length-1&&Pi(t[e+1])){const e=n();e.setFormat(r),e.append(...o),i.push(e),o=[]}}return i}(e,h,g?()=>{const e=new Mo;return n.push(e),e}:zo)),null==l?h.length>0?s=s.concat(h):gl(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(hl(e.nextSibling)&&hl(e.previousSibling))}(e)&&(s=s.concat(Zr())):Eo(l)&&l.append(...h),s}function pd(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function fd(e,t=$i()){return null==t&&pd(166),wi(t)&&t.isCollapsed()||0===t.getNodes().length?"":ud(e,t)}function md(e,t){const n=e.getData("text/plain")||e.getData("text/uri-list");null!=n&&t.insertRawText(n)}function yd(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return bd(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=fo(e[n]);gi(r)&&Ra(r),t.push(r)}return t}(e.nodes),t)}catch(e){console.error(e)}const i=e.getData("text/html"),o=e.getData("text/plain");if(i&&o!==i)try{return bd(n,cd(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(i),"text/html")),t)}catch(e){console.error(e)}const s=o||e.getData("text/uri-list");if(null!=s)if(wi(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=$i();if(wi(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([mi()]):n.insertText(r)}}}else t.insertRawText(s)}function bd(e,t,n){e.dispatchCommand(on,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(wi(e)&&e.isCollapsed()){let t=null;const n=na(e.anchor,"previous");if(n)if(Rl(n))t=n.origin;else{const e=Gl(n,Ul(Ss(),"next").getFlipped());for(const n of e){if(gi(n.origin)){t=n.origin;break}if(Eo(n.origin)&&!n.origin.isInline())break}}if(t&&gi(t)){const n=t.getFormat(),r=t.getStyle();e.format===n&&e.style===r||(e.format=n,e.style=r,e.dirty=!0)}}}(n))}function _d(e,t,n,r=[]){let i=null===t||n.isSelected(t);const o=Eo(n)&&n.excludeFromCopy("html");let s=n;null!==t&&gi(s)&&(s=Fa(t,s,"clone"));const l=Eo(s)?s.getChildren():[],a=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&pd(58,n.name),Eo(e)){const e=t.children;Array.isArray(e)||pd(59,n.name)}return t}(s);gi(s)&&0===s.getTextContentSize()&&(i=!1);for(let r=0;r<l.length;r++){const o=l[r],s=_d(e,t,o,a.children);!i&&Eo(n)&&s&&n.extractWithChild(o,t,"clone")&&(i=!0)}if(i&&!o)r.push(a);else if(Array.isArray(a.children))for(let e=0;e<a.children.length;e++){const t=a.children[e];r.push(t)}return i}let xd=null;async function Cd(e,t,n){if(null!==xd)return!1;if(null!==t)return new Promise(((r,i)=>{e.update((()=>{r(Sd(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,o=i.document,s=ll(i);if(null===r||null===s)return!1;const l=o.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(o.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise(((t,r)=>{const s=e.registerCommand(Un,(r=>(Nc(r,ClipboardEvent)&&(s(),null!==xd&&(i.clearTimeout(xd),xd=null),t(Sd(e,r,n))),!0)),4);xd=i.setTimeout((()=>{s(),xd=null,t(!1)}),50),o.execCommand("copy"),l.remove()}))}function Sd(e,t,n){if(void 0===n){const t=ll(e._window),r=$i();if(!r||r.isCollapsed())return!1;if(!t)return!1;const i=t.anchorNode,o=t.focusNode;if(null!==i&&null!==o&&!Qo(e,i,o))return!1;n=vd(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of wd)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const wd=[["text/html",fd],["application/x-lexical-editor",function(e,t=$i()){return null==t&&pd(166),wi(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=Ss().getChildren();for(let i=0;i<r.length;i++)_d(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function vd(e=$i()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=fl();for(const[r,i]of wd){const o=i(n,e);null!==o&&(t[r]=o)}}return t}const kd={build:(e,t,n)=>ru(t),config:{disabled:"undefined"==typeof window},name:"@lexical/dragon",register:(e,t,n)=>nu((()=>n.getOutput().disabled.value?void 0:function(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const r=e.getRootElement();if(document.activeElement!==r)return;const i=n.data;if("string"==typeof i){let t;try{t=JSON.parse(i)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const r=t.payload;if(r&&"makeChanges"===r.functionId){const t=r.args;if(t){const[r,i,o,s,l]=t;e.update((()=>{const e=$i();if(wi(e)){const t=e.anchor;let a=t.getNode(),c=0,u=0;if(gi(a)&&r>=0&&i>=0&&(c=r,u=r+i,e.setTextNodeRange(a,c,a,u)),c===u&&""===o||(e.insertRawText(o),a=t.getNode()),gi(a)){c=s,u=s+l;const t=a.getTextContentSize();c=c>t?t:c,u=u>t?t:u,e.setTextNodeRange(a,c,a,u)}n.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}(e)))},Ed="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Td=Ed&&"documentMode"in document?document.documentMode:null,Nd=Ed&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ad=!(!Ed||!("InputEvent"in window)||Td)&&"getTargetRanges"in new window.InputEvent("input"),Ld=Ed&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Od=Ed&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Fd=Ed&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Rd=Ed&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Nd&&!Fd;function Id(e,t){t.update((()=>{if(null!==e){const n=Nc(e,KeyboardEvent)?null:e.clipboardData,r=$i();if(null!==r&&!r.isCollapsed()&&null!=n){e.preventDefault();const i=fd(t);null!==i&&n.setData("text/html",i),n.setData("text/plain",r.getTextContent())}}}))}function Pd(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const Md="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Dd=Md&&"documentMode"in document?document.documentMode:null,Bd=Md&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),zd=!(!Md||!("InputEvent"in window)||Dd)&&"getTargetRanges"in new window.InputEvent("input"),$d=Md&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Hd=Md&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Kd=Md&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ud=Md&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Bd&&!Kd,Wd=nn("DRAG_DROP_PASTE_FILE");let Vd=class e extends ko{static getType(){return"quote"}static clone(t){return new e(t.__key)}createDOM(e){const t=document.createElement("blockquote");return Ca(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Yd,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(cl(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return jd().updateFromJSON(e)}insertNewAfter(e,t){const n=zo(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=zo();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function jd(){return rl(new Vd)}function qd(e){return e instanceof Vd}let Zd=class e extends ko{__tag;static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){Ca(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Jd,priority:0}),h2:e=>({conversion:Jd,priority:0}),h3:e=>({conversion:Jd,priority:0}),h4:e=>({conversion:Jd,priority:0}),h5:e=>({conversion:Jd,priority:0}),h6:e=>({conversion:Jd,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Gd(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Gd(e)?{conversion:e=>({node:Xd("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(cl(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Xd(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?zo():Xd(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=zo();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?zo():Xd(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function Gd(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Jd(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=Xd(t),null!==e.style&&(xl(e,n),n.setFormat(e.style.textAlign))),{node:n}}function Yd(e){const t=jd();return null!==e.style&&(t.setFormat(e.style.textAlign),xl(e,t)),{node:t}}function Xd(e="h1"){return rl(new Zd(e))}function Qd(e){return e instanceof Zd}function eh(e){let t=null;if(Nc(e,DragEvent)?t=e.dataTransfer:Nc(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),i=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),i]}function th(e){return Ao(_s(e))}function nh(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function rh(e){return wa(e.registerCommand(sn,(e=>{const t=$i();return!!ki(t)&&(t.clear(),!0)}),0),e.registerCommand(dn,(e=>{const t=$i();return wi(t)?(t.deleteCharacter(e),!0):!!ki(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(yn,(e=>{const t=$i();return!!wi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(bn,(e=>{const t=$i();return!!wi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(pn,(t=>{const n=$i();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)yd(r,n,e);else if(wi(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(mn,(()=>{const e=$i();return!!wi(e)&&(e.removeText(),!0)}),0),e.registerCommand(_n,(e=>{const t=$i();return!!wi(t)&&(t.formatText(e),!0)}),0),e.registerCommand(zn,(e=>{const t=$i();if(!wi(t)&&!ki(t))return!1;const n=t.getNodes();for(const t of n){const n=vl(t,(e=>Eo(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(hn,(e=>{const t=$i();return!!wi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(gn,(()=>{const e=$i();return!!wi(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(Pn,(()=>{const e=mi(),t=$i();return wi(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Gi([e]),!0}),0),e.registerCommand(Mn,(()=>Ac((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(Dn,(()=>Ac((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(Tn,(e=>{const t=$i();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(wi(t)){const n=Us(t.focus,!0);if(!e.shiftKey&&Ao(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(Nn,(e=>{const t=$i();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(wi(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===Ss().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Us(t.focus,!1);if(!e.shiftKey&&Ao(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(kn,(e=>{const t=$i();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Oa(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!wi(t))return!1;if(Ba(t,!0)){const n=e.shiftKey;return e.preventDefault(),$a(t,n,!0),!0}return!1}),0),e.registerCommand(wn,(e=>{const t=$i();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Oa(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!wi(t))return!1;const n=e.shiftKey;return!!Ba(t,!1)&&(e.preventDefault(),$a(t,n,!1),!0)}),0),e.registerCommand(On,(t=>{if(th(t.target))return!1;const n=$i();if(wi(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(Oo(n))return!1;const r=function(e){const t=vl(e,(e=>Eo(e)&&!e.isInline()));return Eo(t)||xc(4,e.__key),t}(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Dn,void 0);if(Hd&&"ko-KR"===navigator.language)return!1}else if(!ki(n))return!1;return t.preventDefault(),e.dispatchCommand(dn,!0)}),0),e.registerCommand(Rn,(t=>{if(th(t.target))return!1;const n=$i();return!(!wi(n)&&!ki(n))&&(t.preventDefault(),e.dispatchCommand(dn,!1))}),0),e.registerCommand(An,(t=>{const n=$i();if(!wi(n))return!1;if(nh(n),null!==t){if((Hd||$d||Ud)&&zd)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(hn,!1)}return e.dispatchCommand(gn,void 0)}),0),e.registerCommand(Fn,(()=>!!wi($i())&&(e.blur(),!0)),0),e.registerCommand(Bn,(t=>{const[,n]=eh(t);if(n.length>0){const r=Pd(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,o=_s(i);if(null!==o){const e=Di();if(gi(o))e.anchor.set(o.getKey(),t,"text"),e.focus.set(o.getKey(),t,"text");else{const t=o.getParentOrThrow().getKey(),n=o.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}vs(St(e))}e.dispatchCommand(Wd,n)}return t.preventDefault(),!0}return!!wi($i())}),0),e.registerCommand($n,(e=>{const[t]=eh(e),n=$i();return!(t&&!wi(n))}),0),e.registerCommand(Hn,(e=>{const[t]=eh(e),n=$i();if(t&&!wi(n))return!1;const r=Pd(e.clientX,e.clientY);if(null!==r){Ao(_s(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Vn,(()=>(zs(),!0)),0),e.registerCommand(Un,(t=>(Cd(e,Nc(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Wn,(t=>(async function(e,t){await Cd(t,Nc(e,ClipboardEvent)?e:null),t.update((()=>{const e=$i();wi(e)?e.removeText():ki(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(fn,(t=>{const[,n,r]=eh(t);return n.length>0&&!r?(e.dispatchCommand(Wd,n),!0):(!ul(t.target)||!Xo(t.target))&&(null!==$i()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=$i(),r=Nc(e,InputEvent)||Nc(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&yd(r,n,t)}),{tag:zr})}(t,e),!0))}),0),e.registerCommand(Ln,(e=>{const t=$i();return wi(t)&&nh(t),!1}),0),e.registerCommand(In,(e=>{const t=$i();return wi(t)&&nh(t),!1}),0))}const ih={conflictsWith:["@lexical/plain-text"],dependencies:[kd],name:"@lexical/rich-text",nodes:()=>[Zd,Vd],register:rh};var oh;o.languages.javascript=o.languages.extend("clike",{"class-name":[o.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),o.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,o.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:o.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:o.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:o.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:o.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:o.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),o.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:o.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),o.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),o.languages.markup&&(o.languages.markup.tag.addInlined("script","javascript"),o.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),o.languages.js=o.languages.javascript,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(/<inner>/g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+o+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+o+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n<r;n++){var i=t[n];if("code"===i.type){var o=i.content[1],s=i.content[3];if(o&&s&&"code-language"===o.type&&"code-block"===s.type&&"string"==typeof o.content){var l=o.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),a="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());s.alias?"string"==typeof s.alias?s.alias=[s.alias,a]:s.alias.push(a):s.alias=[a]}}else e(i.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,i=t.classes.length;r<i;r++){var o=t.classes[r],c=/language-(.+)/.exec(o);if(c){n=c[1];break}}var u=e.languages[n];if(u)t.content=e.highlight(function(e){var t=e.replace(s,"");return t=t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),a(n);var r=l[t];return r||e})),t}(t.content),u,n);else if(n&&"none"!==n&&e.plugins.autoloader){var d="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=d,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(d);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},a=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(o),o.languages.c=o.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),o.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),o.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},o.languages.c.string],char:o.languages.c.char,comment:o.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:o.languages.c}}}}),o.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete o.languages.c.boolean,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(o),o.languages.objectivec=o.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete o.languages.objectivec["class-name"],o.languages.objc=o.languages.objectivec,o.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},(oh=o.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/}).string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:oh},boolean:oh.boolean,variable:oh.variable};var sh;sh||(sh=1,o.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},o.languages.python["string-interpolation"].inside.interpolation.inside.rest=o.languages.python,o.languages.py=o.languages.python);var lh;lh||(lh=1,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,(function(){return t}));t=t.replace(/<self>/g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(o)),o.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},o.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=o.languages.swift}));var ah;ah||(ah=1,function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(o));var ch;ch||(ch=1,function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0,inside:{punctuation:/\./}}})}(o));var uh;function dh(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}uh||(uh=1,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(o));function hh(e,t){for(const n of e.childNodes){if(cl(n)&&n.tagName===t)return!0;hh(n,t)}return!1}const gh="data-language",ph="data-highlight-language",fh="data-theme";let mh=class e extends ko{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");Ca(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(gh,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(ph,n));const r=this.getTheme();r&&t.setAttribute(fh,r);const i=this.getStyle();return i&&t.setAttribute("style",i),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(gh,r):i&&t.removeAttribute(gh);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute(ph,r):t.removeAttribute(ph):o&&r&&t.setAttribute(ph,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(fh,s):l&&t.removeAttribute(fh);const a=this.__style,c=e.__style;return a?a!==c&&t.setAttribute("style",a):c&&t.removeAttribute("style"),!1}exportDOM(e){const t=document.createElement("pre");Ca(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(gh,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(ph,n));const r=this.getTheme();r&&t.setAttribute(fh,r);const i=this.getStyle();return i&&t.setAttribute("style",i),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||hh(e,"BR"))?{conversion:_h,priority:1}:null,div:()=>({conversion:xh,priority:1}),pre:()=>({conversion:_h,priority:0}),table:e=>vh(e)?{conversion:Ch,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&vh(n)?{conversion:Sh,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&vh(t)?{conversion:Sh,priority:3}:null}}}static importJSON(e){return yh().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const e=zo();return this.insertAfter(e,t),e}const{anchor:i,focus:o}=e,s=(i.isBefore(o)?i:o).getNode();if(gi(s)){let e=Lh(s);const t=[];for(;;)if(yi(e))t.push(mi()),e=e.getNextSibling();else{if(!Nh(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(Th(" ".repeat(n))),n!==i)break;e=e.getNextSibling()}}const n=s.splitText(i.offset)[0],r=0===i.offset?0:1,o=n.getIndexWithinParent()+r,l=s.getParentOrThrow(),a=[Zr(),...t];l.splice(o,0,a);const c=t[t.length-1];c?c.select():0===i.offset?n.selectPrevious():n.getNextSibling().selectNext(0,0)}if(bh(s)){const{offset:t}=e.anchor;s.splice(t,0,[Zr()]),s.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){const e=zo();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function yh(e,t){return function(e){const t=fl();return so(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(mh).setLanguage(e).setTheme(t)}function bh(e){return e instanceof mh}function _h(e){return{node:yh(e.getAttribute(gh))}}function xh(e){const t=e,n=wh(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(wh(t))return!0;t=t.parentElement}return!1}(t)?{node:n?yh():null}:{node:null}}function Ch(){return{node:yh()}}function Sh(){return{node:null}}function wh(e){return null!==e.style.fontFamily.match("monospace")}function vh(e){return e.classList.contains("js-file-line-container")}let kh=class e extends ri{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e);return Ca(t,Eh(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=Eh(n.theme,e.__highlightType),o=Eh(n.theme,this.__highlightType);return i!==o&&(i&&Sa(t,i),o&&Ca(t,o)),r}static importJSON(e){return Th().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return yh()}};function Eh(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Th(e="",t){return rl(new kh(e,t))}function Nh(e){return e instanceof kh}function Ah(e,t){let n=e;for(let r=zl(e,t);r&&(Nh(r.origin)||yi(r.origin));r=vc(r))n=r.origin;return n}function Lh(e){return Ah(e,"previous")}function Oh(e){return Ah(e,"next")}!function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(Prism);const Fh=globalThis.Prism||window.Prism,Rh={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},Ih={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function Ph(e){return Ih[e]||e}function Mh(e){return"string"==typeof e?e:Array.isArray(e)?e.map(Mh).join(""):Mh(e.content)}function Dh(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent();let i=Fh.tokenize(r,Fh.languages[n?"diff":t]);return n&&(i=function(e,t){const n=t,r=Fh.languages[n],i={tokens:e},o=Fh.languages.diff.PREFIXES;for(const e of i.tokens){if("string"==typeof e||!(e.type in o)||!Array.isArray(e.content))continue;const t=e.type;let n=0;const i=()=>(n++,new Fh.Token("prefix",o[t],t.replace(/^(\w+).*/,"$1"))),s=e.content.filter((e=>"string"==typeof e||"prefix"!==e.type)),l=e.content.length-s.length,a=Fh.tokenize(Mh(s),r);a.unshift(i());const c=/\r\n|\n/g,u=e=>{const t=[];c.lastIndex=0;let r,o=0;for(;n<l&&(r=c.exec(e));){const n=r.index+r[0].length;t.push(e.slice(o,n)),o=n,t.push(i())}if(0!==t.length)return o<e.length&&t.push(e.slice(o)),t},d=e=>{for(let t=0;t<e.length&&n<l;t++){const n=e[t];if("string"==typeof n){const r=u(n);r&&(e.splice(t,1,...r),t+=r.length-1)}else if("string"==typeof n.content){const e=u(n.content);e&&(n.content=e)}else Array.isArray(n.content)?d(n.content):d([n.content])}};d(a),n<l&&a.push(i()),e.content=a}return i.tokens}(i,n[1])),Bh(i)}function Bh(e,t){const n=[];for(const r of e)if("string"==typeof r){const e=r.split(/(\n|\t)/),i=e.length;for(let r=0;r<i;r++){const i=e[r];"\n"===i||"\r\n"===i?n.push(Zr()):"\t"===i?n.push(mi()):i.length>0&&n.push(Th(i,t))}}else{const{content:e,alias:t}=r;"string"==typeof e?n.push(...Bh([e],"prefix"===r.type&&"string"==typeof t?t:r.type)):Array.isArray(e)&&n.push(...Bh(e,"unchanged"===r.type?void 0:r.type))}return n}const zh={$tokenize(e,t){return Dh(e,t||this.defaultLanguage)},defaultLanguage:"javascript",tokenize(e,t){return Fh.tokenize(e,Fh.languages[t||""]||Fh.languages[this.defaultLanguage])}};function $h(e,t,n){const r=e.getParent();bh(r)?Uh(r,t,n):Nh(e)&&e.replace(hi(e.__text))}function Hh(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let o="1",s=1;for(let e=0;e<i;e++)Gr(r[e])&&(o+="\n"+ ++s);n.setAttribute("data-gutter",o)}const Kh=new Set;function Uh(e,t,n){const r=e.getKey(),i=t.getKey()+"/"+r;void 0===e.getLanguage()&&e.setLanguage(n.defaultLanguage);if(!function(e){const t=function(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}(e),n=t||e;try{return!!n&&Fh.languages.hasOwnProperty(n)}catch(e){return!1}}(e.getLanguage()||n.defaultLanguage))return e.getIsSyntaxHighlightSupported()&&e.setIsSyntaxHighlightSupported(!1),void async function(){}();e.getIsSyntaxHighlightSupported()||e.setIsSyntaxHighlightSupported(!0),Kh.has(i)||(Kh.add(i),t.update((()=>{!function(e,t){const n=ms(e);if(!bh(n)||!n.isAttached())return;const r=$i();if(!wi(r))return void t();const i=r.anchor,o=i.offset,s="element"===i.type&&Gr(n.getChildAtIndex(i.offset-1));let l=0;if(!s){const e=i.getNode();l=o+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(s?i.getNode().select(o,o):n.getChildren().some((e=>{const t=gi(e);if(t||Gr(e)){const n=e.getTextContentSize();if(t&&n>=l)return e.select(l,l),!0;l-=n}return!1})))}(r,(()=>{const t=ms(r);if(!bh(t)||!t.isAttached())return!1;const i=t.getLanguage()||n.defaultLanguage,o=n.$tokenize(t,i),s=function(e,t){let n=0;for(;n<e.length&&Wh(e[n],t[n]);)n++;const r=e.length,i=t.length,o=Math.min(r,i)-n;let s=0;for(;s<o;)if(s++,!Wh(e[r-s],t[i-s])){s--;break}const l=r-s;return{from:n,nodesForReplacement:t.slice(n,i-s),to:l}}(t.getChildren(),o),{from:l,to:a,nodesForReplacement:c}=s;return!(l===a&&!c.length||(e.splice(l,a-l,c),0))}))}),{onUpdate:()=>{Kh.delete(i)},skipTransforms:!0}))}function Wh(e,t){return Nh(e)&&Nh(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||yi(e)&&yi(t)||Gr(e)&&Gr(t)}function Vh(e){if(!wi(e))return!1;const t=e.anchor.getNode(),n=bh(t)?t:t.getParent(),r=e.focus.getNode(),i=bh(r)?r:r.getParent();return bh(n)&&n.is(i)}function jh(e){const t=e.getNodes(),n=[];if(1===t.length&&bh(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];Nh(i)||yi(i)||Gr(i)||dh(169),Gr(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=_i(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function qh(e){const t=$i();if(!wi(t)||!Vh(t))return!1;const n=jh(t),r=n.length;if(0===r&&t.isCollapsed())return e===Mn&&t.insertNodes([mi()]),!0;if(0===r&&e===Mn&&"\n"===t.getTextContent()){const e=mi(),n=Zr(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),ia(pa(Gl($l(e,"next",0),da(zl(n,"next"))),r)),!0}for(let i=0;i<r;i++){const r=n[i];if(r.length>0){let n=r[0];if(0===i&&(n=Lh(n)),e===Mn){const e=mi();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=_i(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else yi(n)&&n.remove()}}return!0}function Zh(e,t){const n=$i();if(!wi(n))return!1;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,l=r.getNode(),a=i.getNode(),c=e===Tn;if(!Vh(n)||!Nh(l)&&!yi(l)||!Nh(a)&&!yi(a))return!1;if(!t.altKey){if(n.isCollapsed()){const e=l.getParentOrThrow();if(c&&0===o&&null===l.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&o===l.getTextContentSize()&&null===l.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(l.isBefore(a)?(u=Lh(l),d=Oh(a)):(u=Lh(a),d=Oh(l)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;e<h.length;e++){const t=h[e];if(!Nh(t)&&!yi(t)&&!Gr(t))return!1}t.preventDefault(),t.stopPropagation();const g=c?u.getPreviousSibling():d.getNextSibling();if(!Gr(g))return!0;const p=c?g.getPreviousSibling():g.getNextSibling();if(null==p)return!0;const f=Nh(p)||yi(p)||Gr(p)?c?Lh(p):Oh(p):null;let m=null!=f?f:p;return g.remove(),h.forEach((e=>e.remove())),e===Tn?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(l,o,a,s),!0}function Gh(e,t){const n=$i();if(!wi(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=e===En;if(!Vh(n)||!Nh(o)&&!yi(o)||!Nh(s)&&!yi(s))return!1;const a=s;if("rtl"===function(e){const t=Lh(e),n=Oh(e);let r=t;for(;null!==r;){if(Nh(r)){const e=rs(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(Eo(i)){const e=i.getDirection();if("ltr"===e||"rtl"===e)return e}return null}(a)?!l:l){const e=function(e,t){let n=null,r=null,i=e,o=t,s=e.getTextContent();for(;;){if(0===o){if(i=i.getPreviousSibling(),null===i)break;if(Nh(i)||yi(i)||Gr(i)||dh(167),Gr(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent()}else o--;const e=s[o];Nh(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let l=null;if(t<e.getTextContentSize())Nh(e)&&(l=e.getTextContent()[t]);else{const t=e.getNextSibling();Nh(t)&&(l=t.getTextContent()[0])}if(null!==l&&" "!==l)return n;{const r=function(e,t){let n=e,r=t,i=e.getTextContent(),o=e.getTextContentSize();for(;;){if(!Nh(n)||r===o){if(n=n.getNextSibling(),null===n||Gr(n))return null;Nh(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if(Nh(n)){if(" "!==i[r])return{node:n,offset:r};r++}}}(e,t);return null!==r?r:n}}(a,i.offset);if(null!==e){const{node:t,offset:r}=e;Gr(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else(function(e){const t=Oh(e);return Gr(t)&&dh(168),t})(a).select();return t.preventDefault(),t.stopPropagation(),!0}function Jh(e,t){const n={};for(const r of e){const e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}const Yh=/[!-/:-@[-`{-~\s]/;function Xh(e){return gi(e)&&!e.hasFormat("code")}function Qh(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const eg=lt("mdListMarker",{parse:e=>"string"==typeof e&&/^[-*+]$/.test(e)?e:"-"}),tg=lt("mdCodeFence",{parse:e=>"string"==typeof e&&/^`{3,}$/.test(e)?e:"```"}),ng=e=>(t,n,r,i)=>{const o=e(r);o.append(...n),t.replace(o),i||o.select(0,0)},rg=e=>(t,n,r,i)=>{const o=t.getPreviousSibling(),s=t.getNextSibling(),l=Du("check"===e?"x"===r[3]:void 0),a=r[0].trim()[0],c="bullet"!==e&&"check"!==e||a!==eg.parse(a)?void 0:a;if(Vu(s)&&s.getListType()===e){c&&ct(s,eg,c);const e=s.getFirstChild();null!==e?e.insertBefore(l):s.append(l),t.remove()}else if(Vu(o)&&o.getListType()===e)c&&ct(o,eg,c),o.append(l),t.remove();else{const n=Wu(e,"number"===e?Number(r[2]):void 0);c&&ct(n,eg,c),n.append(l),t.replace(n)}l.append(...n),i||l.select(0,0);const u=function(e){const t=e.match(/\t/g),n=e.match(/ /g);let r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);u&&l.setIndent(u)},ig=(e,t,n)=>{const r=[],i=e.getChildren();let o=0;for(const s of i)if(Bu(s)){if(1===s.getChildrenSize()){const e=s.getFirstChild();if(Vu(e)){r.push(ig(e,t,n+1));continue}}const i=" ".repeat(4*n),l=e.getListType(),a=at(e,eg),c="number"===l?`${e.getStart()+o}. `:"check"===l?`${a} [${s.getChecked()?"x":" "}] `:a+" ";r.push(i+c+t(s)),o++}return r.join("\n")},og={dependencies:[Zd],export:(e,t)=>{if(!Qd(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:ng((e=>Xd("h"+e[1].length))),type:"element"},sg={dependencies:[Vd],export:(e,t)=>{if(!qd(e))return null;const n=t(e).split("\n"),r=[];for(const e of n)r.push("> "+e);return r.join("\n")},regExp:/^>\s/,replace:(e,t,n,r)=>{if(r){const n=e.getPreviousSibling();if(qd(n))return n.splice(n.getChildrenSize(),0,[Zr(),...t]),void e.remove()}const i=jd();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},lg={dependencies:[mh],export:e=>{if(!bh(e))return null;const t=e.getTextContent();let n=at(e,tg);if(t.indexOf(n)>-1){const e=t.match(/`{3,}/g);if(e){const t=Math.max(...e.map((e=>e.length)));n="`".repeat(t+1)}}return n+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n"+n},handleImportAfterStartMatch:({lines:e,rootNode:t,startLineIndex:n,startMatch:r})=>{const i=r[1],o=i.trim().length,s=e[n],l=r.index+i.length,a=s.slice(l),c=new RegExp(`\`{${o},}$`);if(c.test(a)){const e=a.match(c),i=a.slice(0,a.lastIndexOf(e[0])),o=[...r];return o[2]="",lg.replace(t,null,o,e,[i],!0),[!0,n]}const u=new RegExp(`^[ \\t]*\`{${o},}$`);for(let i=n+1;i<e.length;i++){const o=e[i];if(u.test(o)){const l=o.match(u),a=e.slice(n+1,i),c=s.slice(r[0].length);return c.length>0&&a.unshift(c),lg.replace(t,null,r,l,a,!0),[!0,i]}}const d=e.slice(n+1),h=s.slice(r[0].length);return h.length>0&&d.unshift(h),lg.replace(t,null,r,null,d,!0),[!0,e.length-1]},regExpEnd:{optional:!0,regExp:/^[ \t]*`{3,}$/},regExpStart:/^([ \t]*`{3,})([\w-]+)?[ \t]?/,replace:(e,t,n,r,i,o)=>{let s,l;const a=n[1]?n[1].trim():"```",c=n[2]||void 0;if(!t&&i){if(1===i.length)r?(s=yh(c),l=i[0]):(s=yh(c),l=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{for(s=yh(c),i.length>0&&(0===i[0].trim().length?i.shift():i[0].startsWith(" ")&&(i[0]=i[0].slice(1)));i.length>0&&!i[i.length-1].length;)i.pop();l=i.join("\n")}ct(s,tg,a);const t=hi(l);s.append(t),e.append(s)}else t&&ng((e=>yh(e?e[2]:void 0)))(e,t,n,o)},type:"multiline-element"},ag={dependencies:[zu,Iu],export:(e,t)=>Vu(e)?ig(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:rg("bullet"),type:"element"},cg={dependencies:[zu,Iu],export:(e,t)=>Vu(e)?ig(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:rg("number"),type:"element"},ug={dependencies:[Xu],export:(e,t,n)=>{if(!td(e)||id(e))return null;const r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{if(vl(e,td))return;const[,n,r,i]=t,o=ed(r,{title:i}),s=n.split("[").length-1,l=n.split("]").length-1;let a=n,c="";if(s<l)return;if(s>l){const e=n.split("[");c="["+e[0],a=e.slice(1).join("[")}const u=hi(a);return u.setFormat(e.getFormat()),o.append(u),e.replace(o),c&&o.insertBefore(hi(c)),u},trigger:")",type:"text-match"},dg=[...[og,sg,ag,cg],...[lg],...[{format:["code"],tag:"`",type:"text-format"},{format:["bold","italic"],tag:"***",type:"text-format"},{format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},{format:["bold"],tag:"**",type:"text-format"},{format:["bold"],intraword:!1,tag:"__",type:"text-format"},{format:["highlight"],tag:"==",type:"text-format"},{format:["italic"],tag:"*",type:"text-format"},{format:["italic"],intraword:!1,tag:"_",type:"text-format"},{format:["strikethrough"],tag:"~~",type:"text-format"}],...[ug]];function hg(e,t,n,r,i){if(!tl(e.getParent())||e.getFirstChild()!==t)return!1;const o=t.getTextContent();if(!i&&" "!==o[n-1])return!1;for(const{regExpStart:s,replace:l,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=o.match(s);if(r){const o=i||r[0].endsWith(" ")?n:n-1;if(r[0].length!==o)continue;const s=t.getNextSiblings(),[a,c]=t.splitText(n);if(!1!==l(e,c?[c,...s]:s,r,null,null,!1))return a.remove(),!0}}return!1}function gg(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(pg(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function pg(e,t,n,r,i){for(let o=0;o<i;o++)if(e[t+o]!==n[r+o])return!1;return!0}function fg(e,t=dg){const n=function(e){const t=Jh(e,(e=>e.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=Jh(n.textFormat,(({tag:e})=>e[e.length-1])),i=Jh(n.textMatch,(({trigger:e})=>e));for(const n of t){const t=n.type;if("element"===t||"text-match"===t||"multiline-element"===t){const t=n.dependencies;for(const n of t)e.hasNode(n)||Qh(173,n.getType())}}const o=(e,t,o)=>{(function(e,t,n,r){if(!tl(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:o,replace:s}of r){const r=i.match(o);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[o,l]=t.splitText(n);if(!1!==s(e,l?[l,...i]:i,r,!1))return o.remove(),!0}}return!1})(e,t,o,n.element)||hg(e,t,o,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t<r.length&&(r=r.slice(0,t));for(const t of i){if(!t.replace||!t.regExp)continue;const n=r.match(t.regExp);if(null===n)continue;const i=n.index||0,o=i+n[0].length;let s;return 0===i?[s]=e.splitText(o):[,s]=e.splitText(i,o),s.selectNext(0,0),t.replace(s,n),!0}return!1}(t,o,i)||function(e,t,n){const r=e.getTextContent(),i=t-1,o=r[i],s=n[o];if(!s)return!1;for(const t of s){const{tag:n}=t,s=n.length,l=i-s+1;if(s>1&&!pg(r,l,n,0,s))continue;if(" "===r[l-1])continue;const a=r[i+1];if(!1===t.intraword&&a&&!Yh.test(a))continue;const c=e;let u=c,d=gg(r,l,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!Gr(h);)if(gi(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=gg(e,e.length,n)}if(d<0)continue;if(u===c&&d+s===l)continue;const g=u.getTextContent();if(d>0&&g[d-1]===o)continue;const p=g[d-1];if(!1===t.intraword&&p&&!Yh.test(p))continue;const f=c.getTextContent(),m=f.slice(0,l)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+s));const b=$i(),_=Di();vs(_);const x=i-s*(u===c?2:1)+1;_.anchor.set(u.__key,d,"text"),_.focus.set(c.__key,x,"text");for(const e of t.format)_.hasFormat(e)||_.formatText(e);_.anchor.set(_.focus.key,_.focus.offset,_.focus.type);for(const e of t.format)_.hasFormat(e)&&_.toggleFormat(e);return wi(b)&&(_.format=b.format),!0}}(t,o,r)};return wa(e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has($r)||t.has(Dr))return;if(e.isComposing())return;const s=r.read($i),l=i.read($i);if(!wi(l)||!wi(s)||!s.isCollapsed()||s.is(l))return;const a=s.anchor.key,c=s.anchor.offset,u=r._nodeMap.get(a);!gi(u)||!n.has(a)||1!==c&&c>l.anchor.offset+1||e.update((()=>{if(!Xh(u))return;const e=u.getParent();null===e||bh(e)||o(e,u,s.anchor.offset)}))})),e.registerCommand(An,(e=>{if(null!==e&&e.shiftKey)return!1;const t=$i();if(!wi(t)||!t.isCollapsed())return!1;const r=t.anchor.offset,i=t.anchor.getNode();if(!gi(i)||!Xh(i))return!1;const o=i.getParent();return null!==o&&!bh(o)&&(r===i.getTextContent().length&&!!hg(o,i,r,n.multilineElement,!0)&&(null!==e&&e.preventDefault(),!0))}),1))}const mg=/[^\w]/;function yg(e,t,n){const r=n.tag,i=r.length,o=e.getTextContent(),s=t+i,l=o.indexOf(r,s);if(l<0)return;const a=o.slice(s,l);if(0===a.length)return;const c=o.slice(0,t),u=o.slice(l+i);e.setTextContent(c+a+u);const d=Di();vs(d),d.anchor.set(e.getKey(),t,"text"),d.focus.set(e.getKey(),t+a.length,"text");for(const e of n.format)d.hasFormat(e)||d.formatText(e);d.anchor.set(d.focus.key,d.focus.offset,d.focus.type);for(const e of n.format)d.hasFormat(e)&&d.toggleFormat(e)}function bg(e,t){let n=Date.now(),r=0,i=Date.now(),o=0,s=null;return(l,a,c,u,d,h)=>{const g=Date.now();if(h.has(Wr)&&(i=n,o=r,s=l),h.has(Dr))return r=0,n=g,2;h.has(Vr)&&s&&(n=i,r=o,l=s);const p=function(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const o=t._selection,s=e._selection;if(i)return 1;if(!(wi(o)&&wi(s)&&s.isCollapsed()&&o.isCollapsed()))return 0;const l=function(e,t,n){const r=e._nodeMap,i=[];for(const e of t){const t=r.get(e);void 0!==t&&i.push(t)}for(const[e,t]of n){if(!t)continue;const n=r.get(e);void 0===n||Oo(n)||i.push(n)}return i}(t,n,r);if(0===l.length)return 0;if(l.length>1){const n=t._nodeMap,r=n.get(o.anchor.key),i=n.get(s.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&gi(r)&&1===r.__text.length&&1===o.anchor.offset?2:0}const a=l[0],c=e._nodeMap.get(a.__key);if(!gi(c)||!gi(a)||c.__mode!==a.__mode)return 0;const u=c.__text,d=a.__text;if(u===d)return 0;const h=o.anchor,g=s.anchor;if(h.key!==g.key||"text"!==h.type)return 0;const p=h.offset,f=g.offset,m=d.length-u.length;return 1===m&&f===p-1?2:-1===m&&f===p+1?3:-1===m&&f===p?4:0}(l,a,u,d,e.isComposing()),f=(()=>{const i=null===c||c.editor===e,o=h.has("history-push");if(!o&&i&&h.has(Br))return 0;if(1===p)return 2;if(null===l)return 1;const s=a._selection;if(!(u.size>0||d.size>0))return null!==s?0:2;const f="number"==typeof t?t:t.peek();return!1===o&&0!==p&&p===r&&g<n+f&&i||1===u.size&&function(e,t,n){const r=t._nodeMap.get(e),i=n._nodeMap.get(e),o=t._selection,s=n._selection;return!(wi(o)&&wi(s)&&"element"===o.anchor.type&&"element"===o.focus.type&&"text"===s.anchor.type&&"text"===s.focus.type||!gi(r)||!gi(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read((()=>r.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(u)[0],l,a)?0:1})();return n=g,r=p,f}}function _g(e){e.undoStack=[],e.redoStack=[],e.current=null}function xg(e,t,n){const r=bg(e,n),i=wa(e.registerCommand(xn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,o=r.pop();null!==i&&(n.push(i),e.dispatchCommand(Zn,!0)),0===r.length&&e.dispatchCommand(Gn,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Dr})}}(e,t),!0)),0),e.registerCommand(Cn,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==n.length){const i=t.current;null!==i&&(r.push(i),e.dispatchCommand(Gn,!0));const o=n.pop();0===n.length&&e.dispatchCommand(Zn,!1),t.current=o||null,o&&o.editor.setEditorState(o.editorState,{tag:Dr})}}(e,t),!0)),0),e.registerCommand(jn,(()=>(_g(t),!1)),0),e.registerCommand(qn,(()=>(_g(t),e.dispatchCommand(Zn,!1),e.dispatchCommand(Gn,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:o,dirtyElements:s,tags:l})=>{const a=t.current,c=t.redoStack,u=t.undoStack,d=null===a?null:a.editorState;if(null!==a&&n===d)return;const h=r(i,n,a,o,s,l);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(Zn,!1)),null!==a&&(u.push({...a}),e.dispatchCommand(Gn,!0));else if(2===h)return;t.current={editor:e,editorState:n}})));return i}function Cg(){return{current:null,redoStack:[],undoStack:[]}}var Sg={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline",highlight:"lexxy-content__highlight"},tableCellHeader:"lexxy-content__table-cell--header",tableCellSelected:"lexxy-content__table-cell--selected",tableSelection:"lexxy-content__table--selection",tableScrollableWrapper:"lexxy-content__table-wrapper",tableCellHighlight:"lexxy-content__table-cell--highlight",tableCellFocus:"lexxy-content__table-cell--focus",list:{nested:{listitem:"lexxy-nested-listitem"}},codeHighlight:{addition:"code-token__selector",atrule:"code-token__attr",attr:"code-token__attr","attr-name":"code-token__attr","attr-value":"code-token__selector",boolean:"code-token__property",bold:"code-token__variable",builtin:"code-token__selector",cdata:"code-token__comment",char:"code-token__selector",class:"code-token__function","class-name":"code-token__function",color:"code-token__property",comment:"code-token__comment",constant:"code-token__property",coord:"code-token__comment",decorator:"code-token__function",deleted:"code-token__operator",deletion:"code-token__operator",directive:"code-token__attr","directive-hash":"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__function",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",line:"code-token__selector",namespace:"code-token__variable",number:"code-token__property",macro:"code-token__function",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation","raw-string":"code-token__operator",regex:"code-token__variable",script:"code-token__function",selector:"code-token__selector",string:"code-token__selector",style:"code-token__function",symbol:"code-token__property",tag:"code-token__property",title:"code-token__function","type-definition":"code-token__function",url:"code-token__operator",variable:"code-token__variable"}};function wg(e,t,n=""){const r=document.createElement(e);for(const[e,n]of Object.entries(t||{}))e in r?r[e]=n:null!=n&&r.setAttribute(e,n);return n&&(r.innerHTML=n),r}function vg(e){return(new DOMParser).parseFromString(e,"text/html")}function kg(e){return e.startsWith("image/")&&!e.includes("svg")}function Eg(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Tg(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}class Ng extends No{static getType(){return"horizontal_divider"}static clone(e){return new Ng(e.__key)}static importJSON(e){return new Ng}static importDOM(){return{hr:e=>({conversion:()=>({node:new Ng}),priority:1})}}constructor(e){super(e)}createDOM(){const e=wg("figure",{className:"horizontal-divider"}),t=wg("hr");e.appendChild(t);const n=wg("lexxy-node-delete-button");return e.appendChild(n),e}updateDOM(){return!0}getTextContent(){return"┄\n\n"}isInline(){return!1}exportDOM(){return{element:wg("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Ag=/^(\d+(?:\.\d+)?)px$/,Lg=3,Og=2,Fg=0,Rg=1;let Ig=class e extends ko{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(t){return new e(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:Mg,priority:0}),th:e=>({conversion:Mg,priority:0})}}static importJSON(e){return Dg().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Fg,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),null!==this.__backgroundColor&&(t.style.backgroundColor=this.__backgroundColor),Pg(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),Ca(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(cl(t.element)){const e=t.element;e.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||"top",e.style.textAlign="start",null===this.__backgroundColor&&this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...Pg(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=Lg){const n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Fg}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function Pg(e){return"middle"===e||"bottom"===e}function Mg(e){const t=e,n=e.nodeName.toLowerCase();let r;Ag.test(t.style.width)&&(r=parseFloat(t.style.width));let i=Fg;if("th"===n){i="col"===t.getAttribute("scope")?Og:Rg}const o=Dg(i,t.colSpan,r);o.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;""!==s&&(o.__backgroundColor=s);const l=t.style.verticalAlign;Pg(l)&&(o.__verticalAlign=l);const a=t.style,c=(a&&a.textDecoration||"").split(" "),u="700"===a.fontWeight||"bold"===a.fontWeight,d=c.includes("line-through"),h="italic"===a.fontStyle,g=c.includes("underline");return{after:e=>{const t=[];let n=null;const r=()=>{if(n){const e=n.getFirstChild();Gr(e)&&1===n.getChildrenSize()&&e.remove()}};for(const i of e)Qs(i)||gi(i)||Gr(i)?(gi(i)&&(u&&i.toggleFormat("bold"),d&&i.toggleFormat("strikethrough"),h&&i.toggleFormat("italic"),g&&i.toggleFormat("underline")),n?n.append(i):(n=zo().append(i),t.push(n))):(t.push(i),r(),n=null);return r(),0===t.length&&t.push(zo()),t},node:o}}function Dg(e=Fg,t=1,n){return rl(new Ig(e,t,n))}function Bg(e){return e instanceof Ig}const zg=nn("INSERT_TABLE_COMMAND");function $g(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Hg=class e extends ko{__height;static getType(){return"tablerow"}static clone(t){return new e(t.__height,t.__key)}static importDOM(){return{tr:e=>({conversion:Kg,priority:0})}}static importJSON(e){return Ug().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...void 0===e?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),Ca(t,e.theme.tableRow),t}extractWithChild(e,t,n){return"html"===n}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function Kg(e){const t=e;let n;return Ag.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>Rc(e,Bg),node:Ug(n)}}function Ug(e){return rl(new Hg(e))}function Wg(e){return e instanceof Hg}const Vg="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,jg=Vg&&"documentMode"in document?document.documentMode:null,qg=Vg&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function Zg(e){const t=vl(e,(e=>Bg(e)));return Bg(t)?t:null}function Gg(e){const t=vl(e,(e=>Wg(e)));if(Wg(t))return t;throw new Error("Expected table cell to be inside of table row.")}function Jg(e){const t=vl(e,(e=>of(e)));if(of(t))return t;throw new Error("Expected table cell to be inside of table.")}Vg&&"InputEvent"in window&&!jg&&new window.InputEvent("input");const Yg=(e,t)=>e===Lg||e===t?t:Fg;function Xg(e=!0){const t=$i();wi(t)||pp(t)||$g(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=cp(n),[o,,s]=cp(r),[,l,a]=lp(s,o,i),{startRow:c}=a,{startRow:u}=l;return e?Qg(c+i.__rowSpan>u+o.__rowSpan?i:o,!0):Qg(u<c?o:i,!1)}function Qg(e,t=!0){const[,,n]=cp(e),[r,i]=lp(n,e,e),o=r[0].length,{startRow:s}=i;let l=null;if(t){const t=s+e.__rowSpan-1,i=r[t],a=Ug();for(let e=0;e<o;e++){const{cell:n,startRow:r}=i[e];if(r+n.__rowSpan-1<=t){const t=i[e].cell.__headerState,n=Yg(t,Og);a.append(Dg(n).append(zo()))}else n.setRowSpan(n.__rowSpan+1)}const c=n.getChildAtIndex(t);Wg(c)||$g(256),c.insertAfter(a),l=a}else{const e=s,t=r[e],i=Ug();for(let n=0;n<o;n++){const{cell:r,startRow:o}=t[n];if(o===e){const e=t[n].cell.__headerState,r=Yg(e,Og);i.append(Dg(r).append(zo()))}else r.setRowSpan(r.__rowSpan+1)}const a=n.getChildAtIndex(e);Wg(a)||$g(257),a.insertBefore(i),l=i}return l}function ep(e=!0){const t=$i();wi(t)||pp(t)||$g(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=cp(n),[o,,s]=cp(r),[,l,a]=lp(s,o,i),{startColumn:c}=a,{startColumn:u}=l;return e?tp(c+i.__colSpan>u+o.__colSpan?i:o,!0):tp(u<c?o:i,!1)}function tp(e,t=!0,n=!0){const[,,r]=cp(e),[i,o]=lp(r,e,e),s=i.length,{startColumn:l}=o,a=t?l+e.__colSpan-1:l-1,c=r.getFirstChild();Wg(c)||$g(120);let u=null;function d(e=Fg){const t=Dg(e).append(zo());return null===u&&(u=t),t}let h=c;e:for(let e=0;e<s;e++){if(0!==e){const e=h.getNextSibling();Wg(e)||$g(121),h=e}const t=i[e],n=t[a<0?0:a].cell.__headerState,r=Yg(n,Rg);if(a<0){rp(h,d(r));continue}const{cell:o,startColumn:s,startRow:l}=t[a];if(s+o.__colSpan-1<=a){let n=o,i=l,s=a;for(;i!==e&&n.__rowSpan>1;){if(s-=o.__colSpan,!(s>=0)){h.append(d(r));continue e}{const{cell:e,startRow:r}=t[s];n=e,i=r}}n.insertAfter(d(r))}else o.setColSpan(o.__colSpan+1)}null!==u&&n&&np(u);const g=r.getColWidths();if(g){const e=[...g],t=a<0?0:a,n=e[t];e.splice(t,0,n),r.setColWidths(e)}return u}function np(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function rp(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function ip(e){if(0===e.length)return null;const t=Jg(e[0]),[n]=ap(t,null,null);let r=1/0,i=-1/0,o=1/0,s=-1/0;const l=new Set;for(const t of n)for(const n of t){if(!n||!n.cell)continue;const t=n.cell.getKey();if(!l.has(t)&&e.some((e=>e.is(n.cell)))){l.add(t);const e=n.startRow,a=n.startColumn,c=n.cell.__rowSpan||1,u=n.cell.__colSpan||1;r=Math.min(r,e),i=Math.max(i,e+c-1),o=Math.min(o,a),s=Math.max(s,a+u-1)}}if(r===1/0||o===1/0)return null;const a=i-r+1,c=s-o+1,u=n[r][o];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const h=new Set([d.getKey()]);for(let e=r;e<=i;e++)for(let t=o;t<=s;t++){const r=n[e][t];if(!r.cell)continue;const i=r.cell,o=i.getKey();h.has(o)||(h.add(o),op(i)||d.append(...i.getChildren()),i.remove())}return 0===d.getChildrenSize()&&d.append(zo()),d}function op(e){if(1!==e.getChildrenSize())return!1;const t=e.getFirstChildOrThrow();return!(!$o(t)||!t.isEmpty())}function sp(e){const[t,n,r]=cp(e),i=t.__colSpan,o=t.__rowSpan;if(1===i&&1===o)return;const[s,l]=lp(r,t,t),{startColumn:a,startRow:c}=l,u=t.__headerState&Og,d=Array.from({length:i},((e,t)=>{let n=u;for(let e=0;0!==n&&e<s.length;e++)n&=s[e][t+a].cell.__headerState;return n})),h=t.__headerState&Rg,g=Array.from({length:o},((e,t)=>{let n=h;for(let e=0;0!==n&&e<s[0].length;e++)n&=s[t+c][e].cell.__headerState;return n}));if(i>1){for(let e=1;e<i;e++)t.insertAfter(Dg(d[e]|g[0]).append(zo()));t.setColSpan(1)}if(o>1){let e;for(let t=1;t<o;t++){const r=c+t,o=s[r];e=(e||n).getNextSibling(),Wg(e)||$g(125);let l=null;for(let e=0;e<a;e++){const t=o[e],n=t.cell;t.startRow===r&&(l=n),n.__colSpan>1&&(e+=n.__colSpan-1)}if(null===l)for(let n=i-1;n>=0;n--)rp(e,Dg(d[n]|g[t]).append(zo()));else for(let e=i-1;e>=0;e--)l.insertAfter(Dg(d[e]|g[t]).append(zo()))}t.setRowSpan(1)}}function lp(e,t,n){const[r,i,o]=ap(e,t,n);return null===i&&$g(207),null===o&&$g(208),[r,i,o]}function ap(e,t,n){const r=[];let i=null,o=null;function s(e){let t=r[e];return void 0===t&&(r[e]=t=[]),t}const l=e.getChildren();for(let e=0;e<l.length;e++){const r=l[e];Wg(r)||$g(209);const a=s(e);for(let c=r.getFirstChild(),u=0;null!=c;c=c.getNextSibling()){for(Bg(c)||$g(147);void 0!==a[u];)u++;const r={cell:c,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:h}=c;for(let t=0;t<d&&!(e+t>=l.length);t++){const n=s(e+t);for(let e=0;e<h;e++)n[u+e]=r}null!==t&&null===i&&t.is(c)&&(i=r),null!==n&&null===o&&n.is(c)&&(o=r)}}return[r,i,o]}function cp(e){let t;if(e instanceof Ig)t=e;else if("__type"in e){const n=vl(e,Bg);Bg(n)||$g(148),t=n}else{const n=vl(e.getNode(),Bg);Bg(n)||$g(148),t=n}const n=t.getParent();Wg(n)||$g(149);const r=n.getParent();return of(r)||$g(210),[t,n,r]}function up(e,t,n){let r,i=Math.min(t.startColumn,n.startColumn),o=Math.min(t.startRow,n.startRow),s=Math.max(t.startColumn+t.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),l=Math.max(t.startRow+t.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{r=!1;for(let t=0;t<e.length;t++)for(let n=0;n<e[0].length;n++){const a=e[t][n];if(!a)continue;const c=a.startColumn+a.cell.__colSpan-1,u=a.startRow+a.cell.__rowSpan-1,d=a.startColumn<=s&&c>=i,h=a.startRow<=l&&u>=o;if(d&&h){const e=Math.min(i,a.startColumn),t=Math.max(s,c),n=Math.min(o,a.startRow),d=Math.max(l,u);e===i&&t===s&&n===o&&d===l||(i=e,s=t,o=n,l=d,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:i,minRow:o}}function dp(e){const[t,,n]=cp(e),r=n.getChildren(),i=r.length,o=r[0].getChildren().length,s=new Array(i);for(let e=0;e<i;e++)s[e]=new Array(o);for(let e=0;e<i;e++){const n=r[e].getChildren();let i=0;for(let r=0;r<n.length;r++){for(;s[e][i];)i++;const o=n[r],l=o.__rowSpan||1,a=o.__colSpan||1;for(let t=0;t<l;t++)for(let n=0;n<a;n++)s[e+t][i+n]=o;if(t===o)return{colSpan:a,columnIndex:i,rowIndex:e,rowSpan:l};i+=a}}return null}function hp(e){const[[t,n,r,i],[o,s,l,a]]=["anchor","focus"].map((t=>{const n=e[t].getNode(),r=vl(n,Bg);Bg(r)||$g(238,t,n.getKey(),n.getType());const i=r.getParent();Wg(i)||$g(239,t);const o=i.getParent();return of(o)||$g(240,t),[n,r,i,o]}));return i.is(a)||$g(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:i,focusCell:s,focusNode:o,focusRow:l,focusTable:a}}class gp{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if("root"===this.tableKey||"root"===this.anchor.key||"element"!==this.anchor.type||"root"===this.focus.key||"element"!==this.focus.type)return!1;const e=ms(this.tableKey),t=ms(this.anchor.key),n=ms(this.focus.key);return null!==e&&null!==t&&null!==n}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return pp(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new gp(this.tableKey,_i(this.anchor.key,this.anchor.offset,this.anchor.type),_i(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(Bg).forEach((e=>{const n=e.getFirstChild();$o(n)&&(t|=n.getTextFormat())}));return 0!==(t&Ke[e])}insertNodes(e){const t=this.focus.getNode();Eo(t)||$g(151),St(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=hp(this),n=dp(e);null===n&&$g(153);const r=dp(t);null===r&&$g(155);const i=Math.min(n.columnIndex,r.columnIndex),o=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),s=Math.min(n.rowIndex,r.rowIndex),l=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,o),fromY:Math.min(s,l),toX:Math.max(i,o),toY:Math.max(s,l)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(null!==e)return e;const{anchorTable:t,anchorCell:n,focusCell:r}=hp(this),i=r.getParents()[1];if(i!==t){if(t.isParentOf(r)){const e=i.getParent();null==e&&$g(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{const e=t.getParent();null==e&&$g(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}const[o,s,l]=lp(t,n,r),{minColumn:a,maxColumn:c,minRow:u,maxRow:d}=up(o,s,l),h=new Map([[t.getKey(),t]]);let g=null;for(let e=u;e<=d;e++)for(let t=a;t<=c;t++){const{cell:n}=o[e][t],r=n.getParent();Wg(r)||$g(160),r!==g&&(h.set(r.getKey(),r),g=r),h.has(n.getKey())||mp(n,(e=>{h.set(e.getKey(),e)}))}const p=Array.from(h.values());return oo()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter((e=>Bg(e)));let t="";for(let n=0;n<e.length;n++){const r=e[n],i=r.__parent,o=(e[n+1]||{}).__parent;t+=r.getTextContent()+(o!==i?"\n":"\t")}return t}}function pp(e){return e instanceof gp}function fp(e,t,n){e.getKey(),t.getKey(),n.getKey();const r=$i(),i=pp(r)?r.clone():function(){const e=_i("root",0,"element"),t=_i("root",0,"element");return new gp("root",e,t)}();return i.set(e.getKey(),t.getKey(),n.getKey()),i}function mp(e,t){const n=[[e]];for(let e=n.at(-1);void 0!==e&&n.length>0;e=n.at(-1)){const r=e.pop();void 0===r?n.pop():!1!==t(r)&&Eo(r)&&n.push(r.getChildren())}}function yp(e,t=fl()){const n=ms(e);of(n)||$g(231,e);const r=Cp(n,t.getElementByKey(e));return null===r&&$g(232,e),{tableElement:r,tableNode:n}}class bp{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;shouldCheckSelection;abortController;listenerOptions;nextFocus;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.nextFocus=null,this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return yp(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver((e=>{this.editor.getEditorState().read((()=>{let t=!1;for(let n=0;n<e.length;n++){const r=e[n].target.nodeName;if("TABLE"===r||"TBODY"===r||"THEAD"===r||"TR"===r){t=!0;break}}if(!t)return;const{tableNode:n,tableElement:r}=this.$lookup();this.table=Op(n,r)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{const{tableNode:t,tableElement:n}=this.$lookup();this.table=Op(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();const{tableNode:t,tableElement:n}=this.$lookup();Fp(e,Op(t,n),null),null!==$i()&&(vs(null),e.dispatchCommand(rn,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();Sa(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();Ca(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(null!==e){e.tableKey!==this.tableNodeKey&&$g(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Fp(t,this.table,this.tableSelection)}else this.$clearHighlight()}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return!!this.shouldCheckSelection&&(this.shouldCheckSelection=!1,!0)}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return null!==e&&(this.nextFocus=null),e}updateDOMSelection(){if(null!==this.anchorCell&&null!==this.focusCell){const e=ll(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const n=this.editor,{tableNode:r}=this.$lookup(),i=e.x,o=e.y;if(this.focusCell=e,this.isHighlightingCells||(t||this.anchorX!==i||this.anchorY!==o||null!=this.tableSelection&&null!=this.anchorCellNodeKey)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),-1!==this.focusX&&-1!==this.focusY&&i===this.focusX&&o===this.focusY)return!1;if(this.focusX=i,this.focusY=o,this.isHighlightingCells){const s=Jp(r,e.elem);if(null!=this.tableSelection&&null!=this.anchorCellNodeKey){let e=s;if(null===e&&t&&(e=r.getCellNodeFromCords(i,o,this.table)),null!==e){const t=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=e.getKey(),this.tableSelection=fp(r,t,e),vs(this.tableSelection),n.dispatchCommand(rn,void 0),Fp(n,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?ms(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return null===e&&$g(234),e}$getFocusTableCell(){return this.focusCellNodeKey?ms(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return null===e&&$g(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;const{tableNode:t}=this.$lookup(),n=Jp(t,e.elem);if(null!==n){const e=n.getKey();null!=this.tableSelection?(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),e,e)):this.tableSelection=fp(t,n,n),this.anchorCellNodeKey=e}}$formatCells(e){const t=$i();pp(t)||$g(236);const n=Di(),r=n.anchor,i=n.focus,o=t.getNodes().filter(Bg);o.length>0||$g(237);const s=o[0].getFirstChild(),l=$o(s)?s.getFormatFlags(e,null):null;o.forEach((t=>{r.set(t.getKey(),0,"element"),i.set(t.getKey(),t.getChildrenSize(),"element"),n.formatText(e,l)})),vs(t),this.editor.dispatchCommand(rn,void 0)}$clearText(){const{editor:e}=this,t=ms(this.tableNodeKey);if(!of(t))throw new Error("Expected TableNode.");const n=$i();pp(n)||$g(253);const r=n.getNodes().filter(Bg),i=t.getFirstChild(),o=t.getLastChild();if(r.length>0&&null!==i&&null!==o&&Wg(i)&&Wg(o)&&r[0]===i.getFirstChild()&&r[r.length-1]===o.getLastChild()){t.selectPrevious();const n=t.getParent();return t.remove(),void(Oo(n)&&n.isEmpty()&&e.dispatchCommand(gn,void 0))}r.forEach((e=>{if(Eo(e)){const t=zo(),n=hi();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),Fp(e,this.table,null),vs(null),e.dispatchCommand(rn,void 0)}}const _p="__lexicalTableSelection";function xp(e){return cl(e)&&"TABLE"===e.nodeName}function Cp(e,t){if(!t)return t;const n=xp(t)?t:e.getDOMSlot(t).element;return"TABLE"!==n.nodeName&&$g(245,t.nodeName),n}function Sp(e){return e._window}function wp(e,t){for(let n=t,r=null;null!==n;n=n.getParent()){if(e.is(n))return r;Bg(n)&&(r=n)}return null}const vp=[[Nn,"down"],[Tn,"up"],[kn,"backward"],[wn,"forward"]],kp=[yn,bn,dn],Ep=[On,Rn];function Tp(e,t,n,r){const i=n.getRootElement(),o=Sp(n);null!==i&&null!==o||$g(246);const s=new bp(n,e.getKey()),l=Cp(e,t);!function(e,t){null!==Np(e)&&$g(205),e[_p]=t}(l,s),s.listenersToRemove.add((()=>function(e,t){Np(e)===t&&delete e[_p]}(l,s)));const a=t=>{if(s.pointerType=t.pointerType,0!==t.button||!ul(t.target)||!o)return;const r=Ap(t.target);null!==r&&n.update((()=>{const n=Hi();if(qg&&t.shiftKey&&zp(n,e)&&(wi(n)||pp(n))){const i=n.anchor.getNode(),o=wp(e,n.anchor.getNode());o?(s.$setAnchorCellForSelection(Gp(s,o)),s.$setFocusCellForSelection(r),jp(t)):(e.isBefore(i)?e.selectStart():e.selectEnd()).anchor.set(n.anchor.key,n.anchor.offset,n.anchor.type)}else"touch"!==t.pointerType&&s.$setAnchorCellForSelection(r)})),(e=>{if(s.isSelecting)return;s.isSelecting=!0,null!==e&&null===s.anchorCell&&n.update((()=>{s.$setAnchorCellForSelection(e)}));const t=()=>{s.isSelecting=!1,o.removeEventListener("pointerup",t),o.removeEventListener("pointermove",r)},r=e=>{if(1&~e.buttons&&s.isSelecting)return s.isSelecting=!1,o.removeEventListener("pointerup",t),void o.removeEventListener("pointermove",r);if(!ul(e.target))return;let i=null;const a=!(qg||l.contains(e.target));if(a)i=Lp(l,e.target);else for(const t of document.elementsFromPoint(e.clientX,e.clientY))if(i=Lp(l,t),i)break;if(i){const e=i;null===s.anchorCell&&n.update((()=>{s.$setAnchorCellForSelection(e)})),null!==s.focusCell&&i.elem===s.focusCell.elem||(s.setNextFocus({focusCell:i,override:a}),n.dispatchCommand(rn,void 0))}};o.addEventListener("pointerup",t,s.listenerOptions),o.addEventListener("pointermove",r,s.listenerOptions)})(r)};l.addEventListener("pointerdown",a,s.listenerOptions),s.listenersToRemove.add((()=>{l.removeEventListener("pointerdown",a)}));const c=e=>{e.detail>=3&&ul(e.target)&&null!==Ap(e.target)&&e.preventDefault()};l.addEventListener("mousedown",c,s.listenerOptions),s.listenersToRemove.add((()=>{l.removeEventListener("mousedown",c)}));const u=e=>{const t=e.target;0===e.button&&ul(t)&&n.update((()=>{const e=$i();pp(e)&&e.tableKey===s.tableNodeKey&&i.contains(t)&&s.$clearHighlight()}))};o.addEventListener("pointerdown",u,s.listenerOptions),s.listenersToRemove.add((()=>{o.removeEventListener("pointerdown",u)}));for(const[t,r]of vp)s.listenersToRemove.add(n.registerCommand(t,(t=>Vp(n,t,r,e,s)),3));s.listenersToRemove.add(n.registerCommand(Fn,(t=>{const n=$i();if(pp(n)){const r=wp(e,n.focus.getNode());if(null!==r)return jp(t),r.selectEnd(),!0}return!1}),3));const d=t=>()=>{const n=$i();if(!zp(n,e))return!1;if(pp(n))return s.$clearText(),!0;if(wi(n)){if(!Bg(wp(e,n.anchor.getNode())))return!1;const r=n.anchor.getNode(),i=n.focus.getNode(),o=e.isParentOf(r),l=e.isParentOf(i);if(o&&!l||l&&!o)return s.$clearText(),!0;const a=vl(n.anchor.getNode(),(e=>Eo(e))),c=a&&vl(a,(e=>Eo(e)&&Bg(e.getParent())));if(!Eo(c)||!Eo(a))return!1;if(t===bn&&null===c.getPreviousSibling())return!0}return!1};for(const e of kp)s.listenersToRemove.add(n.registerCommand(e,d(e),3));const h=t=>{const n=$i();if(!pp(n)&&!wi(n))return!1;const r=e.isParentOf(n.anchor.getNode());if(r!==e.isParentOf(n.focus.getNode())){const t=r?"anchor":"focus",i=r?"focus":"anchor",{key:o,offset:s,type:l}=n[i];return e[n[t].isBefore(n[i])?"selectPrevious":"selectNext"]()[i].set(o,s,l),!1}return!!zp(n,e)&&!!pp(n)&&(t&&(t.preventDefault(),t.stopPropagation()),s.$clearText(),!0)};for(const e of Ep)s.listenersToRemove.add(n.registerCommand(e,h,3));return s.listenersToRemove.add(n.registerCommand(Wn,(e=>{const t=$i();if(t){if(!pp(t)&&!wi(t))return!1;Cd(n,Nc(e,ClipboardEvent)?e:null,vd(t));const r=h(e);return wi(t)?(t.removeText(),!0):r}return!1}),3)),s.listenersToRemove.add(n.registerCommand(_n,(t=>{const n=$i();if(!zp(n,e))return!1;if(pp(n))return s.$formatCells(t),!0;if(wi(n)){const e=vl(n.anchor.getNode(),(e=>Bg(e)));if(!Bg(e))return!1}return!1}),3)),s.listenersToRemove.add(n.registerCommand(zn,(t=>{const n=$i();if(!pp(n)||!zp(n,e))return!1;const r=n.anchor.getNode(),i=n.focus.getNode();if(!Bg(r)||!Bg(i))return!1;if(function(e,t){if(pp(e)){const n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){const[e]=lp(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(n,e))return e.setFormat(t),!0;const[o,s,l]=lp(e,r,i),a=Math.max(s.startRow+s.cell.__rowSpan-1,l.startRow+l.cell.__rowSpan-1),c=Math.max(s.startColumn+s.cell.__colSpan-1,l.startColumn+l.cell.__colSpan-1),u=Math.min(s.startRow,l.startRow),d=Math.min(s.startColumn,l.startColumn),h=new Set;for(let e=u;e<=a;e++)for(let n=d;n<=c;n++){const r=o[e][n].cell;if(h.has(r))continue;h.add(r),r.setFormat(t);const i=r.getChildren();for(let e=0;e<i.length;e++){const n=i[e];Eo(n)&&!n.isInline()&&n.setFormat(t)}}return!0}),3)),s.listenersToRemove.add(n.registerCommand(pn,(t=>{const r=$i();if(!zp(r,e))return!1;if(pp(r))return s.$clearHighlight(),!1;if(wi(r)){const i=vl(r.anchor.getNode(),(e=>Bg(e)));if(!Bg(i))return!1;if("string"==typeof t){const i=Zp(n,r,e);if(i)return qp(i,e,[hi(t)]),!0}}return!1}),3)),r&&s.listenersToRemove.add(n.registerCommand(In,(t=>{const n=$i();if(!wi(n)||!n.isCollapsed()||!zp(n,e))return!1;const r=Up(n.anchor.getNode());return!(null===r||!e.is(Wp(r))||(jp(t),function(e,t){const n="next"===t?"getNextSibling":"getPreviousSibling",r="next"===t?"getFirstChild":"getLastChild",i=e[n]();if(Eo(i))return i.selectEnd();const o=vl(e,Wg);null===o&&$g(247);for(let e=o[n]();Wg(e);e=e[n]()){const t=e[r]();if(Eo(t))return t.selectEnd()}const s=vl(o,of);null===s&&$g(248),"next"===t?s.selectNext():s.selectPrevious()}(r,t.shiftKey?"previous":"next"),0))}),3)),s.listenersToRemove.add(n.registerCommand(Jn,(t=>e.isSelected()),3)),s.listenersToRemove.add(n.registerCommand(rn,(()=>{const t=$i(),r=Hi(),i=s.getAndClearNextFocus();if(null!==i){const{focusCell:e}=i;if(pp(t)&&t.tableKey===s.tableNodeKey)return(e.x!==s.focusX||e.y!==s.focusY)&&(s.$setFocusCellForSelection(e),!0);if(e!==s.anchorCell&&null!==s.anchorCell&&null!==s.anchorCellNodeKey&&null!==s.tableSelection)return s.$setFocusCellForSelection(e,!0),!0}if(s.getAndClearShouldCheckSelection()&&wi(r)&&wi(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=e.getFirstChild(),i=Up(n);if(null!==i&&Wg(r)){const t=r.getFirstChild();if(Bg(t)&&e.is(vl(i,(n=>n.is(e)||n.is(t)))))return t.selectStart(),!0}}if(wi(t)){const{anchor:i,focus:o}=t,l=i.getNode(),a=o.getNode(),c=Up(l),u=Up(a),d=!(!c||!e.is(Wp(c))),h=!(!u||!e.is(Wp(u))),g=d!==h,p=d&&h,f=t.isBackward();if(g){const r=t.clone();if(h){const[t]=lp(e,u,u),n=t[0][0].cell,i=t[t.length-1].at(-1).cell;r.focus.set(f?n.getKey():i.getKey(),f?0:i.getChildrenSize(),"element")}else if(d){const[t]=lp(e,c,c),n=t[0][0].cell,i=t[t.length-1].at(-1).cell;r.anchor.set(f?i.getKey():n.getKey(),f?i.getChildrenSize():0,"element")}vs(r),Ip(n,s)}else if(p&&(c.is(u)||(s.$setAnchorCellForSelection(Gp(s,c)),s.$setFocusCellForSelection(Gp(s,u),!0)),"touch"===s.pointerType&&s.isSelecting&&t.isCollapsed()&&wi(r)&&r.isCollapsed())){const e=Up(r.anchor.getNode());e&&!e.is(u)&&(s.$setAnchorCellForSelection(Gp(s,e)),s.$setFocusCellForSelection(Gp(s,u),!0),s.pointerType=null)}}else if(t&&pp(t)&&t.is(r)&&t.tableKey===e.getKey()){const r=ll(o);if(r&&r.anchorNode&&r.focusNode){const i=_s(r.focusNode),o=i&&!e.isParentOf(i),s=_s(r.anchorNode),l=s&&e.isParentOf(s);if(o&&l&&r.rangeCount>0){const i=function(e,t){return zi(null,e,t,null)}(r,n);i&&(i.anchor.set(e.getKey(),t.isBackward()?e.getChildrenSize():0,"element"),r.removeAllRanges(),vs(i))}}}return t&&!t.is(r)&&(pp(t)||pp(r))&&s.tableSelection&&!s.tableSelection.is(r)?(pp(t)&&t.tableKey===s.tableNodeKey?s.$updateTableTableSelection(t):!pp(t)&&pp(r)&&r.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!e.isSelected()?function(e,t){t.$enableHighlightStyle(),Rp(t.table,(t=>{const n=t.elem;t.highlighted=!1,Kp(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(n,s):!s.hasHijackedSelectionStyles&&e.isSelected()&&Ip(n,s),!1)}),3)),s.listenersToRemove.add(n.registerCommand(gn,(()=>{const t=$i();if(!wi(t)||!t.isCollapsed()||!zp(t,e))return!1;const r=Zp(n,t,e);return!!r&&(qp(r,e),!0)}),3)),s}function Np(e){return e[_p]||null}function Ap(e){let t=e;for(;null!=t;){const e=t.nodeName;if("TD"===e||"TH"===e){const e=t._cell;return void 0===e?null:e}t=t.parentNode}return null}function Lp(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;null!=r;r=r.parentNode){if(r===e)return n;const t=r.nodeName;"TD"!==t&&"TH"!==t||(n=r._cell||null)}return null}function Op(e,t){const n=[],r={columns:0,domRows:n,rows:0};let i=Cp(e,t).querySelector("tr"),o=0,s=0;for(n.length=0;null!=i;){const e=i.nodeName;if("TD"===e||"TH"===e){const e={elem:i,hasBackgroundColor:""!==i.style.backgroundColor,highlighted:!1,x:o,y:s};i._cell=e;let t=n[s];void 0===t&&(t=n[s]=[]),t[o]=e}else{const e=i.firstChild;if(null!=e){i=e;continue}}const t=i.nextSibling;if(null!=t){o++,i=t;continue}const r=i.parentNode;if(null!=r){const e=r.nextSibling;if(null==e)break;s++,o=0,i=e}}return r.columns=o+1,r.rows=s+1,r}function Fp(e,t,n){const r=new Set(n?n.getNodes():[]);Rp(t,((t,n)=>{const i=t.elem;r.has(n)?(t.highlighted=!0,Hp(e,t)):(t.highlighted=!1,Kp(e,t),i.getAttribute("style")||i.removeAttribute("style"))}))}function Rp(e,t){const{domRows:n}=e;for(let e=0;e<n.length;e++){const r=n[e];if(r)for(let n=0;n<r.length;n++){const i=r[n];if(!i)continue;const o=_s(i.elem);null!==o&&t(i,o,{x:n,y:e})}}}function Ip(e,t){t.$disableHighlightStyle(),Rp(t.table,(t=>{t.highlighted=!0,Hp(e,t)}))}const Pp=(e,t,n,r,i)=>{const o="forward"===i;switch(i){case"backward":case"forward":return n!==(o?e.table.columns-1:0)?$p(t.getCellNodeFromCordsOrThrow(n+(o?1:-1),r,e.table),o):r!==(o?e.table.rows-1:0)?$p(t.getCellNodeFromCordsOrThrow(o?0:e.table.columns-1,r+(o?1:-1),e.table),o):o?t.selectNext():t.selectPrevious(),!0;case"up":return 0!==r?$p(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1):t.selectPrevious(),!0;case"down":return r!==e.table.rows-1?$p(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0):t.selectNext(),!0;default:return!1}};function Mp(e,t){let n,r;if(t.startColumn===e.minColumn)n="minColumn";else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n="maxColumn"}if(t.startRow===e.minRow)r="minRow";else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r="maxRow"}return[n,r]}function Dp([e,t]){return["minColumn"===e?"maxColumn":"minColumn","minRow"===t?"maxRow":"minRow"]}function Bp(e,t,[n,r]){const i=t[r],o=e[i];void 0===o&&$g(250,r,String(i));const s=t[n],l=o[s];return void 0===l&&$g(250,n,String(s)),l}function zp(e,t){if(wi(e)||pp(e)){const n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function $p(e,t){t?e.selectStart():e.selectEnd()}function Hp(e,t){const n=t.elem,r=e._config.theme;Bg(_s(n))||$g(131),Ca(n,r.tableCellSelected)}function Kp(e,t){const n=t.elem;Bg(_s(n))||$g(131);Sa(n,e._config.theme.tableCellSelected)}function Up(e){const t=vl(e,Bg);return Bg(t)?t:null}function Wp(e){const t=vl(e,of);return of(t)?t:null}function Vp(e,t,n,r,i){if(("up"===n||"down"===n)&&function(e){const t=e.getRootElement();return!!t&&(t.hasAttribute("aria-controls")&&"typeahead-menu"===t.getAttribute("aria-controls"))}(e))return!1;const o=$i();if(!zp(o,r)){if(wi(o)){if("backward"===n){if(o.focus.offset>0)return!1;const e=function(e){for(let t=e,n=e;null!==n;t=n,n=n.getParent())if(Eo(n)){if(n!==t&&n.getFirstChild()!==t)return null;if(!n.isInline())return n}return null}(o.focus.getNode());if(!e)return!1;const n=e.getPreviousSibling();return!!of(n)&&(jp(t),t.shiftKey?o.focus.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent(),"element"):n.selectEnd(),!0)}if(t.shiftKey&&("up"===n||"down"===n)){const e=o.focus.getNode();if(!o.isCollapsed()&&("up"===n&&!o.isBackward()||"down"===n&&o.isBackward())){let i=vl(e,(e=>of(e)));if(Bg(i)&&(i=vl(i,of)),i!==r)return!1;if(!i)return!1;const s="down"===n?i.getNextSibling():i.getPreviousSibling();if(!s)return!1;let l=0;"up"===n&&Eo(s)&&(l=s.getChildrenSize());let a=s;if("up"===n&&Eo(s)){a=s.getLastChild()||s,l=gi(a)?a.getTextContentSize():0}const c=o.clone();return c.focus.set(a.getKey(),l,gi(a)?"text":"element"),vs(c),jp(t),!0}if(tl(e)){const e="up"===n?o.getNodes()[o.getNodes().length-1]:o.getNodes()[0];if(e&&null!==wp(r,e)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=cp(e),[o]=cp(t),s=r.getCordsFromCellNode(n,i.table),l=r.getCordsFromCellNode(o,i.table),a=r.getDOMCellFromCordsOrThrow(s.x,s.y,i.table),c=r.getDOMCellFromCordsOrThrow(l.x,l.y,i.table);return i.$setAnchorCellForSelection(a),i.$setFocusCellForSelection(c,!0),!0}return!1}{let r=vl(e,(e=>Eo(e)&&!e.isInline()));if(Bg(r)&&(r=vl(r,of)),!r)return!1;const s="down"===n?r.getNextSibling():r.getPreviousSibling();if(of(s)&&i.tableNodeKey===s.getKey()){const e=s.getFirstDescendant(),r=s.getLastDescendant();if(!e||!r)return!1;const[i]=cp(e),[l]=cp(r),a=o.clone();return a.focus.set(("up"===n?i:l).getKey(),"up"===n?0:l.getChildrenSize(),"element"),jp(t),vs(a),!0}}}}return"down"===n&&Qp(e)&&i.setShouldCheckSelection(),!1}if(wi(o)){if("backward"===n||"forward"===n)return function(e,t,n,r,i,o,s){const l=na(n.focus,i?"previous":"next");if(ha(l))return!1;let a=l;for(const e of ql(l).iterNodeCarets("shadowRoot")){if(!Il(e)||!Eo(e.origin))return!1;a=e}const c=a.getParentAtCaret();if(!Bg(c))return!1;const u=c,d=function(e){for(const t of ql(e).iterNodeCarets("root")){const{origin:n}=t;if(Bg(n)){if(Pl(t))return Ul(n,e.direction)}else if(!Wg(n))break}return null}(zl(u,a.direction)),h=vl(u,of);if(!h||!h.is(o))return!1;const g=e.getElementByKey(u.getKey()),p=Ap(g);if(!g||!p)return!1;const f=tf(e,h);if(s.table=f,d)if("extend"===r){const t=Ap(e.getElementByKey(d.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(t,!0)}else{const e=da(d);ra(n.anchor,e),ra(n.focus,e)}else if("extend"===r)s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(p,!0);else{const e=function(e){const t=Wl(e);return Pl(t)?da(t):e}(zl(h,l.direction));ra(n.anchor,e),ra(n.focus,e)}return jp(t),!0}(e,t,o,t.shiftKey?"extend":"move","backward"===n,r,i);if(o.isCollapsed()){const{anchor:s,focus:l}=o,a=vl(s.getNode(),Bg),c=vl(l.getNode(),Bg);if(!Bg(a)||!a.is(c))return!1;const u=Wp(a);if(u!==r&&null!=u){const r=Cp(u,e.getElementByKey(u.getKey()));if(null!=r)return i.table=Op(u,r),Vp(e,t,n,u,i)}const d=e.getElementByKey(a.__key),h=e.getElementByKey(s.key);if(null==h||null==d)return!1;let g;if("element"===s.type)g=h.getBoundingClientRect();else{const t=ll(Sp(e));if(null===t||0===t.rangeCount)return!1;g=t.getRangeAt(0).getBoundingClientRect()}const p="up"===n?a.getFirstChild():a.getLastChild();if(null==p)return!1;const f=e.getElementByKey(p.__key);if(null==f)return!1;const m=f.getBoundingClientRect();if("up"===n?m.top>g.top-g.height:g.bottom+g.height>m.bottom){jp(t);const e=r.getCordsFromCellNode(a,i.table);if(!t.shiftKey)return Pp(i,r,e.x,e.y,n);{const t=r.getDOMCellFromCordsOrThrow(e.x,e.y,i.table);i.$setAnchorCellForSelection(t),i.$setFocusCellForSelection(t,!0)}return!0}}}else if(pp(o)){const{anchor:s,focus:l}=o,a=vl(s.getNode(),Bg),c=vl(l.getNode(),Bg),[u]=o.getNodes();of(u)||$g(251);const d=Cp(u,e.getElementByKey(u.getKey()));if(!Bg(a)||!Bg(c)||!of(u)||null==d)return!1;i.$updateTableTableSelection(o);const h=Op(u,d),g=r.getCordsFromCellNode(a,h),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,h);if(i.$setAnchorCellForSelection(p),jp(t),t.shiftKey){const[e,t,o]=lp(r,a,c);return function(e,t,n,r,i){const o=up(t,n,r),s=function(e,t){const{minColumn:n,maxColumn:r,minRow:i,maxRow:o}=t;let s=1,l=1,a=1,c=1;const u=e[i],d=e[o];for(let e=n;e<=r;e++)s=Math.max(s,u[e].cell.__rowSpan),c=Math.max(c,d[e].cell.__rowSpan);for(let t=i;t<=o;t++)l=Math.max(l,e[t][n].cell.__colSpan),a=Math.max(a,e[t][r].cell.__colSpan);return{bottomSpan:c,leftSpan:l,rightSpan:a,topSpan:s}}(t,o),{topSpan:l,leftSpan:a,bottomSpan:c,rightSpan:u}=s,d=function(e,t){const n=Mp(e,t);return null===n&&$g(249,t.cell.getKey()),n}(o,n),[h,g]=Dp(d);let p=o[h],f=o[g];"forward"===i?p+="maxColumn"===h?1:a:"backward"===i?p-="minColumn"===h?1:u:"down"===i?f+="maxRow"===g?1:l:"up"===i&&(f-="minRow"===g?1:c);const m=t[f];if(void 0===m)return!1;const y=m[p];if(void 0===y)return!1;const[b,_]=function(e,t,n){const r=up(e,t,n),i=Mp(r,t);if(i)return[Bp(e,r,i),Bp(e,r,Dp(i))];const o=Mp(r,n);if(o)return[Bp(e,r,Dp(o)),Bp(e,r,o)];const s=["minColumn","minRow"];return[Bp(e,r,s),Bp(e,r,Dp(s))]}(t,n,y),x=Gp(e,b.cell),C=Gp(e,_.cell);return e.$setAnchorCellForSelection(x),e.$setFocusCellForSelection(C,!0),!0}(i,e,t,o,n)}return c.selectEnd(),!0}return!1}function jp(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function qp(e,t,n){const r=zo();"first"===e?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function Zp(e,t,n){const r=n.getParent();if(!r)return;const i=ll(Sp(e));if(!i)return;const o=i.anchorNode,s=e.getElementByKey(r.getKey()),l=Cp(n,e.getElementByKey(n.getKey()));if(!o||!s||!l||!s.contains(o)||l.contains(o))return;const a=vl(t.anchor.getNode(),(e=>Bg(e)));if(!a)return;const c=vl(a,(e=>of(e)));if(!of(c)||!c.is(n))return;const[u,d]=lp(n,a,a),h=u[0][0],g=u[u.length-1][u[0].length-1],{startRow:p,startColumn:f}=d,m=p===h.startRow&&f===h.startColumn,y=p===g.startRow&&f===g.startColumn;return m?"first":y?"last":void 0}function Gp(e,t){const{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function Jp(e,t,n){return wp(e,_s(t,n))}function Yp(e,t,n){if(!t.theme.tableAlignment)return;const r=[],i=[];for(const e of["center","right"]){const o=t.theme.tableAlignment[e];o&&(e===n?i:r).push(o)}Sa(e,...r),Ca(e,...i)}const Xp=new WeakSet;function Qp(e=fl()){return Xp.has(e)}class ef extends ko{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new ef(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:nf,priority:1})}}static importJSON(e){return rf().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return"html"===n}getDOMSlot(e){const t=xp(e)?e:e.querySelector("table");return xp(t)||$g(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const n=document.createElement("table");this.__style&&(n.style.cssText=this.__style);const r=document.createElement("colgroup");if(n.appendChild(r),function(e){e.__lexicalUnmanaged=!0}(r),Ca(n,e.theme.table),this.updateTableElement(null,n,e),Qp(t)){const t=document.createElement("div"),r=e.theme.tableScrollableWrapper;return r?Ca(t,r):t.style.cssText="overflow-x: auto;",t.appendChild(n),this.updateTableWrapper(null,t,n,e),t}return n}updateTableWrapper(e,t,n,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,t,n,r){r>0?(Ca(e,n.theme.tableFrozenColumn),t.setAttribute("data-lexical-frozen-column","true")):(Sa(e,n.theme.tableFrozenColumn),t.removeAttribute("data-lexical-frozen-column"))}(t,n,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,t,n,r){r>0?(Ca(e,n.theme.tableFrozenRow),t.setAttribute("data-lexical-frozen-row","true")):(Sa(e,n.theme.tableFrozenRow),t.removeAttribute("data-lexical-frozen-row"))}(t,n,r,this.__frozenRowCount)}updateTableElement(e,t,n){this.__style!==(e?e.__style:"")&&(t.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,t,n){n?(Ca(e,t.theme.tableRowStriping),e.setAttribute("data-lexical-row-striping","true")):(Sa(e,t.theme.tableRowStriping),e.removeAttribute("data-lexical-row-striping"))}(t,n,this.__rowStriping),function(e,t,n,r){const i=e.querySelector("colgroup");if(!i)return;const o=[];for(let e=0;e<n;e++){const t=document.createElement("col"),n=r&&r[e];n&&(t.style.width=`${n}px`),o.push(t)}i.replaceChildren(...o)}(t,0,this.getColumnCount(),this.getColWidths()),Yp(t,n,this.getFormatType())}updateDOM(e,t,n){const r=this.getDOMSlot(t).element;return t===r===Qp()||(cl(i=t)&&"DIV"===i.nodeName&&this.updateTableWrapper(e,t,r,n),this.updateTableElement(e,r,n),!1);var i}exportDOM(e){const t=super.exportDOM(e),{element:n}=t;return{after:n=>{if(t.after&&(n=t.after(n)),!xp(n)&&cl(n)&&(n=n.querySelector("table")),!xp(n))return null;Yp(n,e._config,this.getFormatType());const[r]=ap(this,null,null),i=new Map;for(const e of r)for(const t of e){const e=t.cell.getKey();i.has(e)||i.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}const o=new Set;for(const e of n.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const t=e.getAttribute("data-temporary-table-cell-lexical-key");if(t){const n=i.get(t);if(e.removeAttribute("data-temporary-table-cell-lexical-key"),n){i.delete(t);for(let e=0;e<n.colSpan;e++)o.add(e+n.startColumn)}}}const s=n.querySelector(":scope > colgroup");if(s){const e=Array.from(n.querySelectorAll(":scope > colgroup > col")).filter(((e,t)=>o.has(t)));s.replaceChildren(...e)}const l=n.querySelectorAll(":scope > tr");if(l.length>0){const e=document.createElement("tbody");for(const t of l)e.appendChild(t);n.append(e)}return n},element:!xp(n)&&cl(n)?n.querySelector("table"):n}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:n,domRows:r}=t;for(let t=0;t<n;t++){const n=r[t];if(null!=n)for(let r=0;r<n.length;r++){const i=n[r];if(null==i)continue;const{elem:o}=i,s=Jp(this,o);if(null!==s&&e.is(s))return{x:r,y:t}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,n){const{domRows:r}=n,i=r[t];if(null==i)return null;const o=i[e<i.length?e:i.length-1];return null==o?null:o}getDOMCellFromCordsOrThrow(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,t,n){const r=this.getDOMCellFromCords(e,t,n);if(null==r)return null;const i=_s(r.elem);return Bg(i)?i:null}getCellNodeFromCordsOrThrow(e,t,n){const r=this.getCellNodeFromCords(e,t,n);if(!r)throw new Error("Node at cords not TableCellNode.");return r}getRowStriping(){return Boolean(this.getLatest().__rowStriping)}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach((e=>{Bg(e)&&(t+=e.getColSpan())})),t}}function tf(e,t){const n=e.getElementByKey(t.getKey());return null===n&&$g(230),Op(t,n)}function nf(e){const t=rf();e.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0),e.hasAttribute("data-lexical-frozen-column")&&t.setFrozenColumns(1),e.hasAttribute("data-lexical-frozen-row")&&t.setFrozenRows(1);const n=e.querySelector(":scope > colgroup");if(n){let e=[];for(const t of n.querySelectorAll(":scope > col")){let n=t.style.width||"";if(!Ag.test(n)&&(n=t.getAttribute("width")||"",!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>Rc(e,Wg),node:t}}function rf(){return rl(new ef)}function of(e){return e instanceof ef}function sf(e){Wg(e.getParent())?e.isEmpty()&&e.append(zo()):e.remove()}function lf(e){of(e.getParent())?Oc(e,Bg):e.remove()}function af(e){Oc(e,Wg);const[t]=ap(e,null,null),n=t.reduce(((e,t)=>Math.max(e,t.length)),0),r=e.getChildren();for(let e=0;e<t.length;++e){const i=r[e];if(!i)continue;Wg(i)||$g(254,i.constructor.name,i.getType());const o=t[e].reduce(((e,t)=>t?1+e:e),0);if(o!==n)for(let e=o;e<n;++e){const e=Dg();e.append(zo()),i.append(e)}}const i=e.getColWidths(),o=e.getColumnCount();if(i&&i.length!==o){let t;if(o<i.length)t=i.slice(0,o);else if(i.length>0){const e=i[i.length-1];t=[...i,...Array(o-i.length).fill(e)]}e.setColWidths(t)}}function cf(e){if(e.detail<3||!ul(e.target))return!1;const t=_s(e.target);if(null===t)return!1;const n=vl(t,(e=>Eo(e)&&!e.isInline()));return null!==n&&(!!Bg(n.getParent())&&(n.select(0),!0))}function uf(){const e=$i();if(!wi(e))return!1;const t=Wp(e.anchor.getNode());if(null===t)return!1;const n=Ss();if(!n.is(t.getParent())||1!==n.getChildrenSize())return!1;const[r]=ap(t,null,null);if(0===r.length||0===r[0].length)return!1;const i=r[0][0];if(!i||!i.cell)return!1;const o=r[r.length-1],s=o[o.length-1];if(!s||!s.cell)return!1;return vs(fp(t,i.cell,s.cell)),!0}function df(e,t){e.hasNodes([ef])||$g(255);const{hasNestedTables:n=qc(!1),hasFitNestedTables:r=qc(!1)}={};return wa(e.registerCommand(zg,(e=>function({rows:e,columns:t,includeHeaders:n},r){const i=$i()||Hi();if(!i||!wi(i))return!1;if(!r&&Wp(i.anchor.getNode()))return!1;const o=function(e,t,n=!0){const r=rf();for(let i=0;i<e;i++){const e=Ug();for(let r=0;r<t;r++){let t=Fg;"object"==typeof n?(0===i&&n.rows&&(t|=Rg),0===r&&n.columns&&(t|=Og)):n&&(0===i&&(t|=Rg),0===r&&(t|=Og));const o=Dg(t),s=zo();s.append(hi()),o.append(s),e.append(o)}r.append(e)}return r}(Number(e),Number(t),n);Ec(o);const s=o.getFirstDescendant();return gi(s)&&s.select(),!0}(e,n.peek())),0),e.registerCommand(on,((t,i)=>e===i&&function(e,t,n){const{nodes:r,selection:i}=e;if(!r.some((e=>of(e)||wc(e).some((e=>of(e.node))))))return!1;const o=pp(i),s=wi(i);return!!(s&&null!==vl(i.anchor.getNode(),(e=>Bg(e)))&&null!==vl(i.focus.getNode(),(e=>Bg(e)))||o)&&(1===r.length&&of(r[0])?function(e,t){const n=t.getStartEndPoints(),r=pp(t);if(null===n)return!1;const[i,o]=n,[s,l,a]=cp(i),c=vl(o.getNode(),(e=>Bg(e)));if(!(Bg(s)&&Bg(c)&&Wg(l)&&of(a)))return!1;const[u,d,h]=lp(a,s,c),[g]=ap(e,null,null),p=u.length,f=p>0?u[0].length:0;let m=d.startRow,y=d.startColumn,b=g.length,_=b>0?g[0].length:0;if(r){const e=up(u,d,h),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;m=e.minRow,y=e.minColumn,b=Math.min(b,t),_=Math.min(_,n)}let x=!1;const C=Math.min(p,m+b)-1,S=Math.min(f,y+_)-1,w=new Set;for(let e=m;e<=C;e++)for(let t=y;t<=S;t++){const n=u[e][t];w.has(n.cell.getKey())||1===n.cell.__rowSpan&&1===n.cell.__colSpan||(sp(n.cell),w.add(n.cell.getKey()),x=!0)}let[v]=ap(a.getWritable(),null,null);const k=b-p+m;for(let e=0;e<k;e++)Qg(v[p-1][0].cell);const E=_-f+y;for(let e=0;e<E;e++)tp(v[0][f-1].cell,!0,!1);[v]=ap(a.getWritable(),null,null);for(let e=m;e<m+b;e++)for(let t=y;t<y+_;t++){const n=e-m,r=t-y,i=g[n][r];if(i.startRow!==n||i.startColumn!==r)continue;const o=i.cell;if(1!==o.__rowSpan||1!==o.__colSpan){const n=[],r=Math.min(e+o.__rowSpan,m+b)-1,i=Math.min(t+o.__colSpan,y+_)-1;for(let o=e;o<=r;o++)for(let e=t;e<=i;e++){const t=v[o][e];n.push(t.cell)}ip(n),x=!0}const{cell:s}=v[e][t],l=o.getBackgroundColor();null!=l&&s.setBackgroundColor(l);const a=s.getChildren();o.getChildren().forEach((e=>{gi(e)?(zo().append(e),s.append(e)):s.append(e)})),a.forEach((e=>e.remove()))}if(r&&x){const[e]=ap(a.getWritable(),null,null);e[d.startRow][d.startColumn].cell.selectEnd()}return!0}(r[0],i):!s||!t.peek()||function(e,t,n){const r=pp(t)&&!t.focus.getNode().is(t.anchor.getNode()),i=wi(t)&&Bg(t.anchor.getNode())&&!t.anchor.getNode().is(t.focus.getNode());if(r||i)return!0;if(!n)return!1;const o=t.focus.getNode(),s=vl(o,Bg);if(!s)return!1;const l=hf(s);if(void 0===l)return!1;const a=function(e){const t=fl().getElementByKey(e.getKey());if(null===t)return 0;const n=window.getComputedStyle(t),r=n.getPropertyValue("padding-left")||"0px",i=n.getPropertyValue("padding-right")||"0px",o=n.getPropertyValue("border-left-width")||"0px",s=n.getPropertyValue("padding-right-width")||"0px";if(!(Ag.test(r)&&Ag.test(i)&&Ag.test(o)&&Ag.test(s)))return 0;return parseFloat(r)+parseFloat(i)+parseFloat(o)+parseFloat(s)}(s),c=e.filter(of);for(const e of c)gf(e,l,a);return!1}(r,i,n.peek()))}(t,n,r)),0),e.registerCommand(Vn,uf,1),e.registerCommand(sn,cf,0),e.registerNodeTransform(ef,af),e.registerNodeTransform(Hg,lf),e.registerNodeTransform(Ig,sf))}function hf(e){const t=Jg(e),n=dp(e),r=t.getColWidths();if(!n||!r)return;const{columnIndex:i,colSpan:o}=n;let s=0;for(let e=i;e<i+o;e++)s+=r[e];return s}function gf(e,t,n){const r=e.getColWidths();if(!r)return e;const i=t-n,o=r.reduce(((e,t)=>e+t),0);if(o<=i)return e;const s=i/o;e.setColWidths(r.map((e=>e*s)));const l=e.getChildren().filter(Wg);for(const e of l){const t=e.getChildren().filter(Bg);for(const e of t){const t=hf(e);if(void 0!==t)for(const r of e.getChildren().filter(of))gf(r,t,n)}}}const pf=[Br,Hr];function ff(...e){const t=Bi();return e.forEach((e=>t.add(e.getKey()))),t}function mf(e){if(gi(e))return Tc(e,zo);if(e.isParentRequired()){const t=e.createRequiredParent();return Tc(e,t)}return e}function yf(e){const t=kc(e,zu);return t?.getListType()??null}function bf(e,t=null){return null===t?bf(e,!0)||bf(e,!1):t?function(e){return 0===e.offset}(e):function(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return Eo(t)||va(177),e.offset===t.getChildrenSize()}(e)}function _f(e,...t){return xf(ri,e,((e,n)=>({...e,forChild:(r,i)=>{const o=e?.forChild??(e=>e);let s=o(r,i);if(gi(s))return s=t.reduce(((e,t)=>t(e,n)??e),s),s}})))}function xf(e,t,n=e=>e){return r=>{const i=e.importDOM()?.[t]?.(r);if(!i)return null;const o=i.conversion(r);return o?n(o,r)??o:o}}function Cf(e){return!!wi(e)&&(e.isCollapsed()?Sf(e.style):e.hasFormat("highlight"))}function Sf(e){const t="string"==typeof e?Ta(e):e;return!(!t.color&&!t["background-color"])}class wf{constructor(e,t=[]){this._property=e,this._allowedValues=t,this._canonicalValues=this.#j}applyCanonicalization(e){const t={...Ta(e)};return t[this._property]=this.getCanonicalAllowedValue(t[this._property]),t[this._property]||delete t[this._property],Na(t)}getCanonicalAllowedValue(e){return this._canonicalValues[e]||=this.#q(e)}get#j(){return this._allowedValues.reduce(((e,t)=>({...e,[t]:t})),{})}#q(e){let t=this.#Z.indexOf(e);return t||=this.#Z.indexOf(vf(this._property,e)),-1===t?null:this._allowedValues[t]}get#Z(){return this._computedAllowedValues||=this._allowedValues.map((e=>vf(this._property,e)))}}function vf(e,t){const n=`${e}: ${t};`,r=document.body.appendChild(wg("span",{style:"display: none;"+n})),i=window.getComputedStyle(r).getPropertyValue(e);return r.remove(),i}class kf{#G;constructor(e){this.#G=e}get editorElement(){return this.#G}get editorConfig(){return this.#G.config}get enabled(){return!0}get lexicalExtension(){return null}initializeToolbar(e){}}const Ef=nn(),Tf=nn(),Nf={color:null,"background-color":null},Af=lt("hasPastedStyles",{parse:e=>e||!1});class Lf extends kf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return[{dependencies:[ih],name:"lexxy/highlight",config:{color:{buttons:[],permit:[]},"background-color":{buttons:[],permit:[]}},html:{import:{mark:Ff}},register(e,t){const n=function(e){return[new wf("color",[...e.buttons.color,...e.permit.color]),new wf("background-color",[...e.buttons["background-color"],...e.permit["background-color"]])]}(t);return wa(e.registerCommand(Ef,(t=>Rf(e,t)),2),e.registerCommand(Tf,(()=>Rf(e,Nf)),2),e.registerNodeTransform(ri,Bf),e.registerNodeTransform(kh,zf),e.registerNodeTransform(ri,(e=>function(e,t=[]){if(function(e){return at(e,Af)}(e)){$f(e,!1);const n=function(e,t=[]){return t.reduce(((e,t)=>t.applyCanonicalization(e)),e)}(e.getStyle(),t);e.setStyle(n);const r=$i();e.isSelected(r)&&(r.setStyle(e.getStyle()),r.setFormat(e.getFormat()))}}(e,n))))}},this.editorConfig.get("highlight")]}}function Of(e,t){const n={color:t.style?.color,"background-color":t.style?.backgroundColor};(function(e){return co()._updateTags.has(e)})(zr)&&$f(e);const r=Na(n);if(r.length)return e.setStyle(e.getStyle()+r)}function Ff(){return{conversion:_f("mark",Of),priority:1}}function Rf(e,t){const n=$i();if(!wi(n))return;const r={};for(const e in t){const i=Ka(n,e);r[e]=Df(i,t[e])}!function(e){const t=e.getNodes();return t.some((e=>bh(Nh(e)?e.getParent():e)))}(n)?Pa(n,r):function(e,t,n){const r=t.getNodes().filter((e=>Nh(e))).map((e=>({key:e.getKey(),startOffset:If(e,t)[0],endOffset:If(e,t)[1],textSize:e.getTextContentSize()})));e.update((()=>{for(const{key:e,startOffset:t,endOffset:i,textSize:o}of r){const r=ms(e);if(!r||!Nh(r))continue;if(bh(r.getParent())&&t!==i)if(0===t&&i===o)Pf(r,n);else{Pf(r.splitText(t,i)[0===t?0:1],n)}}}),{skipTransforms:!0,discrete:!0})}(e,n,r)}function If(e,t){const n=e.getKey(),r=n===t.anchor.key,i=n===t.focus.key;let o=0,s=e.getTextContentSize();return!1===t.isBackward()?(r&&(o=t.anchor.offset),i&&(s=t.focus.offset)):(i&&(o=t.focus.offset),r&&(s=t.anchor.offset)),[o,s]}function Pf(e,t){const n={...Ta(e.getStyle())};for(const[e,r]of Object.entries(t))null===r?delete n[e]:n[e]=r;const r=Na(n);e.setStyle(r);const i=Sf(r);i!==e.hasFormat("highlight")&&Mf(e,i)}function Mf(e,t){const n=e.getWritable();t?n.__format|=128:n.__format&=-129}function Df(e,t){return e===t?null:t}function Bf(e){Sf(e.getStyle())!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}function zf(e){if(!bh(e.getParent()))return;const t=Sf(e.getStyle());t!==e.hasFormat("highlight")&&Mf(e,t)}function $f(e,t=!0){ct(e,Af,t)}const Hf=["bold","italic","strikethrough","link","unlink","toggleHighlight","removeHighlight","rotateHeadingFormat","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","insertHorizontalDivider","uploadAttachments","insertTable","undo","redo"];class Kf{#J=null;static configureFor(e){new Kf(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#Y(),this.#X(),this.#Q()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(_n,"bold")}dispatchItalic(){this.editor.dispatchCommand(_n,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(_n,"strikethrough")}dispatchToggleHighlight(e){this.editor.dispatchCommand(Ef,e)}dispatchRemoveHighlight(){this.editor.dispatchCommand(Tf)}dispatchLink(e){this.editor.update((()=>{const t=$i();if(wi(t))if(t.isCollapsed()){const n=rd(e),r=hi(e);n.append(r),t.insertNodes([n])}else sd(e)}))}dispatchUnlink(){this.#ee(null)}dispatchInsertUnorderedList(){const e=$i();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===yf(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(qu,void 0)}dispatchInsertOrderedList(){const e=$i();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===yf(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(Zu,void 0)}dispatchInsertQuoteBlock(){this.contents.wrapSelectedSoftBreakLines((()=>jd()))||this.contents.toggleNodeWrappingAllSelectedNodes((e=>qd(e)),(()=>jd()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(_n,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>bh(e)),(()=>new mh("plain")))}))}dispatchInsertHorizontalDivider(){this.contents.insertAtCursorEnsuringLineBelow(new Ng),this.editor.focus()}dispatchRotateHeadingFormat(){const e=$i();if(!wi(e))return;if(tl(e.anchor.getNode()))return void e.insertNodes([Xd("h2")]);const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(Qd(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>Xd(n))):this.contents.removeFormattingFromSelectedLines()}dispatchUploadAttachments(){const e=wg("input",{type:"file",multiple:!0,style:"display: none;",onchange:({target:{files:e}})=>{this.contents.uploadFiles(e,{selectLast:!0})}});this.editorElement.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}dispatchInsertTable(){this.editor.dispatchCommand(zg,{rows:3,columns:3,includeHeaders:!0})}dispatchUndo(){this.editor.dispatchCommand(xn,void 0)}dispatchRedo(){this.editor.dispatchCommand(Cn,void 0)}#Y(){for(const t of Hf){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#te(t,0,this[n].bind(this))}var e;this.#te(fn,1,this.dispatchPaste.bind(this))}#te(e,t,n){this.editor.registerCommand(e,n,t)}#X(){this.editor.registerCommand(wn,this.#ne.bind(this),2),this.editor.registerCommand(In,this.#re.bind(this),2)}#ne(e){const t=$i();if(!wi(t)||!t.isCollapsed())return!1;if(this.selection.isInsideCodeBlock||!t.hasFormat("code"))return!1;const n=t.anchor.getNode();return!(!gi(n)||t.anchor.offset!==n.getTextContentSize())&&(null===n.getNextSibling()&&(e.preventDefault(),t.toggleFormat("code"),!0))}#Q(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#ie.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#oe.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#se.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#le.bind(this)))}#se(e){this.dragCounter++,1===this.dragCounter&&(this.#ae(),this.editor.getRootElement().classList.add("lexxy-editor--drag-over"))}#le(e){this.dragCounter--,0===this.dragCounter&&(this.#J=null,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over"))}#ie(e){e.preventDefault()}#oe(e){e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);n.length&&(this.#ce(),this.contents.uploadFiles(n,{selectLast:!0}),this.editor.focus())}#ae(){this.editor.getEditorState().read((()=>{this.#J=$i()?.clone()}))}#ce(){this.#J&&(this.editor.update((()=>{vs(this.#J)})),this.#J=null)}#re(e){return this.selection.isInsideList?this.#ue(e):!!this.selection.isInsideCodeBlock&&this.#de()}#ue(e){if(e.shiftKey&&!this.selection.isIndentedList)return!1;e.preventDefault();const t=e.shiftKey?Dn:Mn;return this.editor.dispatchCommand(t)}#de(){const e=$i();return wi(e)&&e.isCollapsed()}#ee(e){this.editor.update((()=>{sd(null===e?null:e)}))}}function Uf(){return new Promise(requestAnimationFrame)}function Wf(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,t)).toFixed(2)} ${["B","KB","MB","GB","TB","PB"][t]}`}function Vf(e){try{return JSON.parse(e)}catch{return e}}class jf extends No{static getType(){return"action_text_attachment"}static clone(e){return new jf({...e},e.__key)}static importJSON(e){return new jf({...e})}static importDOM(){return{[this.TAG_NAME]:()=>({conversion:e=>({node:new jf({sgid:e.getAttribute("sgid"),src:e.getAttribute("url"),previewable:e.getAttribute("previewable"),altText:e.getAttribute("alt"),caption:e.getAttribute("caption"),contentType:e.getAttribute("content-type"),fileName:e.getAttribute("filename"),fileSize:e.getAttribute("filesize"),width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1}),img:()=>({conversion:e=>{const t=(e.getAttribute("src")??"").split("/").pop();return{node:new jf({src:e.getAttribute("src"),fileName:t,caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}},priority:1}),video:()=>({conversion:e=>{const t=e.getAttribute("src")||e.querySelector("source")?.src,n=t?.split("/")?.pop(),r=e.querySelector("source")?.getAttribute("content-type")||"video/*";return{node:new jf({src:t,fileName:n,contentType:r})}},priority:1})}}static get TAG_NAME(){return Ga.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,src:n,previewable:r,altText:i,caption:o,contentType:s,fileName:l,fileSize:a,width:c,height:u},d){super(d),this.tagName=e||jf.TAG_NAME,this.sgid=t,this.src=n,this.previewable=r,this.altText=i||"",this.caption=o||"",this.contentType=s||"",this.fileName=l||"",this.fileSize=a,this.width=c,this.height=u,this.editor=fl()}createDOM(){const e=this.createAttachmentFigure();return this.isPreviewableAttachment?(e.appendChild(this.#he()),e.appendChild(this.#ge())):(e.appendChild(this.#pe()),e.appendChild(this.#fe())),e}updateDOM(e,t){const n=t.querySelector("figcaption textarea");return n&&this.caption&&(n.value=this.caption),!1}getTextContent(){return`[${this.caption||this.fileName}]\n\n`}isInline(){return this.isAttached()&&!this.getParent().is(el(this))}exportDOM(){return{element:wg(this.tagName,{sgid:this.sgid,previewable:this.previewable||null,url:this.src,alt:this.altText,caption:this.caption,"content-type":this.contentType,filename:this.fileName,filesize:this.fileSize,width:this.width,height:this.height,presentation:"gallery"})}}exportJSON(){return{type:"action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){const e=(t=this.contentType,n=this.isPreviewableAttachment,r=this.fileName,wg("figure",{className:`attachment attachment--${n?"preview":"file"} attachment--${r?r.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":t}));var t,n,r;const i=wg("lexxy-node-delete-button");return e.appendChild(i),e}get isPreviewableAttachment(){return this.isPreviewableImage||this.previewable}get isPreviewableImage(){return kg(this.contentType)}#he(e={}){return wg("img",{src:this.src,draggable:!1,alt:this.altText,...this.#me,...e})}get#me(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#pe(){return wg("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#fe(){const e=wg("figcaption",{className:"attachment__caption"}),t=wg("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=wg("span",{className:"attachment__size",textContent:Wf(this.fileSize)});e.appendChild(t)}return e}#ge(){const e=wg("figcaption",{className:"attachment__caption"}),t=wg("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",(e=>this.#ye(e))),t.addEventListener("keydown",(e=>this.#be(e))),t.addEventListener("copy",(e=>e.stopPropagation())),t.addEventListener("cut",(e=>e.stopPropagation())),t.addEventListener("paste",(e=>e.stopPropagation())),e.appendChild(t),e}#ye(e){this.#_e(e.target)}#_e(e){e.placeholder=this.fileName,this.editor.update((()=>{this.getWritable().caption=e.value}))}#be(e){"Enter"===e.key&&(e.preventDefault(),e.target.blur(),this.editor.update((()=>{this.selectNext(0,0)}),{tag:Br})),e.stopPropagation()}}function qf(...e){return new jf(...e)}function Zf(e){return e instanceof jf}class Gf{constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#xe(),this.#Ce(),this.#Se()}set current(e){this.editor.update((()=>{this.#we()}))}get hasNodeSelection(){return this.editor.getEditorState().read((()=>{const e=$i();return null!==e&&ki(e)}))}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#ve();if(!t)return;const n=this.#ke(t);n&&(e=this.#Ee(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{const e=Ss(),t=e.getLastDescendant();t&&gi(t)?t.selectEnd():e.selectEnd()}))}selectedNodeWithOffset(){const e=$i();if(!e)return{node:null,offset:0};if(wi(e))return{node:e.anchor.getNode(),offset:e.anchor.offset};if(ki(e)){const[t]=e.getNodes();return{node:t,offset:0}}return{node:null,offset:0}}preservingSelection(e){let t=null;this.editor.getEditorState().read((()=>{const e=$i();e&&wi(e)&&(t={anchor:{key:e.anchor.key,offset:e.anchor.offset},focus:{key:e.focus.key,offset:e.focus.offset}})})),e(),t&&this.editor.update((()=>{const e=$i();e&&wi(e)&&(e.anchor.set(t.anchor.key,t.anchor.offset,"text"),e.focus.set(t.focus.key,t.focus.offset,"text"))}))}getFormat(){const e=$i();if(!wi(e))return{};const t=e.anchor.getNode();if(!t.getParent())return{};const n=t.getTopLevelElementOrThrow(),r=yf(t);return{isBold:e.hasFormat("bold"),isItalic:e.hasFormat("italic"),isStrikethrough:e.hasFormat("strikethrough"),isHighlight:Cf(e),isInLink:null!==kc(t,Xu),isInQuote:qd(n),isInHeading:Qd(n),isInCode:e.hasFormat("code")||null!==kc(t,mh),isInList:null!==r,listType:r,isInTable:null!==Zg(t)}}nearestNodeOfType(e){const t=$i()?.anchor?.getNode();return kc(t,e)}get hasSelectedWordsInSingleLine(){const e=$i();if(!wi(e))return!1;if(e.isCollapsed())return!1;const t=e.anchor.getNode(),n=e.focus.getNode();if(t.getTopLevelElement()!==n.getTopLevelElement())return!1;if(!t.getTopLevelElement())return!1;const r=e.getNodes();for(const e of r)if(Gr(e))return!1;return!0}get isInsideList(){return this.nearestNodeOfType(Iu)}get isIndentedList(){const e=this.nearestNodeOfType(zu);return e&&Cu(e)>1}get isInsideCodeBlock(){return null!==this.nearestNodeOfType(mh)}get isTableCellSelected(){const e=$i(),{anchor:t,focus:n}=e;return!(!wi(e)||t.key!==n.key)&&null!==this.nearestNodeOfType(Ig)}get isOnPreviewableImage(){const e=$i(),t=e?.getNodes().at(0);return Zf(t)&&t.isPreviewableImage}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Te();return e?gi(e)?this.#Ne(e,t):Eo(e)?this.#Ae(e,t):this.#Le(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#Te();return e?gi(e)?t<e.getTextContentSize()?null:this.#Oe(e):Eo(e)?this.#Ae(e,t):this.#Le(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Te();return e?gi(e)?this.#Fe(e,t):Eo(e)?this.#Re(e,t):this.#Ie(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#Te();return e?gi(e)?t>0?null:this.#Pe(e):Eo(e)?this.#Re(e,t):this.#Ie(e):null}get#Me(){if(this.currentlySelectedKeys)return this.currentlySelectedKeys;this.currentlySelectedKeys=new Set;const e=$i();if(e&&ki(e))for(const t of e.getNodes())this.currentlySelectedKeys.add(t.getKey());return this.currentlySelectedKeys}#Ce(){this.editor.registerCommand(kn,this.#De.bind(this),1),this.editor.registerCommand(wn,this.#Be.bind(this),1),this.editor.registerCommand(Tn,this.#ze.bind(this),1),this.editor.registerCommand(Nn,this.#$e.bind(this),1),this.editor.registerCommand(dn,this.#He.bind(this),1),this.editor.registerCommand(rn,(()=>{this.current=$i()}),1)}#xe(){this.editor.registerCommand(sn,(({target:e})=>{if(!ul(e))return!1;const t=_s(e);return Ao(t)&&this.#Ke(t)}),1),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#Ue()}))}#Se(){this.editorContentElement.addEventListener("keydown",(e=>{if("ArrowUp"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.previousElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.previousElementSibling;n||e.preventDefault()}}if("ArrowDown"===e.key){const t=this.editor.getRootElement().querySelector("[data-lexical-cursor]");if(t){let n=t.nextElementSibling;for(;n&&n.hasAttribute("data-lexical-cursor");)n=n.nextElementSibling;n||e.preventDefault()}}}),!0)}#we(){this.#We(),this.#Ve(),this.previouslySelectedKeys=this.#Me,this.currentlySelectedKeys=null}#We(){for(const e of this.previouslySelectedKeys)if(!this.#Me.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#Ve(){for(const e of this.#Me)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#De(e){return!e?.shiftKey&&(this.hasNodeSelection?await this.#je((e=>e.selectPrevious())):this.#Ke(this.nodeBeforeCursor))}async#Be(e){return!e?.shiftKey&&(this.hasNodeSelection?await this.#je((e=>e.selectNext(0,0))):this.#Ke(this.nodeAfterCursor))}async#ze(){return this.hasNodeSelection?await this.#je((e=>e.getTopLevelElement().selectPrevious())):this.#Ke(this.topLevelNodeBeforeCursor)}async#$e(){return this.hasNodeSelection?await this.#je((e=>e.getTopLevelElement().selectNext(0,0))):this.#Ke(this.topLevelNodeAfterCursor)}async#je(e){await Uf(),this.hasNodeSelection&&this.editor.update((()=>{e($i().getNodes()[0]),this.editor.focus()}))}async#Ue(){this.editor.update((()=>{const e=this.#qe();e&&this.#Ze(e)}))}#qe(){const e=$i();return e?ki(e)?this.#Ge(e):wi(e)?this.#Je(e):null:null}#Ge(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#Je(e){return e.anchor.getNode().getTopLevelElement()}#Ze(e){const t=e.getNextSibling();t?t.selectStart():this.#Ye()}#Ye(){const e=Ss(),t=zo();e.append(t),t.selectStart()}#Ke(e){if(Ao(e)){const t=ff(e);return vs(t),t}return!1}#He(e){const t=e?this.nodeBeforeCursor:this.nodeAfterCursor;if(!Ao(t))return!1;if(this.#Xe())return!0;this.#Qe();const n=this.#Ke(t);return Boolean(n)}#Xe(){const e=$i()?.anchor?.getNode(),t=e&&kc(e,Iu);if(!t)return!1;const n=kc(t,zu);if(!n)return!1;const r=zo();return t.getChildren().forEach((e=>r.append(e))),1===n.getChildrenSize()?(n.insertBefore(r),n.remove()):(n.insertBefore(r),t.remove()),r.selectStart(),!0}#Qe(e=$i()?.anchor){const t=e?.getNode();Eo(t)&&t?.isEmpty()&&t.remove()}#ve(){const e=$i();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#ke(e){let t=e.getBoundingClientRect();if(this.#et(t)){const n=this.#tt(e);t=n.getBoundingClientRect(),this.#nt(n),n.remove()}return t}#et(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#tt(e){const t=this.#rt();return e.insertNode(t),t}#rt(){const e=document.createElement("span");return e.textContent="​",e.style.display="inline-block",e.style.width="1px",e.style.height="1em",e.style.lineHeight="normal",e.setAttribute("nonce",Qa()),e}#nt(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#Ee(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const o=this.#it(t);return isNaN(o)||(i+=o),{x:r,y:i,fontSize:o}}#it(e){const t=window.getSelection().anchorNode,n=this.#ot(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#ot(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#Te(){const e=$i();if(!wi(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#Ne(e,t){return t===e.getTextContentSize()?this.#Oe(e):null}#Oe(e){const t=e.getNextSibling();if(Ao(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getNextSibling():null}#Ae(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#Le(e)}#Fe(e,t){return 0===t?this.#Pe(e):null}#Pe(e){const t=e.getPreviousSibling();if(Ao(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getPreviousSibling():null}#Re(e,t){return t>0?e.getChildAtIndex(t-1):this.#Ie(e)}#Le(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#Ie(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}function Jf(e){return he.sanitize(e,{ALLOWED_TAGS:Ja.concat(Ga.global.get("attachmentTagName")),ALLOWED_ATTR:Ya,ADD_URI_SAFE_ATTR:["caption","filename"],SAFE_FOR_XML:!1})}function Yf(e){try{return new URL(e),!0}catch{return!1}}function Xf(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Qf(e){return e.charAt(0).toUpperCase()+e.slice(1)}class em{#G;#st;constructor(e){this.#G=e,this.#st=new Va(Ga.presets.get("default"),Ga.presets.get(e.preset),this.#lt)}get(e){return this.#st.get(e)}get#lt(){const e={};for(const t of this.#at){const n=t.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`));this.#G.hasAttribute(n)&&(e[t]=this.#ct(n))}return e}get#at(){return Object.keys(Ga.presets.get("default"))}#ct(e){const t=this.#G.getAttribute(e);try{return JSON.parse(t)}catch{return t}}}class tm extends No{static getType(){return"custom_action_text_attachment"}static clone(e){return new tm({...e},e.__key)}static importJSON(e){return new tm({...e})}static importDOM(){return{[this.TAG_NAME]:e=>e.getAttribute("content")?{conversion:e=>{const t=[],n=e.previousSibling;return n&&n.nodeType===Node.TEXT_NODE&&/\s$/.test(n.textContent)&&t.push(hi(" ")),t.push(new tm({sgid:e.getAttribute("sgid"),innerHtml:Vf(e.getAttribute("content")),contentType:e.getAttribute("content-type")})),t.push(hi("⁠")),{node:t}},priority:2}:null}}static get TAG_NAME(){return Ga.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,contentType:n,innerHtml:r},i){super(i);const o=Ga.global.get("attachmentContentTypeNamespace");this.tagName=e||tm.TAG_NAME,this.sgid=t,this.contentType=n||`application/vnd.${o}.unknown`,this.innerHtml=r}createDOM(){const e=wg(this.tagName,{"content-type":this.contentType,"data-lexxy-decorator":!0});e.insertAdjacentHTML("beforeend",this.innerHtml);const t=wg("lexxy-node-delete-button");return e.appendChild(t),e}updateDOM(){return!1}getTextContent(){return"\ufeff"}getReadableTextContent(){return this.createDOM().textContent.trim()||`[${this.contentType}]`}isInline(){return!0}exportDOM(){return{element:wg(this.tagName,{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,tagName:this.tagName,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class nm{constructor(e){this.editorElement=e,this.editor=e.editor}monitor(){this.editor.registerCommand(An,(e=>this.#ut(e)),3),this.editor.registerCommand(Nn,(e=>this.#dt(e)),2)}#ut(e){const t=$i();if(!wi(t))return!1;if(this.#ht(e,t))return!0;const n=t.anchor.getNode();return!!this.#gt(n)&&(this.#pt(e,n)||this.#ft(e,n))}#pt(e,t){return!(!this.#mt(t)&&!this.#yt(t))&&(e.preventDefault(),this.#bt(t),!0)}#ft(e,t){return!!this.#_t(t)&&(e.preventDefault(),this.#xt(t),!0)}#gt(e){let t=e;for(;t;){if(qd(t))return!0;t=t.getParent()}return!1}#mt(e){const t=this.#Ct(e);return!!t&&this.#St(t)}#yt(e){const t=this.#wt(e);if(!t)return!1;if(!this.#St(t))return!1;const n=t.getParent();return n&&Bu(n)}#St(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>!!Gr(e)||this.#St(e)))}#Ct(e){let t=e;for(;t;){if(Bu(t))return t;t=t.getParent()}return null}#bt(e){const t=this.#Ct(e);if(!t)return;const n=t.getParent();if(!n||!Vu(n))return;const r=n.getParent();if(r&&qd(r)){const e=this.#vt(t).filter((e=>!this.#St(e)));if(e.length>0)return void this.#kt(r,n,t,e)}const i=zo();n.insertAfter(i),t.remove(),i.selectStart()}#_t(e){const t=this.#wt(e);if(!t)return!1;if(!this.#St(t))return!1;const n=t.getParent();return n&&qd(n)}#wt(e){let t=e;for(;t;){if($o(t))return t;t=t.getParent()}return null}#xt(e){const t=this.#wt(e);if(!t)return;const n=t.getParent();if(!n||!qd(n))return;const r=this.#Et(t).filter((e=>!this.#St(e)));if(r.length>0)this.#Tt(n,t,r);else{const e=zo();n.insertAfter(e),t.remove(),e.selectStart()}}#Et(e){const t=[];let n=e.getNextSibling();for(;n;)t.push(n),n=n.getNextSibling();return t}#vt(e){const t=[];let n=e.getNextSibling();for(;n;)Bu(n)&&t.push(n),n=n.getNextSibling();return t}#kt(e,t,n,r){const i=this.#Et(t).filter((e=>!this.#St(e))),o=zo();e.insertAfter(o);const s=Wu(t.getListType()),l=jd();o.insertAfter(l),l.append(s),r.forEach((e=>{s.append(e)})),i.forEach((e=>{l.append(e)})),n.remove(),this.#Nt(t),this.#At(l),0===t.getChildrenSize()?(t.remove(),0===e.getChildrenSize()&&e.remove()):this.#At(e),o.selectStart()}#Nt(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!Bu(n)||!this.#St(n))break;n.remove()}}#At(e){const t=e.getChildren();for(let e=t.length-1;e>=0;e--){const n=t[e];if(!this.#St(n))break;n.remove()}}#Tt(e,t,n){const r=zo();e.insertAfter(r);const i=jd();r.insertAfter(i),n.forEach((e=>{i.append(e)})),t.remove(),this.#At(e),this.#At(i),r.selectStart()}#ht(e,t){if(!t.isCollapsed())return!1;const n=this.#Lt(t);return!!n&&(!!this.#Ot(t,n)&&(e?.preventDefault(),this.#Ft(n),!0))}#dt(e){const t=$i();if(!wi(t)||!t.isCollapsed())return!1;const n=this.#Lt(t);if(!n)return!1;if(this.#Rt(t,n)&&!n.getNextSibling()){e?.preventDefault();const t=zo();return n.insertAfter(t),t.selectStart(),!0}return!1}#Lt(e){const t=e.anchor.getNode();return kc(t,mh)||(bh(t)?t:null)}#Ot(e,t){const n=t.getChildren();if(0===n.length)return!0;const r=e.anchor.getNode(),i=e.anchor.offset;if(bh(r)&&i===n.length)return Gr(n[n.length-1]);if(gi(r)&&0===r.getTextContentSize()&&0===i){return Gr(r.getPreviousSibling())&&null===r.getNextSibling()}return!1}#Rt(e,t){const n=e.anchor.getNode(),r=t.getChildren();if(0===r.length)return!0;const i=r[r.length-1];if(bh(n)&&e.anchor.offset===r.length)return!0;if(n===i)return!0;const o=r.findLastIndex((e=>Gr(e)));if(-1===o)return!0;return r.indexOf(n)>o}#Ft(e){const t=e.getChildren(),n=t[t.length-1];if(gi(n)&&0===n.getTextContentSize()){const e=n.getPreviousSibling();n.remove(),Gr(e)&&e.remove()}else Gr(n)&&n.remove();const r=zo();e.insertAfter(r),r.selectStart()}}class rm extends jf{static getType(){return"action_text_attachment_upload"}static clone(e){return new rm({...e},e.__key)}static importJSON(e){return new rm({...e})}static importDOM(){return null}constructor(e,t){const{file:n,uploadUrl:r,blobUrlTemplate:i,progress:o,width:s,height:l,uploadError:a}=e;super({...e,contentType:n.type},t),this.file=n,this.fileName=n.name,this.uploadUrl=r,this.blobUrlTemplate=i,this.progress=o??null,this.width=s,this.height=l,this.uploadError=a}createDOM(){if(this.uploadError)return this.#It();this.#Pt();const e=this.createAttachmentFigure();if(this.isPreviewableAttachment){const t=e.appendChild(this.#he());(async function(e,t){return new Promise((n=>{const r=new FileReader;t.addEventListener("load",(()=>{n(t)})),r.onload=e=>{t.src=e.target.result||null},r.readAsDataURL(e)}))})(this.file,t).then((e=>this.#Mt(e)))}else e.appendChild(this.#pe());return e.appendChild(this.#Dt()),e.appendChild(this.#Bt()),e}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;if(e.progress!==this.progress){t.querySelector("progress").value=this.progress??0}return!1}exportDOM(){return{element:null}}exportJSON(){return{...super.exportJSON(),type:"action_text_attachment_upload",version:1,uploadUrl:this.uploadUrl,blobUrlTemplate:this.blobUrlTemplate,progress:this.progress,width:this.width,height:this.height,uploadError:this.uploadError}}get#zt(){return null!==this.progress}#It(){const e=this.createAttachmentFigure();return e.classList.add("attachment--error"),e.appendChild(wg("div",{innerText:`Error uploading ${this.file?.name??"file"}`})),e}#he(){return wg("img")}#pe(){return wg("span",{className:"attachment__icon",textContent:this.#$t()})}#$t(){return this.file.name.split(".").pop().toLowerCase()}#Dt(){const e=wg("figcaption",{className:"attachment__caption"}),t=wg("span",{className:"attachment__name",textContent:this.caption||this.file.name||""}),n=wg("span",{className:"attachment__size",textContent:Wf(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#Bt(){return wg("progress",{value:this.progress??0,max:100})}#Mt({width:e,height:t}){this.#Ht||this.editor.update((()=>{const n=this.getWritable();n.width=e,n.height=t}),{tag:this.#Kt})}get#Ht(){return Boolean(this.width&&this.height)}async#Pt(){if(this.#zt)return;this.#Ut();const{DirectUpload:e}=await import("@rails/activestorage"),t=new e(this.file,this.uploadUrl,this);t.delegate=this.#Wt(),this.#Vt("lexxy:upload-start",{file:this.file}),t.create(((e,t)=>{e?(this.#Vt("lexxy:upload-end",{file:this.file,error:e}),this.#jt(e)):(this.#Vt("lexxy:upload-end",{file:this.file,error:null}),this.#qt(t))}))}#Wt(){const e=Ga.global.get("authenticatedUploads");return{directUploadWillCreateBlobWithXHR:t=>{e&&(t.withCredentials=!0)},directUploadWillStoreFileWithXHR:t=>{e&&(t.withCredentials=!0);t.upload.addEventListener("progress",(e=>this.#Zt(e)))}}}#Ut(){this.#Gt(1)}#Zt(e){const t=Math.round(e.loaded/e.total*100);this.#Gt(t),this.#Vt("lexxy:upload-progress",{file:this.file,progress:t})}#Gt(e){this.editor.update((()=>{this.getWritable().progress=e}),{tag:this.#Kt})}#jt(e){console.warn(`Upload error for ${this.file?.name??"file"}: ${e}`),this.editor.update((()=>{this.getWritable().uploadError=!0}),{tag:this.#Kt})}#qt(e){const t=this.#Jt;this.editor.update((()=>{const n=t&&this.isSelected(),r=this.#Yt(e);if(this.replace(r),n){vs(ff(r))}}),{tag:this.#Kt})}get#Kt(){return this.#Jt?pf:[...pf,Kr]}get#Jt(){const e=this.editor.getRootElement();return null!==e&&e.contains(document.activeElement)}#Yt(e){return new im(this,e).toAttachmentNode()}#Vt(e,t){const n=this.editor.getElementByKey(this.getKey());n&&Eg(n,e,t)}}class im{constructor(e,t){this.uploadNode=e,this.blob=t}toAttachmentNode(){return new jf({...this.uploadNode,...this.#Xt,src:this.#Qt})}get#Xt(){const{blob:e}=this;return{sgid:e.attachable_sgid,altText:e.filename,contentType:e.content_type,fileName:e.filename,fileSize:e.byte_size,previewable:e.previewable}}get#Qt(){return this.blob.previewable?this.blob.url:this.#en}get#en(){return this.uploadNode.blobUrlTemplate.replace(":signed_id",this.blob.signed_id).replace(":filename",encodeURIComponent(this.blob.filename))}}function om(...e){return new rm(...e)}class sm extends ko{$config(){return this.config("image_gallery",{extends:ko})}static transform(){return e=>{e.unwrapEmptyNode()||e.replaceWithSingularChild()||e.splitAroundInvalidChild()}}static importDOM(){return{div:e=>e.querySelector(`:scope > :is(${this.#tn.join()})`)?{conversion:()=>({node:lm(),after:e=>e}),priority:2}:null}}static canCollapseWith(e){return am(e)||this.isValidChild(e)}static isValidChild(e){return Zf(e)&&e.isPreviewableImage}static get#tn(){return Object.keys(jf.importDOM())}createDOM(){const e=document.createElement("div");return e.className=this.#nn,e}updateDOM(e,t){return t.className=this.#nn,!1}canBeEmpty(){return!0}collapseAtStart(e){return!0}insertNewAfter(e,t){if(e.anchor.getNode().is(this)&&e.anchor.offset==this.getChildrenSize()-1){const e=zo();return this.insertAfter(e,!1),e.insertAfter(this.getLastChild(),!1),e.selectEnd(),null}const n=lm();return this.insertAfter(n,t),n}getImageAttachments(){return this.getChildren().filter(Zf)}exportDOM(){const e=document.createElement("div");return e.className=this.#nn,{element:e}}collapseWith(e,t){return!!sm.canCollapseWith(e)&&(t?Lc(this,e):this.append(e),Oc(this,sm.isValidChild),!0)}unwrapEmptyNode(){if(this.isEmpty()){const e=zo();return this.replace(e)}}replaceWithSingularChild(){if(this.#rn){const e=this.getFirstChild();return this.replace(e)}}splitAroundInvalidChild(){for(const e of Ic(this)){if(sm.isValidChild(e))continue;const t=mf(e),[n,r]=this.splitAtIndex(t.getIndexWithinParent());n.insertAfter(t),t.selectEnd(),r.isEmpty()&&r.remove();break}}splitAtIndex(e){return function(e,t){let n=e.getChildAtIndex(t);null==n&&(n=e),tl(e)&&ge(102);const r=e=>{const t=e.getParentOrThrow(),i=tl(t),o=e!==n||i?nl(e):e;if(i)return Eo(e)&&Eo(o)||ge(133),e.insertAfter(o),[e,o,o];{const[n,i,s]=r(t),l=e.getNextSiblings();return s.append(o,...l),[n,i,o]}},[i,o]=r(n);return[i,o]}(this,e)}get#rn(){return 1===this.getChildrenSize()}get#nn(){return`attachment-gallery attachment-gallery--${this.getChildrenSize()}`}}function lm(){return new sm}function am(e){return e instanceof sm}function cm(e){if(!sm.canCollapseWith(e))return null;return kc(e,sm)??Tc(e,lm)}class um{#in;static for(e,t){return new(dm.handle(e,t)?dm:um)(e,t)}constructor(e,t){this.#in=t,this.editorElement=e,this.contents=e.contents,this.selection=e.selection}get files(){return Array.from(this.#in)}$uploadFiles(){this.$createUploadNodes(),this.$insertUploadNodes()}$createUploadNodes(){this.nodes=this.files.map((e=>om({...this.#on,file:e,contentType:e.type})))}$insertUploadNodes(){this.nodes.forEach(this.contents.insertAtCursor)}get#on(){return{uploadUrl:this.editorElement.directUploadUrl,blobUrlTemplate:this.editorElement.blobUrlTemplate}}}class dm extends um{#sn;static handle(e,t){return this.#ln(t)||this.#an(e.selection)}static#ln(e){let t=0;for(const n of e)if(kg(n.type)&&t++,t>1)return!0;return!1}static#an(e){if(e.isOnPreviewableImage)return!0;const{node:t}=e.selectedNodeWithOffset();return null!==kc(t,sm)}$insertUploadNodes(){this.#cn(),this.#un(),this.#dn()}#cn(){this.selection.isOnPreviewableImage?this.#sn=cm(this.#hn):(this.#sn=lm(),this.contents.insertAtCursor(this.#sn))}get#hn(){const{node:e}=this.selection.selectedNodeWithOffset();return e}get#gn(){const e=$i()?.anchor,t=e?.getNode().is(this.#sn);if(t)return e.offset;const n=this.#hn,r=this.#sn.isParentOf(n)&&n.getIndexWithinParent();return!1!==r?r+1:0}get#pn(){return this.nodes.filter((e=>sm.isValidChild(e)))}get#fn(){return this.nodes.filter((e=>!sm.isValidChild(e)))}#un(){this.#sn.splice(this.#gn,0,this.#pn)}#dn(){let e=this.#sn;for(const t of this.#fn)e.insertAfter(t),e=t}}class hm{constructor(e){this.editorElement=e,this.editor=e.editor,new nm(e).monitor()}insertHtml(e,{tag:t}={}){this.insertDOM(vg(e),{tag:t})}insertDOM(e,{tag:t}={}){this.#mn(e),this.editor.update((()=>{const t=$i();if(!wi(t))return;const n=cd(this.editor,e);this.#yn(n)||t.insertNodes(n)}),{tag:t})}insertAtCursor(e){let t=$i()??Ss().selectEnd();const n=t?.getNodes();if(wi(t)){const n=t.anchor.getNode();if(gm(n)){const e=zo();n.append(e),t=e.selectStart()}t.insertNodes([e])}else if(ki(t)&&n.length>0){n.at(-1).insertAfter(e)}}insertAtCursorEnsuringLineBelow(e){this.insertAtCursor(e),this.#bn(e)}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=$i();if(!wi(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=$i();if(!wi(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.#_n(t)}))}toggleNodeWrappingAllSelectedNodes(e,t){this.editor.update((()=>{const n=$i();if(!wi(n))return;const r=n.anchor.getNode().getTopLevelElement();r&&e(r)?this.#xn(r):this.#Cn(t)}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=$i();if(!wi(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=zo();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=$i();e=wi(t)&&!t.isCollapsed()})),e}wrapSelectedSoftBreakLines(e){let t=null,n=null;return this.editor.getEditorState().read((()=>{const e=$i();if(!wi(e)||e.isCollapsed())return;const r=this.#Sn(e);if(!r)return;const i=this.#wn(r);if(n=this.#vn(i,e),!n)return;const{start:o,end:s}=n;0===o&&s===i.length-1||(t=r.getKey())})),!(!t||!n)&&(this.editor.update((()=>{const r=ms(t);if(!r||!$o(r))return;const i=this.#wn(r);this.#kn(r,i,n,e)})),!0)}unwrapSelectedListItems(){this.editor.update((()=>{const e=$i();if(!wi(e))return;const{listItems:t,parentLists:n}=this.#En(e);if(t.size>0){const e=this.#Tn(t);this.#Nn(n),this.#An(e)}}))}createLink(e){let t=null;return this.editor.update((()=>{const n=hi(e),r=ed(e);r.append(n);const i=$i();wi(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{sd(null),sd(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=$i();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!gi(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s),a=l.lastIndexOf(e);-1!==a&&(t=l.slice(a+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=$i();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!gi(i))return;const o=i.getTextContent(),s=r.offset,l=o.slice(0,s);t=l.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t];const n=$i(),{anchorNode:r,offset:i}=this.#Ln();if(!r)return;const o=this.#On(r,i,e);-1!==o&&this.#Fn(r,n,i,o,t)}createParagraphAfterNode(e,t){const n=zo();e.insertAfter(n),n.selectStart(),t&&(n.append(hi(t)),n.select(1,1))}createParagraphBeforeNode(e,t){const n=zo();e.insertBefore(n),n.selectStart(),t&&(n.append(hi(t)),n.select(1,1))}uploadFiles(e,{selectLast:t}={}){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");const n=Array.from(e).filter(this.#Rn.bind(this));this.editor.update((()=>{const e=um.for(this.editorElement,n);if(e.$uploadFiles(),t&&e.nodes?.length){e.nodes.at(-1).selectEnd(),this.#In()}}))}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=ms(e);if(!r)return;const i=$i();let o=!1;if(wi(i)){const e=i.getNodes();o=e.includes(r)||e.some((e=>e.getParent()===r)),o&&vs(null)}const s=n.attachment?this.#Pn(t,n.attachment):this.#Mn(t);r.replace(s),o&&s.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=ms(e);if(!r)return;const i=r.getTopLevelElement()||r,o=n.attachment?this.#Pn(t,n.attachment):this.#Mn(t);i.insertAfter(o)}))}#yn(e){if(e.every(Zf)){const t=um.for(this.editorElement,[]);return t.nodes=e,t.$insertUploadNodes(),!0}}#bn(e){this.editor.update((()=>{if(!e.getNextSibling()){const t=zo();e.insertAfter(t),t.selectStart()}}))}#xn(e){const t=e.getChildren();0==t.length?e.insertBefore(zo()):t.forEach((t=>{if(gi(t)&&""!==t.getTextContent().trim()){const n=zo();n.append(t),e.insertBefore(n)}else Gr(t)||e.insertBefore(t)})),e.remove()}#mn(e){for(const t of e.querySelectorAll("a")){const e=t.getAttribute("href")||"";""!==e&&"#"!==e||t.replaceWith(...t.childNodes)}}#Cn(e){this.editor.update((()=>{const t=$i();if(!wi(t))return;const n=t.extract();if(0===n.length)return;const r=new Set;n.forEach((e=>{const t=e.getTopLevelElementOrThrow();r.add(t)}));const i=this.#Dn(Array.from(r));if(0===i.length)return this.#Bn(),void this.insertAtCursor(e());const o=e();i[0].insertBefore(o),i.forEach((e=>{o.append(e)}))}))}#Dn(e){let t=e.length-1;for(;t>=0;){const n=e[t];if(!$o(n)||!this.#zn(n))break;t--}return e.slice(0,t+1)}#zn(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren();return 0===t.length||t.every((e=>Gr(e)))}#Bn(){const e=Ss();if(1===e.getChildrenSize()){const t=e.getFirstChild();t&&$o(t)&&this.#zn(t)&&t.remove()}}#_n(e){this.editor.update((()=>{const t=$i();wi(t)&&(t.isCollapsed()?this.#$n(t,e):this.#Hn(t,e))}))}#$n(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else e.insertNodes([t()])}#Hn(e,t){const n=this.#Kn(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#Un(n);if(0===r.size)return;const o=this.#Wn(t,r);this.#Vn(e,o),this.#jn(i)}#Kn(e){const t=e.extract().map((e=>this.#qn(e))).filter(Boolean);return vs(null),t}#qn(e){return $o(e)?e:gi(e)&&e.getParent()&&$o(e.getParent())?e.getParent():null}#Un(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#Wn(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(hi(e)),t<r.length-1&&n.append(Zr())})),n}#Vn(e,t){const n=e.anchor.getNode().getParent();n&&n.replace(t)}#jn(e){e.forEach((e=>e.remove()))}#Sn(e){const t=this.#qn(e.anchor.getNode()),n=this.#qn(e.focus.getNode());return t&&t===n?qd(t.getParent())?null:this.#Zn(t)?t:null:null}#Zn(e){return e.getChildren().some((e=>Gr(e)))}#wn(e){const t=[[]];return e.getChildren().forEach((e=>{Gr(e)?t.push([]):t[t.length-1].push(e)})),t}#vn(e,t){const n=new Set(t.getNodes().map((e=>e.getKey())));n.add(t.anchor.getNode().getKey()),n.add(t.focus.getNode().getKey());const r=e.map(((e,t)=>e.some((e=>n.has(e.getKey())))?t:null)).filter((e=>null!==e));return 0===r.length?null:{start:r[0],end:r[r.length-1]}}#kn(e,t,{start:n,end:r},i){const o=[];this.#Gn(o,t.slice(0,n));const s=i();t.slice(n,r+1).forEach((e=>{s.append(this.#Jn(e))})),o.push(s),this.#Gn(o,t.slice(r+1));let l=null;o.forEach((t=>{l?l.insertAfter(t):e.insertBefore(t),l=t})),e.remove()}#Gn(e,t){t.forEach((t=>{e.push(this.#Jn(t))}))}#Jn(e){const t=zo();return 0===e.length?t.append(Zr()):t.append(...e),t}#En(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=kc(e,Iu);if(t){n.add(t);const e=t.getParent();e&&Vu(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#Tn(e){const t=[];for(const n of e){const e=this.#Yn(n);e&&t.push(e)}return t}#Yn(e){const t=e.getParent();if(!t||!Vu(t))return null;const n=zo(),r=this.#Xn(e,n);return e.insertAfter(n),this.#Qn(n,r),e.remove(),n}#Xn(e,t){const n=[];return e.getChildren().forEach((e=>{Vu(e)?n.push(e):t.append(e)})),n}#Qn(e,t){t.forEach((t=>{e.insertAfter(t)}))}#Nn(e){for(const t of e)Vu(t)&&0===t.getChildrenSize()&&t.remove()}#An(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#er(t,n)}#er(e,t){e.selectStart();const n=$i();n&&wi(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#Ln(){const e=$i();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return gi(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#On(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#Fn(e,t,n,r,i){const o=e.getTextContent(),s=o.slice(0,r),l=o.slice(n),a=this.#tr(i)?"⁠":" ",c=this.#nr(e,t,s),u=this.#nr(e,t,l||a);e.replace(c);this.#rr(c,i).insertAfter(u),this.#ir(u.getParentOrThrow());const d=l?0:1;u.select(d,d)}#tr(e){return e.some((e=>e instanceof tm&&e.isInline()))}#nr(e,t,n){const r=e.getParent(),i=r?.getTextFormat?.()||0,o=r?.getTextStyle?.()||"",s=wi(t)&&t.format?t.format:e.getFormat()||i,l=wi(t)&&t.style?t.style:e.getStyle()||o;return hi(n).setFormat(s).setDetail(e.getDetail()).setMode(e.getMode()).setStyle(l)}#rr(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#ir(e){if($o(e)&&this.editorElement.supportsMultiLine){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];gi(n)&&""===n.getTextContent()&&r&&!gi(r)&&e.append(Zr())}}#Pn(e,t={}){return new tm({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#Mn(e){return cd(this.editor,vg(e))[0]||zo()}#Rn(e){return Eg(this.editorElement,"lexxy:file-accept",{file:e},!0)}#In(){const e=$i();if(!wi(e))return;const t=e.anchor.getNode();if(!gm(t))return;const n=zo();t.append(n),n.selectStart()}}function gm(e){return Eo(e)&&tl(e)&&!Oo(e)}function pm(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var fm={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function mm(e){fm=e}var ym={exec:()=>null};function bm(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(_m.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var _m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},xm=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Cm=/(?:[*+-]|\d{1,9}[.)])/,Sm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,wm=bm(Sm).replace(/bull/g,Cm).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),vm=bm(Sm).replace(/bull/g,Cm).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),km=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Em=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Tm=bm(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Em).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Nm=bm(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Cm).getRegex(),Am="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Lm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Om=bm("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Lm).replace("tag",Am).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Fm=bm(km).replace("hr",xm).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Am).getRegex(),Rm={blockquote:bm(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Fm).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Tm,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:xm,html:Om,lheading:wm,list:Nm,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Fm,table:ym,text:/^[^\n]+/},Im=bm("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",xm).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Am).getRegex(),Pm={...Rm,lheading:vm,table:Im,paragraph:bm(km).replace("hr",xm).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Im).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Am).getRegex()},Mm={...Rm,html:bm("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Lm).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ym,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:bm(km).replace("hr",xm).replace("heading"," *#{1,6} *[^\n]").replace("lheading",wm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Dm=/^( {2,}|\\)\n(?!\s*$)/,Bm=/[\p{P}\p{S}]/u,zm=/[\s\p{P}\p{S}]/u,$m=/[^\s\p{P}\p{S}]/u,Hm=bm(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,zm).getRegex(),Km=/(?!~)[\p{P}\p{S}]/u,Um=bm(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Wm=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Vm=bm(Wm,"u").replace(/punct/g,Bm).getRegex(),jm=bm(Wm,"u").replace(/punct/g,Km).getRegex(),qm="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zm=bm(qm,"gu").replace(/notPunctSpace/g,$m).replace(/punctSpace/g,zm).replace(/punct/g,Bm).getRegex(),Gm=bm(qm,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Km).getRegex(),Jm=bm("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,$m).replace(/punctSpace/g,zm).replace(/punct/g,Bm).getRegex(),Ym=bm(/\\(punct)/,"gu").replace(/punct/g,Bm).getRegex(),Xm=bm(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Qm=bm(Lm).replace("(?:--\x3e|$)","--\x3e").getRegex(),ey=bm("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Qm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ty=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ny=bm(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",ty).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ry=bm(/^!?\[(label)\]\[(ref)\]/).replace("label",ty).replace("ref",Em).getRegex(),iy=bm(/^!?\[(ref)\](?:\[\])?/).replace("ref",Em).getRegex(),oy=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,sy={_backpedal:ym,anyPunctuation:Ym,autolink:Xm,blockSkip:Um,br:Dm,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:ym,emStrongLDelim:Vm,emStrongRDelimAst:Zm,emStrongRDelimUnd:Jm,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:ny,nolink:iy,punctuation:Hm,reflink:ry,reflinkSearch:bm("reflink|nolink(?!\\()","g").replace("reflink",ry).replace("nolink",iy).getRegex(),tag:ey,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:ym},ly={...sy,link:bm(/^!?\[(label)\]\((.*?)\)/).replace("label",ty).getRegex(),reflink:bm(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ty).getRegex()},ay={...sy,emStrongRDelimAst:Gm,emStrongLDelim:jm,url:bm(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",oy).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:bm(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",oy).getRegex()},cy={...ay,br:bm(Dm).replace("{2,}","*").getRegex(),text:bm(ay.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},uy={normal:Rm,gfm:Pm,pedantic:Mm},dy={normal:sy,gfm:ay,breaks:cy,pedantic:ly},hy={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},gy=e=>hy[e];function py(e,t){if(t){if(_m.escapeTest.test(e))return e.replace(_m.escapeReplace,gy)}else if(_m.escapeTestNoEncode.test(e))return e.replace(_m.escapeReplaceNoEncode,gy);return e}function fy(e){try{e=encodeURI(e).replace(_m.percentDecode,"%")}catch{return null}return e}function my(e,t){let n=e.replace(_m.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(_m.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(_m.slashPipe,"|");return r}function yy(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==t)break;i++}return e.slice(0,r-i)}function by(e,t,n,r,i){let o=t.href,s=t.title||null,l=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:o,title:s,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}var _y=class{options;rules;lexer;constructor(e){this.options=e||fm}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:yy(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split("\n").map((e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=yy(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:yy(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=yy(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,o=!1,s=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))s.push(e[t]),o=!0;else{if(o)break;s.push(e[t])}e=e.slice(t);let l=s.join("\n"),a=l.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${l}`:l,r=r?`${r}\n${a}`:a;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(a,i,!0),this.lexer.state.top=c,0===e.length)break;let u=i.at(-1);if("code"===u?.type)break;if("blockquote"===u?.type){let t=u,o=t.raw+"\n"+e.join("\n"),s=this.blockquote(o);i[i.length-1]=s,n=n.substring(0,n.length-t.raw.length)+s.raw,r=r.substring(0,r.length-t.text.length)+s.text;break}if("list"!==u?.type);else{let t=u,o=t.raw+"\n"+e.join("\n"),s=this.list(o);i[i.length-1]=s,n=n.substring(0,n.length-u.raw.length)+s.raw,r=r.substring(0,r.length-t.raw.length)+s.raw,e=o.substring(i.at(-1).raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),s=!1;for(;e;){let n=!1,r="",l="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let a=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!a.trim(),d=0;if(this.options.pedantic?(d=2,l=a.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,l=a.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),o=this.rules.other.headingBeginRegex(d),s=this.rules.other.htmlBeginRegex(d);for(;e;){let h,g=e.split("\n",1)[0];if(c=g,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),h=c):h=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||o.test(c)||s.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())l+="\n"+h.slice(d);else{if(u||a.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(a)||o.test(a)||n.test(a))break;l+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),a=h.slice(d)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(s=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(l),g&&(h="[ ] "!==g[0],l=l.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:l,tokens:[]}),i.raw+=r}let l=i.items.at(-1);if(!l)return;l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=my(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?o.align.push("right"):this.rules.other.tableAlignCenter.test(e)?o.align.push("center"):this.rules.other.tableAlignLeft.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<n.length;e++)o.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:o.align[e]});for(let e of i)o.rows.push(my(e,o.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]}))));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=yy(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),by(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return by(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){let n,i,o=[...r[0]].length-1,s=o,l=0,a="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+o);null!=(r=a.exec(t));){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(i=[...n].length,r[3]||r[4]){s+=i;continue}if((r[5]||r[6])&&o%3&&!((o+i)%3)){l+=i;continue}if(s-=i,s>0)continue;i=Math.min(i,i+s+l);let t=[...r[0]][0].length,a=e.slice(0,o+r.index+t+i);if(Math.min(o,i)%2){let e=a.slice(1,-1);return{type:"em",raw:a,text:e,tokens:this.lexer.inlineTokens(e)}}let c=a.slice(2,-2);return{type:"strong",raw:a,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},xy=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||fm,this.options.tokenizer=this.options.tokenizer||new _y,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:_m,block:uy.normal,inline:dy.normal};this.options.pedantic?(t.block=uy.pedantic,t.inline=dy.pedantic):this.options.gfm&&(t.block=uy.gfm,this.options.breaks?t.inline=dy.breaks:t.inline=dy.gfm),this.tokenizer.rules=t}static get rules(){return{block:uy,inline:dy}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(_m.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(_m.tabCharGlobal," ").replace(_m.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let o=t.at(-1);n&&"paragraph"===o?.type?(o.raw+=(o.raw.endsWith("\n")?"":"\n")+r.raw,o.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,o="";for(;e;){let r;if(i||(o=""),i=!1,this.options.extensions?.inline?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);"text"===r.type&&"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let s=e;if(this.options.extensions?.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach((e=>{t=e.call({lexer:this},r),"number"==typeof t&&t>=0&&(n=Math.min(n,t))})),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(s)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(o=r.raw.slice(-1)),i=!0;let n=t.at(-1);"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},Cy=class{options;parser;constructor(e){this.options=e||fm}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(_m.notSpaceStart)?.[0],i=e.replace(_m.endingNewline,"")+"\n";return r?'<pre><code class="language-'+py(r)+'">'+(n?i:py(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:py(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+py(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n="";for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${py(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=fy(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+py(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=fy(e);if(null===i)return py(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${py(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:py(e.text)}},Sy=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},wy=class e{options;renderer;textRenderer;constructor(e){this.options=e||fm,this.options.renderer=this.options.renderer||new Cy,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Sy}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let o=i;switch(o.type){case"space":n+=this.renderer.space(o);continue;case"hr":n+=this.renderer.hr(o);continue;case"heading":n+=this.renderer.heading(o);continue;case"code":n+=this.renderer.code(o);continue;case"table":n+=this.renderer.table(o);continue;case"blockquote":n+=this.renderer.blockquote(o);continue;case"list":n+=this.renderer.list(o);continue;case"html":n+=this.renderer.html(o);continue;case"def":n+=this.renderer.def(o);continue;case"paragraph":n+=this.renderer.paragraph(o);continue;case"text":{let i=o,s=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],s+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:s,text:s,tokens:[{type:"text",raw:s,text:s,escaped:!0}]}):s;continue}default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}let o=i;switch(o.type){case"escape":case"text":n+=t.text(o);break;case"html":n+=t.html(o);break;case"link":n+=t.link(o);break;case"image":n+=t.image(o);break;case"strong":n+=t.strong(o);break;case"em":n+=t.em(o);break;case"codespan":n+=t.codespan(o);break;case"br":n+=t.br(o);break;case"del":n+=t.del(o);break;default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},vy=class{options;block;constructor(e){this.options=e||fm}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?xy.lex:xy.lexInline}provideParser(){return this.block?wy.parse:wy.parseInline}},ky=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=wy;Renderer=Cy;TextRenderer=Sy;Lexer=xy;Tokenizer=_y;Hooks=vy;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Cy(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=n,i=e.renderer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new _y(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=n,i=e.tokenizer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new vy;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=n,i=e.hooks[r],o=t[r];vy.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&vy.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return o.call(t,n)})();let r=i.call(t,e);return o.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return!1===n&&(n=await o.apply(t,e)),n})();let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return xy.lex(e,t??this.defaults)}parser(e,t){return wy.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?xy.lex:xy.lexInline)(n,i),o=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(o,i.walkTokens));let s=await(i.hooks?await i.hooks.provideParser():e?wy.parse:wy.parseInline)(o,i);return i.hooks?await i.hooks.postprocess(s):s})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?xy.lex:xy.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?wy.parse:wy.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return o(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+py(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Ey(e,t){return ky.parse(e,t)}Ey.options=Ey.setOptions=function(e){return ky.setOptions(e),Ey.defaults=ky.defaults,mm(Ey.defaults),Ey},Ey.getDefaults=pm,Ey.defaults=fm,Ey.use=function(...e){return ky.use(...e),Ey.defaults=ky.defaults,mm(Ey.defaults),Ey},Ey.walkTokens=function(e,t){return ky.walkTokens(e,t)},Ey.parseInline=ky.parseInline,Ey.Parser=wy,Ey.parser=wy.parse,Ey.Renderer=Cy,Ey.TextRenderer=Sy,Ey.Lexer=xy,Ey.lexer=xy.lex,Ey.Tokenizer=_y,Ey.Hooks=vy,Ey.parse=Ey,Ey.options,Ey.setOptions,Ey.use,Ey.walkTokens,Ey.parseInline,wy.parse,xy.lex;class Ty{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!(!t||this.#or())&&(this.#sr(t)?(this.#lr(t),e.preventDefault(),!0):this.#ar(t))}#sr(e){return this.#cr(e)||this.#ur(e)}#cr(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#ur(e){const t=Array.from(e.types);return 2===t.length&&t.includes("text/uri-list")&&t.includes("text/plain")}#or(){let e=!1;return this.editor.getEditorState().read((()=>{const t=$i();if(!wi(t))return;let n=t.anchor.getNode();for(;n;){if(bh(n))return void(e=!0);n=n.getParent()}})),e}#lr(e){e.items[0].getAsString((t=>{if(Yf(t)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(t);else if(Yf(t)){const e=this.contents.createLink(t);this.#dr(e,{url:t})}else this.editorElement.supportsMarkdown?this.#hr(t):this.#gr(e)}))}#dr(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};Eg(this.editorElement,"lexxy:insert-link",{...t,...n})}#hr(e){const t=vg(Ey(e,{breaks:!0})),n=Object.freeze({markdown:e,document:t,addBlockSpacing:()=>function(e){const t=e.querySelectorAll("body > :not(h1, h2, h3, h4, h5, h6) + *");for(const n of t){const t=e.createElement("p");t.appendChild(e.createElement("br")),n.before(t)}}(t)});Eg(this.editorElement,"lexxy:insert-markdown",n),this.contents.insertDOM(t,{tag:zr})}#gr(e){this.editor.update((()=>{const t=$i();yd(e,t,this.editor)}),{tag:zr})}#ar(e){if(!this.editorElement.supportsAttachments)return!1;const t=e.getData("text/html"),n=e.files;return n.length&&this.#pr(t)?(this.#fr(n),!0):t?(this.contents.insertHtml(t,{tag:zr}),!0):(this.#fr(n),!0)}#pr(e){if(!e)return!1;const t=vg(e),n=Array.from(t.body.children);return 1===n.length&&"IMG"===n[0].tagName}#fr(e){this.#mr((()=>{e.length&&this.contents.uploadFiles(e,{selectLast:!0})}))}async#mr(e){const t=window.scrollY,n=window.scrollX;e(),await Uf(),window.scrollTo(n,t),this.editor.focus()}}class Ny{constructor(e){this.lexxyElement=e,this.enabledExtensions=this.#yr()}get lexicalExtensions(){return this.enabledExtensions.map((e=>e.lexicalExtension)).filter(Boolean)}initializeToolbars(){this.#br&&this.enabledExtensions.forEach((e=>e.initializeToolbar(this.#br)))}get#br(){return this.lexxyElement.toolbar}get#_r(){return this.lexxyElement.baseExtensions}get#xr(){return Ga.global.get("extensions")}#yr(){return this.#_r.concat(this.#xr).map((e=>new e(this.lexxyElement))).filter((e=>e.enabled))}}function Ay(e,t){const n=t.createDOM(e._config,e);n.style.whiteSpace="pre-wrap",t.hasFormat("lowercase")?n.style.textTransform="lowercase":t.hasFormat("uppercase")?n.style.textTransform="uppercase":t.hasFormat("capitalize")&&(n.style.textTransform="capitalize");let r=n;return t.hasFormat("bold")&&!Ly(n,"strong")&&(r=Oy(r,"b")),t.hasFormat("italic")&&!Ly(n,"em")&&(r=Oy(r,"i")),t.hasFormat("strikethrough")&&(r=Oy(r,"s")),t.hasFormat("underline")&&(r=Oy(r,"u")),{element:r}}function Ly(e,t){const n=t.toUpperCase();return e.tagName===n||null!==e.querySelector(t)}function Oy(e,t){const n=document.createElement(t);return n.appendChild(e),n}class Fy extends Do{$config(){return this.config("provisonal_paragraph",{extends:Do,importDOM:()=>null,$transform:e=>{e.concretizeIfEdited(e),e.removeUnlessRequired(e)}})}static neededBetween(e,t){return!Iy(e,"next")&&!Iy(t,"previous")}createDOM(e){const t=super.createDOM(e),n=this.isSelected($i());return t.classList.add("provisional-paragraph"),t.classList.toggle("hidden",!n),t}updateDOM(e,t){const n=this.isSelected($i());return t.classList.toggle("hidden",!n),!1}getTextContent(){return""}exportDOM(){return{element:null}}isSelected(e=null){const t=e||$i();return t?.getNodes().some((e=>e.is(this)||this.isParentOf(e)))}removeUnlessRequired(e=this.getLatest()){e.required||e.remove()}concretizeIfEdited(e=this.getLatest()){e.getTextContentSize()>0&&e.replace(zo(),!0)}get required(){return this.isDirectRootChild&&Fy.neededBetween(...this.immediateSiblings)}get isDirectRootChild(){return tl(this.getParent())}get immediateSiblings(){return[this.getPreviousSibling(),this.getNextSibling()]}}function Ry(e){return e instanceof Fy}function Iy(e,t){return Eo(e)&&("next"===t?e.canInsertTextBefore():e.canInsertTextAfter())}class Py extends kf{get lexicalExtension(){return{name:"lexxy/provisional-paragraph",nodes:[Fy],register:e=>wa(e.registerNodeTransform(Lo,My),e.registerNodeTransform(Lo,Dy),e.registerCommand(rn,By,3))}}}function My(e){const t=e.getFirstChild();Fy.neededBetween(null,t)&&Lc(e,new Fy);for(const t of Ic(e)){const e=t.getNextSibling();Fy.neededBetween(t,e)&&t.insertAfter(new Fy)}}function Dy(e){for(const t of zy(e))t.removeUnlessRequired()}function By(){for(const e of zy())e.markDirty()}function zy(e=Ss()){return Rc(e.getChildren(),Ry)}const $y="language";class Hy extends kf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/trix-content",html:{import:{em:e=>Ky(e,{conversion:_f("i",Of),priority:1}),span:e=>Ky(e,{conversion:_f("mark",Of),priority:1}),strong:e=>Ky(e,{conversion:_f("b",Of),priority:1}),del:()=>({conversion:_f("s",Uy,Of),priority:1}),pre:e=>function(e,t){return e.hasAttribute($y)?t:null}(e,{conversion:xf(mh,"pre",Wy),priority:1})}}}}}function Ky(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function Uy(e){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),e}function Wy(e,t){const n=Ph(t.getAttribute($y));e.node.setLanguage(n)}class Vy extends ef{$config(){return this.config("wrapped_table_node",{extends:ef})}static importDOM(){return super.importDOM()}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}exportDOM(e){const t=super.exportDOM(e);return{...t,after:e=>{if(t.after){return wg("figure",{className:"lexxy-content__table-wrapper"},(e=t.after(e)).cloneNode(!0).outerHTML)}return e}}}}class jy extends kf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/tables",nodes:[Vy,{replace:ef,with:()=>new Vy,withKlass:Vy},Ig,Hg],register:e=>wa(df(e),function(e,t=!0){const n=new Map,r=(r,i,o)=>{const s=Cp(r,o),l=Tp(r,s,e,t);n.set(i,[l,s])},i=e.registerMutationListener(ef,(t=>{e.getEditorState().read((()=>{for(const[e,i]of t){const t=n.get(e);if("created"===i||"updated"===i){const{tableNode:i,tableElement:o}=yp(e);void 0===t?r(i,e,o):o!==t[1]&&(t[0].removeListeners(),n.delete(e),r(i,e,o))}else"destroyed"===i&&void 0!==t&&(t[0].removeListeners(),n.delete(e))}}),{editor:e})}),{skipInitialization:!1});return()=>{i();for(const[,[e]]of n)e.removeListeners()}}(e,!0),function(e){Xp.add(e)}(e),e.registerNodeTransform(Ig,(e=>{null===e.getBackgroundColor()&&e.setBackgroundColor("")})),e.registerNodeTransform(Ig,(e=>{const t=e.getHeaderStyles();if(t!==Rg)return;const n=e.getParent(),r=n?.getParent();if(!r)return;const i=r.getChildren(),o=n.getChildren().indexOf(e),s=n.getChildren().every((e=>e.getHeaderStyles()!==Fg)),l=i.every((e=>{const t=e.getChildren()[o];return t&&t.getHeaderStyles()!==Fg}));let a=Fg;s&&(a|=Rg),l&&(a|=Og),a!==t&&e.setHeaderStyles(a,Lg)})),e.registerCommand("insertTableRowAfter",(()=>{Xg(!0)}),2),e.registerCommand("insertTableRowBefore",(()=>{Xg(!1)}),2),e.registerCommand("insertTableColumnAfter",(()=>{ep(!0)}),2),e.registerCommand("insertTableColumnBefore",(()=>{ep(!1)}),2),e.registerCommand("deleteTableRow",(()=>{!function(){const e=$i();wi(e)||pp(e)||$g(188);const[t,n]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[r,,i]=cp(t),[o]=cp(n),[s,l,a]=lp(i,r,o),{startRow:c}=l,{startRow:u}=a,d=u+o.__rowSpan-1;if(s.length===d-c+1)return void i.remove();const h=s[0].length,g=s[d+1],p=i.getChildAtIndex(d+1);for(let e=d;e>=c;e--){for(let t=h-1;t>=0;t--){const{cell:n,startRow:r,startColumn:i}=s[e][t];if(i===t){if(r<c||r+n.__rowSpan-1>d){const e=Math.max(r,c),t=Math.min(n.__rowSpan+r-1,d),i=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-i)}if(r>=c&&r+n.__rowSpan-1>d&&e===d){null===p&&$g(122);let r=null;for(let n=0;n<t;n++){const t=g[n],i=t.cell;t.startRow===e+1&&(r=i),i.__colSpan>1&&(n+=i.__colSpan-1)}null===r?rp(p,n):r.insertAfter(n)}}}const t=i.getChildAtIndex(e);Wg(t)||$g(206,String(e)),t.remove()}if(void 0!==g){const{cell:e}=g[0];np(e)}else{const e=s[c-1],{cell:t}=e[0];np(t)}}()}),2),e.registerCommand("deleteTableColumn",(()=>{!function(){const e=$i();wi(e)||pp(e)||$g(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[r,,i]=cp(t),[o]=cp(n),[s,l,a]=lp(i,r,o),{startColumn:c}=l,{startRow:u,startColumn:d}=a,h=Math.min(c,d),g=Math.max(c+r.__colSpan-1,d+o.__colSpan-1),p=g-h+1;if(s[0].length===g-h+1)return i.selectPrevious(),void i.remove();const f=s.length;for(let e=0;e<f;e++)for(let t=h;t<=g;t++){const{cell:n,startColumn:r}=s[e][t];if(r<h){if(t===h){const e=h-r;n.setColSpan(n.__colSpan-Math.min(p,n.__colSpan-e))}}else if(r+n.__colSpan-1>g){if(t===g){const e=g-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}const m=s[u],y=c>d?m[c+r.__colSpan]:m[d+o.__colSpan];if(void 0!==y){const{cell:e}=y;np(e)}else{const e=d<c?m[d-1]:m[c-1],{cell:t}=e;np(t)}const b=i.getColWidths();if(b){const e=[...b];e.splice(h,p),i.setColWidths(e)}}()}),2),e.registerCommand("deleteTable",(()=>{const e=$i();if(!wi(e))return!1;Wp(e.anchor.getNode())?.remove()}),2))}}}class qy extends kf{get enabled(){return this.editorElement.supportsAttachments}get lexicalExtension(){return{name:"lexxy/action-text-attachments",nodes:[jf,rm,sm],register:e=>wa(e.registerCommand(dn,Zy,2))}}}function Zy(e){const t=$i()?.anchor;return!!t&&(!!function(e,t){const n=e.getNode();if(!am(n))return!1;const r=bf(e,t),i=t?n.getPreviousSibling():n.getNextSibling();if(r&&n.collapseWith(i,t)){const e=t?1:n.getChildrenSize()-1;return n.select(e,e),!0}return!1}(t,e)||!!e&&(function(e){const t=e.getNode();if(!t)return!1;const n=$o(t)&&t.isEmpty(),r=cm(t.getPreviousSibling()),i=r?.getChildrenSize();return!(!n||!r?.collapseWith(t.getNextSibling()))&&(r.select(i,i),t.remove(),!0)}(t)||function(e){const t=e.getNode().getPreviousSibling();if(!am(e.getNode())||!bf(e,!0)||!t)return!1;if(Ao(t))return!1;t.isEmpty()?t.remove():t.selectEnd();return!0}(t)))}class Gy extends HTMLElement{static formAssociated=!0;static debug=!1;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#Cr="";#Sr=document.createElement("textarea");constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Tg("lexxy-editor"),this.config=new em(this),this.extensions=new Ny(this),this.editor=this.#wr(),this.contents=new hm(this),this.selection=new Gf(this),this.clipboard=new Ty(this),Kf.configureFor(this),this.#vr(),requestAnimationFrame((()=>Eg(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.#kr(),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#Er()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#f())),"required"===e&&this.isConnected&&(this.#Sr.required=this.hasAttribute("required"),this.#Tr())}formResetCallback(){this.value=this.#Cr,this.editor.dispatchCommand(qn,void 0)}toString(){return this.cachedStringValue||this.editor?.getEditorState().read((()=>{this.cachedStringValue=Jy(Ss())})),this.cachedStringValue}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get toolbarElement(){return this.#Nr?(this.toolbar=this.toolbar||this.#Ar(),this.toolbar):null}get baseExtensions(){return[Py,Lf,Hy,jy,qy]}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isEmpty(){return["<p><br></p>","<p></p>",""].includes(this.value.trim())}get isBlank(){return this.isEmpty||null!==this.toString().match(/^\s*$/g)}get hasOpenPrompt(){return null!==this.querySelector(".lexxy-prompt-menu.lexxy-prompt-menu--visible")}get preset(){return this.getAttribute("preset")||"default"}get supportsAttachments(){return this.config.get("attachments")}get supportsMarkdown(){return this.supportsRichText&&this.config.get("markdown")}get supportsMultiLine(){return this.config.get("multiLine")&&!this.isSingleLineMode}get supportsRichText(){return this.config.get("richText")}get isSingleLineMode(){return this.hasAttribute("single-line")}get contentTabIndex(){return parseInt(this.editorContentElement?.getAttribute("tabindex")??"0")}focus(){this.editor.focus((()=>this.#Lr()))}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=Jf(ud(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{Gs(Kr);const t=Ss();t.clear(),t.append(...this.#Or(e)),t.selectEnd(),this.#Fr(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#Or(e){e||(e="<p></p>");return cd(this.editor,vg(`${e}`)).filter(this.#Rr).map(this.#Ir).map(this.#Pr)}#Rr(e){return!Gr(e)&&(!gi(e)||""!==e.getTextContent().trim())}#Ir(e){if(!gi(e))return e;const t=zo();return t.append(e),t}#Pr(e){if($o(e)&&1===e.getChildrenSize()){const t=e.getFirstChild();if(Ao(t)&&!t.isInline())return t}return e}#vr(){this.#Mr(),this.#Dr(),this.#Br(),this.#zr(),this.#$r(),this.#Hr(),this.#Kr(),this.#Ur()}#wr(){this.editorContentElement||=this.#Wr();const e=function(...e){return _u.fromExtensions(e).buildEditor()}({name:"lexxy/core",namespace:"Lexxy",theme:Sg,nodes:this.#Vr,html:{export:new Map([[ri,Ay]])}},...this.extensions.lexicalExtensions);return e.setRootElement(this.editorContentElement),e}get#Vr(){const e=[tm];return this.supportsRichText&&e.push(Vd,Zd,zu,Iu,mh,kh,Xu,nd,Ng),e}#Wr(){const e=wg("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#jr,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#qr.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#jr(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#qr(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#Zr(e){const t=void 0!==this.#Zr&&this.#Zr!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#Sr.value=this.isEmpty?"":e,t&&Eg(this,"lexxy:change")}get#Zr(){return this._internalFormValue}#Kr(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"<p></p>";this.value=this.#Cr=e}#Ur(){document.addEventListener("turbo:before-cache",this.#Gr)}#Gr=e=>{this.#Er()};#Mr(){this.#Jr(this.editor.registerUpdateListener((({editorState:e})=>{this.#Yr(),this.#Zr=this.value,this.#Fr(),this.#Tr()})))}#Yr(){this.cachedValue=null,this.cachedStringValue=null}#Jr(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#Xr(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#Dr(){this.supportsRichText?(rh(this.editor),Ju(this.editor),this.#Qr(),this.#ei(),this.supportsMarkdown&&(fg(this.editor,dg),function(e,t){const n=t.filter((e=>"text-format"===e.type)).sort(((e,t)=>t.tag.length-e.tag.length));e.registerUpdateListener((({tags:t,dirtyLeaves:r,editorState:i,prevEditorState:o})=>{if(t.has("historic")||t.has("collaboration"))return;if(e.isComposing())return;const s=i.read($i),l=o.read($i);if(!wi(l)||!wi(s)||!s.isCollapsed())return;const a=s.anchor.key,c=s.anchor.offset;if(!r.has(a))return;const u=i.read((()=>ms(a)));if(!gi(u))return;if(c<=(l.anchor.key===a?l.anchor.offset:0))return;const d=i.read((()=>u.getTextContent()));for(const t of n){const n=t.tag,r=n.length,i=c-r;if(i<0)continue;if(d.slice(i,c)!==n)continue;const o=n[0];if(i>0&&d[i-1]===o)continue;if(!1===t.intraword&&i>0){const e=d[i-1];if(e&&!mg.test(e))continue}const s=c,l=d.indexOf(n,s);if(l<0)continue;if(d[l+r]===o)continue;if(l>0&&d[l-1]===o)continue;const u=l;if(!(u<=c)&&" "!==d[c]&&" "!==d[u-1]){if(!1===t.intraword){const e=d[l+r];if(e&&!mg.test(e))continue}e.update((()=>{const e=ms(a);if(!e||!gi(e))return;const n=e.getParent();null===n||bh(n)||yg(e,i,t)}));break}}}))}(this.editor,dg))):function(e){wa(e.registerCommand(dn,(e=>{const t=$i();return!!wi(t)&&(t.deleteCharacter(e),!0)}),0),e.registerCommand(yn,(e=>{const t=$i();return!!wi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(bn,(e=>{const t=$i();return!!wi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(pn,(e=>{const t=$i();if(!wi(t))return!1;if("string"==typeof e)t.insertText(e);else{const n=e.dataTransfer;if(null!=n)md(n,t);else{const n=e.data;n&&t.insertText(n)}}return!0}),0),e.registerCommand(mn,(()=>{const e=$i();return!!wi(e)&&(e.removeText(),!0)}),0),e.registerCommand(hn,(e=>{const t=$i();return!!wi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(gn,(()=>{const e=$i();return!!wi(e)&&(e.insertLineBreak(),!0)}),0),e.registerCommand(kn,(e=>{const t=$i();if(!wi(t))return!1;const n=e,r=n.shiftKey;return!!Ba(t,!0)&&(n.preventDefault(),$a(t,r,!0),!0)}),0),e.registerCommand(wn,(e=>{const t=$i();if(!wi(t))return!1;const n=e,r=n.shiftKey;return!!Ba(t,!1)&&(n.preventDefault(),$a(t,r,!1),!0)}),0),e.registerCommand(On,(t=>!!wi($i())&&(!Od||"ko-KR"!==navigator.language)&&(t.preventDefault(),e.dispatchCommand(dn,!0))),0),e.registerCommand(Rn,(t=>!!wi($i())&&(t.preventDefault(),e.dispatchCommand(dn,!1))),0),e.registerCommand(An,(t=>{if(!wi($i()))return!1;if(null!==t){if((Od||Ld||Rd)&&Ad)return!1;t.preventDefault()}return e.dispatchCommand(hn,!1)}),0),e.registerCommand(Vn,(()=>(zs(),!0)),0),e.registerCommand(Un,(t=>!!wi($i())&&(Id(t,e),!0)),0),e.registerCommand(Wn,(t=>!!wi($i())&&(function(e,t){Id(e,t),t.update((()=>{const e=$i();wi(e)&&e.removeText()}))}(t,e),!0)),0),e.registerCommand(fn,(t=>!!wi($i())&&(function(e,t){e.preventDefault(),t.update((()=>{const t=$i(),n=Nc(e,ClipboardEvent)?e.clipboardData:null;null!=n&&wi(t)&&md(n,t)}),{tag:zr})}(t,e),!0)),0),e.registerCommand(Bn,(e=>!!wi($i())&&(e.preventDefault(),!0)),0),e.registerCommand($n,(e=>!!wi($i())&&(e.preventDefault(),!0)),0))}(this.editor),this.historyState={current:null,redoStack:[],undoStack:[]},xg(this.editor,this.historyState,20)}#Qr(){this.tableTools=wg("lexxy-table-tools"),this.append(this.tableTools)}#ei(){!function(e,t){if(!e.hasNodes([mh,kh]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=zh);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(mh,(t=>{e.getEditorState().read((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=ms(n);null!==t&&Hh(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(mh,(n=>Uh(n,e,t))),e.registerNodeTransform(ri,(n=>$h(n,e,t))),e.registerNodeTransform(kh,(n=>$h(n,e,t))),e.registerCommand(In,(t=>{const n=function(e){const t=$i();if(!wi(t)||!Vh(t))return null;const n=e?Dn:Mn,r=e?Dn:Pn,i=t.anchor,o=t.focus;if(i.is(o))return r;const s=jh(t);if(1!==s.length)return n;const l=s[0];let a,c;0===l.length&&dh(285),t.isBackward()?(a=o,c=i):(a=i,c=o);const u=Lh(l[0]),d=Oh(l[0]),h=_i(u.getKey(),0,"text"),g=_i(d.getKey(),d.getTextContentSize(),"text");return a.isBefore(h)||g.isBefore(c)?n:h.isBefore(a)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(Pn,(()=>!!Vh($i())&&(Gi([mi()]),!0)),1),e.registerCommand(Mn,(e=>qh(Mn)),1),e.registerCommand(Dn,(e=>qh(Dn)),1),e.registerCommand(Tn,(e=>{const t=$i();if(!wi(t)||!Vh(t))return!1;const n=Ss().getFirstDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&Zh(Tn,e)}),1),e.registerCommand(Nn,(e=>{const t=$i();if(!wi(t)||!Vh(t))return!1;const n=Ss().getLastDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&Zh(Nn,e)}),1),e.registerCommand(En,(e=>Gh(En,e)),1),e.registerCommand(vn,(e=>Gh(vn,e)),1)),wa(...n)}(this.editor),this.codeLanguagePicker=wg("lexxy-code-language-picker"),this.append(this.codeLanguagePicker)}#Br(){this.editor.registerCommand(An,(e=>(e.ctrlKey||e.metaKey||!this.supportsMultiLine)&&(e.preventDefault(),!0)),2)}#zr(){this.addEventListener("focusin",this.#ti),this.addEventListener("focusout",this.#ni)}#ti(e){this.#ri(e.target)&&!this.currentlyFocused&&(Eg(this,"lexxy:focus"),this.currentlyFocused=!0)}#ni(e){this.#ri(e.relatedTarget)||(Eg(this,"lexxy:blur"),this.currentlyFocused=!1)}#ri(e){return this.contains(e)||this.toolbarElement?.contains(e)}#Lr(){this.isEmpty&&this.selection.placeCursorAtTheEnd()}#kr(){document.querySelector(":focus")||this.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===this&&this.focus()}#$r(){}#Hr(){this.#Nr&&(this.toolbarElement.setEditor(this),this.extensions.initializeToolbars())}#Ar(){const e=this.config.get("toolbar");return e&&!0!==e?document.getElementById(e):this.#ii()}get#Nr(){return this.supportsRichText&&this.config.get("toolbar")}#ii(){const e=wg("lexxy-toolbar");return e.innerHTML=_c.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),this.prepend(e),e}#Fr(){this.classList.toggle("lexxy-editor--empty",this.isEmpty)}#Tr(){this.#Sr.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#Sr.validity,this.#Sr.validationMessage,this.editorContentElement)}#Er(){this.#Xr(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.codeLanguagePicker&&(this.codeLanguagePicker.remove(),this.codeLanguagePicker=null),this.tableHandler&&(this.tableHandler.remove(),this.tableHandler=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#Gr)}#f(){this.disconnectedCallback(),this.valueBeforeDisconnect=null,this.connectedCallback()}}function Jy(e){if(e instanceof tm)return e.getReadableTextContent();if(Eo(e)){let t="";const n=e.getChildren();for(let e=0;e<n.length;e++){const r=n[e];t+=Jy(r),Eo(r)&&e!==n.length-1&&!r.isInline()&&(t+="\n\n")}return t}return e.getTextContent()}class Yy extends HTMLElement{connectedCallback(){this.container=this.closest("details"),this.container.addEventListener("toggle",this.#oi.bind(this)),this.container.addEventListener("keydown",this.#si.bind(this)),this.#li(this.initialize.bind(this))}disconnectedCallback(){this.container.removeEventListener("keydown",this.#si.bind(this))}get toolbar(){return this.closest("lexxy-toolbar")}get editorElement(){return this.toolbar.editorElement}get editor(){return this.toolbar.editor}initialize(){}close(){this.editor.focus(),this.container.open=!1}async#li(e){await this.toolbar.editorConnected,e()}#oi(){this.container.open&&this.#ai()}async#ai(){this.#ci[0].focus(),this.#b()}#si(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}async#b(){await Uf(),this.#K.forEach(((e,t)=>{e.setAttribute("tabindex",0===t?0:"-1")}))}get#ci(){return Array.from(this.querySelectorAll("button, input"))}get#K(){return Array.from(this.querySelectorAll("button"))}}class Xy extends Yy{connectedCallback(){super.connectedCallback(),this.input=this.querySelector("input"),this.#ui()}#ui(){this.container.addEventListener("toggle",this.#oi.bind(this)),this.addEventListener("submit",this.#di.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#hi.bind(this))}#oi({newState:e}){this.input.value=this.#gi,this.input.required="open"===e}#di(e){const t=e.submitter?.value;this.editor.dispatchCommand(t,this.input.value),this.close()}#hi(){this.editor.dispatchCommand("unlink"),this.close()}get#gi(){let e="";return this.editor.getEditorState().read((()=>{const t=$i();if(!wi(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if(td(n)){e=n.getURL();break}n=n.getParent()}})),e}}const Qy="button.lexxy-highlight-button",eb="[data-command='removeHighlight']",tb=Symbol("no_style");class nb extends Yy{connectedCallback(){super.connectedCallback(),this.#pi()}initialize(){this.#fi(),this.#mi()}#pi(){this.container.addEventListener("toggle",this.#oi.bind(this))}#mi(){this.#yi.forEach((e=>e.addEventListener("click",this.#bi.bind(this)))),this.querySelector(eb).addEventListener("click",this.#_i.bind(this))}#fi(){const e=this.editorElement.config.get("highlight.buttons");this.#xi("color",e.color),this.#xi("background-color",e["background-color"]);const t=Math.max(e.color.length,e["background-color"].length);this.style.setProperty("--max-colors",t)}#xi(e,t){t.forEach(((t,n)=>{this.#Ci.appendChild(this.#Si(e,t,n))}))}#Si(e,t,n){const r=document.createElement("button");return r.dataset.style=e,r.style.setProperty(e,t),r.dataset.value=t,r.classList.add("lexxy-editor__toolbar-button","lexxy-highlight-button"),r.name=e+"-"+n,r}#oi({newState:e}){"open"===e&&this.editor.getEditorState().read((()=>{this.#wi($i())}))}#bi(e){e.preventDefault();const t=e.target.closest(Qy);if(!t)return;const n=t.dataset.style,r=t.dataset.value;this.editor.dispatchCommand("toggleHighlight",{[n]:r}),this.close()}#_i(e){e.preventDefault(),this.editor.dispatchCommand("removeHighlight"),this.close()}#wi(e){if(!wi(e))return;const t=Ka(e,"color",tb),n=Ka(e,"background-color",tb);this.#yi.forEach((e=>{const r=e.dataset.value===t||e.dataset.value===n;e.setAttribute("aria-pressed",r)}));const r=t!==tb||n!==tb;this.querySelector(eb).disabled=!r}get#Ci(){return this.querySelector(".lexxy-highlight-colors")}get#yi(){return Array.from(this.querySelectorAll(Qy))}}class rb{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=wg("li",{role:"option",id:Tg("prompt-item"),tabindex:"0"});return n.classList.add("lexxy-prompt-menu__item"),n.appendChild(t),n}async loadPromptItemsFromUrl(e){try{const t=await fetch(e),n=vg(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class ib extends rb{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#vi(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#vi(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return Xf(e).includes(Xf(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class ob extends ib{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class sb extends ib{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class lb extends rb{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,o)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){o(e)}}),t)})))}(this.fetchFilteredListItems.bind(this),200)}async buildListItems(e=""){return await this.loadAndFilterListItems(e)}promptItemFor(e){return this.promptItemByListItem.get(e)}async fetchFilteredListItems(e){const t=await this.loadPromptItemsFromUrl(this.#ki(e));return this.#vi(t)}#ki(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#vi(e){const t=[];this.promptItemByListItem=new WeakMap;for(const n of e){const e=this.buildListItemElementFor(n);this.promptItemByListItem.set(e,n),t.push(e)}return t}}class ab extends HTMLElement{constructor(){super(),this.keyListeners=[]}static observedAttributes=["connected"];connectedCallback(){this.source=this.#Ei(),this.#Ti(),this.toggleAttribute("connected",!0)}disconnectedCallback(){this.source=null,this.popoverElement=null}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#f()))}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get open(){return this.popoverElement?.classList?.contains("lexxy-prompt-menu--visible")}get closed(){return!this.open}get#Ni(){return!this.supportsSpaceInSearches}#Ei(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new lb(e):new sb(e):new ob(this.querySelectorAll("lexxy-prompt-item"))}#Ti(){const e=this.#Ai.registerUpdateListener((({editorState:t})=>{t.read((()=>{if(this.#Li.isInsideCodeBlock)return;const{node:t,offset:n}=this.#Li.selectedNodeWithOffset();if(t&&gi(t)){const r=t.getTextContent(),i=this.trigger.length;if(n>=i){if(r.slice(n-i,n)===this.trigger){const t=n===i,o=n>i?r[n-i-1]:null;(t||(" "===o||"\n"===o))&&(e(),this.#Oi())}}}}))}))}#Fi(){this.cursorPositionListener=this.#Ai.registerUpdateListener((({editorState:e})=>{this.closed||e.read((()=>{if(this.#Li.isInsideCodeBlock)return void this.#Ri();const{node:e,offset:t}=this.#Li.selectedNodeWithOffset();if(e)if(gi(e)&&t>0){const n=e.getTextContent().slice(0,t).lastIndexOf(this.trigger),r=n+this.trigger.length-1;(-1===n||t<=r)&&this.#Ri()}else this.#Ri()}))}))}#Ii(){this.cursorPositionListener&&(this.cursorPositionListener(),this.cursorPositionListener=null)}get#Ai(){return this.#G.editor}get#G(){return this.closest("lexxy-editor")}get#Li(){return this.#G.selection}async#Oi(){this.popoverElement??=await this.#Pi(),this.#Mi(),await this.#Di(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#Bi(),this.#G.addEventListener("keydown",this.#zi),this.#G.addEventListener("lexxy:change",this.#Di),this.#$i(),this.#Fi()}#$i(){this.keyListeners.push(this.#Ai.registerCommand(An,this.#Hi.bind(this),4)),this.keyListeners.push(this.#Ai.registerCommand(In,this.#Hi.bind(this),4)),this.#Ni&&this.keyListeners.push(this.#Ai.registerCommand(Ln,this.#Hi.bind(this),4)),this.keyListeners.push(this.#Ai.registerCommand(Tn,this.#Ki.bind(this),4)),this.keyListeners.push(this.#Ai.registerCommand(Nn,this.#Ui.bind(this),4))}#Ki(e){return this.#Wi(),e.preventDefault(),!0}#Ui(e){return this.#Vi(),e.preventDefault(),!0}#Bi(){const e=this.#ji[0];e&&this.#qi(e)}get#ji(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#qi(e){this.#Zi(),e.toggleAttribute("aria-selected",!0),e.scrollIntoView({block:"nearest",behavior:"smooth"}),e.focus(),this.#Li.preservingSelection((()=>{this.#G.focus()})),this.#Gi.setAttribute("aria-controls",this.popoverElement.id),this.#Gi.setAttribute("aria-activedescendant",e.id),this.#Gi.setAttribute("aria-haspopup","listbox")}#Zi(){this.#ji.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#Gi.removeAttribute("aria-controls"),this.#Gi.removeAttribute("aria-activedescendant"),this.#Gi.removeAttribute("aria-haspopup")}#Ji(){const{x:e,y:t,fontSize:n}=this.#Li.cursorPosition,r=this.#G.getBoundingClientRect(),i=this.#Gi.getBoundingClientRect(),o=i.top-r.top;this.popoverElement.hasAttribute("data-anchored")||(this.#Yi(e),this.#Xi(t+o),this.popoverElement.toggleAttribute("data-anchored",!0));const s=this.popoverElement.getBoundingClientRect();s.right>window.innerWidth&&this.popoverElement.toggleAttribute("data-clipped-at-right",!0),s.bottom>window.innerHeight&&(this.#Xi(i.height-t+n),this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#Yi(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-x",`${e}px`)}#Xi(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-y",`${e}px`)}#Mi(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-clipped-at-right"),this.popoverElement.removeAttribute("data-anchored")}async#Ri(){this.#Zi(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#G.removeEventListener("lexxy:change",this.#Di),this.#G.removeEventListener("keydown",this.#zi),this.#Qi(),this.#Ii(),await Uf(),this.#Ti()}#Qi(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#Di=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#eo.containsTextBackUntil(this.trigger)?(await this.#to(),await Uf(),this.#Ji()):this.#Ri()};async#to(){const e=this.#eo.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#no(t):this.#ro(),this.#Bi()}#no(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#ro(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=wg("li",{innerHTML:this.#io});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#io(){return this.getAttribute("empty-results")||"Nothing found"}#zi=e=>{"Escape"===e.key?(this.#Ri(),this.#G.focus(),e.stopPropagation()):","===e.key&&(e.preventDefault(),e.stopPropagation(),this.#oo(),this.#Ai.update((()=>{const e=$i();wi(e)&&e.insertText(",")})))};#Vi(){const e=this.#so+1;e<this.#ji.length&&this.#qi(this.#ji[e])}#Wi(){const e=this.#so-1;e>=0&&this.#qi(this.#ji[e])}get#so(){return this.#ji.findIndex((e=>e.hasAttribute("aria-selected")))}get#lo(){return this.#ji[this.#so]}#Hi(e){return e.preventDefault(),e.stopPropagation(),this.#oo(),!0}#oo(){this.#ao(),this.#Ri(),this.#G.focus()}#ao(){const e=this.source.promptItemFor(this.#lo);if(!e)return;const t=Array.from(e.querySelectorAll("template[type='editor']")),n=`${this.trigger}${this.#eo.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#co(t,n):this.#uo(t,n,e.getAttribute("sgid"))}#co(e,t){this.#Ai.update((()=>{const n=e.flatMap((e=>this.#do(e)));this.#eo.replaceTextBackUntil(t,n)}))}#do(e){return cd(this.#Ai,vg(`${e.innerHTML}`))}#uo(e,t,n=null){this.#Ai.update((()=>{const r=this.#ho(e,n).flatMap((e=>[e,this.#go()])).slice(0,-1);this.#eo.replaceTextBackUntil(t,r)}))}#ho(e,t=null){return e.map((e=>this.#po(e.innerHTML,e.getAttribute("content-type")||this.#fo,e.getAttribute("sgid")||t)))}#go(){return hi(" ")}get#fo(){return`application/vnd.${Ga.global.get("attachmentContentTypeNamespace")}.${this.name}`}#po(e,t,n){return new tm({sgid:n,contentType:t,innerHtml:e})}get#eo(){return this.#G.contents}get#Gi(){return this.#G.editorContentElement}async#Pi(){const e=wg("ul",{role:"listbox",id:Tg("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",Qa()),e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#mo),this.#G.appendChild(e),e}#mo=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#qi(t),this.#oo())};#f(){this.disconnectedCallback(),this.connectedCallback()}}class cb extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.#yo(),this.#bo(),this.#_o()}disconnectedCallback(){this.unregisterUpdateListener?.(),this.unregisterUpdateListener=null}#yo(){this.languagePickerElement=this.#xo(),this.languagePickerElement.addEventListener("change",(()=>{this.#Co(this.languagePickerElement.value)})),this.languagePickerElement.setAttribute("nonce",Qa()),this.appendChild(this.languagePickerElement)}#xo(){const e=wg("select",{className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#So)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#So(){const e={...Rh};e.ruby||(e.ruby="Ruby"),e.php||(e.php="PHP"),e.go||(e.go="Go"),e.bash||(e.bash="Bash"),e.json||(e.json="JSON"),e.diff||(e.diff="Diff");const t=Object.entries(e).sort((([,e],[,t])=>e.localeCompare(t))),n=t.findIndex((([e])=>"plain"===e)),r=t.splice(n,1)[0];return Object.fromEntries([r,...t])}#Co(e){this.editor.update((()=>{const t=this.#wo();t&&t.setLanguage(e)}))}#_o(){this.unregisterUpdateListener=this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#wo();e?this.#vo(e):this.#bo()}))}))}#wo(){const e=$i();if(!wi(e))return null;const t=e.anchor.getNode(),n=t.getParent();return bh(t)?t:bh(n)?n:null}#vo(e){const t=e.getLanguage();this.#ko(t),this.#Eo(),this.#To(e)}#ko(e){if(this.languagePickerElement&&e){const t=Ph(e);this.languagePickerElement.value=t}}#To(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top,o=r.right-n.right;this.style.top=`${i}px`,this.style.right=`${o}px`}#Eo(){this.hidden=!1}#bo(){this.hidden=!0}}class ub extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.deleteButton||this.#No()}disconnectedCallback(){this.deleteButton&&this.handleDeleteClick&&this.deleteButton.removeEventListener("click",this.handleDeleteClick),this.handleDeleteClick=null,this.deleteButton=null,this.editor=null,this.editorElement=null}#No(){const e=wg("div",{className:"lexxy-floating-controls__group"});this.deleteButton=wg("button",{className:"lexxy-node-delete",type:"button","aria-label":"Remove"}),this.deleteButton.tabIndex=-1,this.deleteButton.innerHTML='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>\n</svg>',this.handleDeleteClick=()=>this.#Ao(),this.deleteButton.addEventListener("click",this.handleDeleteClick),e.appendChild(this.deleteButton),this.appendChild(e)}#Ao(){this.editor.update((()=>{const e=_s(this);e?.remove()}))}}class db{constructor(e){this.editor=e.editor,this.contents=e.contents,this.selection=e.selection,this.currentTableNodeKey=null,this.currentCellKey=null,this.#Lo()}destroy(){this.currentTableNodeKey=null,this.currentCellKey=null,this.#Oo()}get currentCell(){return this.currentCellKey?this.editor.getEditorState().read((()=>{const e=ms(this.currentCellKey);return e instanceof Ig?e:null})):null}get currentTableNode(){return this.currentTableNodeKey?this.editor.getEditorState().read((()=>{const e=ms(this.currentTableNodeKey);return e instanceof ef?e:null})):null}get currentRowCells(){const e=this.currentRowIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t[e]?.getChildren()??null))??null:null}get currentRowIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){const t=Gg(e);return Jg(t).getChildren().findIndex((e=>e.is(t)))}(e)))??0:0}get currentColumnCells(){const e=this.currentColumnIndex,t=this.tableRows;return t?this.editor.getEditorState().read((()=>t.map((t=>t.getChildAtIndex(e)))))??null:null}get currentColumnIndex(){const e=this.currentCell;return e?this.editor.getEditorState().read((()=>function(e){return Gg(e).getChildren().findIndex((t=>t.is(e)))}(e)))??0:0}get tableRows(){return this.editor.getEditorState().read((()=>this.currentTableNode?.getChildren()))??null}updateSelectedTable(){let e=null,t=null;this.editor.getEditorState().read((()=>{const n=$i();if(!n||!this.selection.isTableCellSelected)return;const r=n.getNodes()[0];e=Up(r),t=Wp(r)})),this.currentCellKey=e?.getKey()??null,this.currentTableNodeKey=t?.getKey()??null}executeTableCommand(e,t=null){"delete"!==e.action||"table"!==e.childType?"toggle"!==e.action?this.#Fo(e,t):this.#Ro(e):this.#Io()}#Fo(e,t=null){this.#Po(),this.editor.dispatchCommand(this.#Mo(e)),this.#Do(e,t)}#Ro(e){const t=e.childType;let n=null,r=null;"row"===t?(n=this.currentRowCells,r=Rg):"column"===t&&(n=this.currentColumnCells,r=Og),n&&0!==n.length&&this.editor.update((()=>{const e=Zg(n[0]);if(!e)return;const t=e.getHeaderStyles()^r;n.forEach((e=>{this.#Bo(e,t,r)}))}))}#Io(){this.#Po(),this.editor.dispatchCommand("deleteTable")}#Po(){this.editor.update((()=>{const e=$i();if(!e)return;const t=e.getNodes()[0];Up(t)?.selectEnd()}))}#Mo(e){const{action:t,childType:n,direction:r}=e;return`${t}Table${Qf(n)}${"insert"==t?Qf(r):""}`}#Bo(e,t,n){const r=Zg(e);r?.setHeaderStyles(t,n)}async#zo(e,t){if(await Uf(),!this.currentTableNode)return;const n=this.tableRows;if(!n)return;const r=n[e];r&&this.editor.update((()=>{const e=Zg(r.getChildAtIndex(t));e?.selectEnd()}))}#Do(e,t=null){const{childType:n,direction:r}=e;let i=this.currentRowIndex,o=null!==t?t:this.currentColumnIndex;const s="delete"===e.action?-1:0,l="after"===r?1:s;"row"===n?i+=l:"column"===n&&(o+=l),this.#zo(i,o)}#$o(){const e=this.tableRows;if(!e)return;const t=e.at(this.currentRowIndex+1);t&&this.editor.update((()=>{t.getChildAtIndex(this.currentColumnIndex)?.selectEnd()}))}#Ho(){const e=this.currentCell;e&&this.editor.update((()=>{e.selectPrevious()}))}#Ko(){this.executeTableCommand({action:"insert",childType:"row",direction:"after"},0)}#Uo(){this.executeTableCommand({action:"delete",childType:"row"},-1)}#Wo(){const e=this.currentTableNode;this.executeTableCommand({action:"delete",childType:"row"}),this.editor.update((()=>{const t=e?.getNextSibling();if($o(t))t.selectStart();else{const e=zo();this.currentTableNode.insertAfter(e),e.selectStart()}}))}#Vo(){if(!this.currentTableNode)return!1;const e=this.currentCell;return!!e&&""===e.getTextContent().trim()}#jo(){if(!this.currentTableNode)return!1;const e=this.tableRows;return!!e&&e.length===this.currentRowIndex+1}#qo(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&e.every((e=>""===e.getTextContent().trim()))}#Zo(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&0===e.indexOf(this.currentCell)}#Lo(){this.unregisterBackspaceKeyHandler=this.editor.registerCommand(On,(e=>this.#Go(e)),3),this.unregisterEnterKeyHandler=this.editor.registerCommand(An,(e=>this.#ut(e)),3)}#Oo(){this.unregisterBackspaceKeyHandler?.(),this.unregisterEnterKeyHandler?.(),this.unregisterBackspaceKeyHandler=null,this.unregisterEnterKeyHandler=null}#Go(e){return!!this.currentTableNode&&(this.#qo()&&this.#Zo()?(e.preventDefault(),this.#Uo(),!0):!(!this.#Vo()||this.#Zo())&&(e.preventDefault(),this.#Ho(),!0))}#ut(e){return!(e.ctrlKey||e.metaKey||e.shiftKey||!this.currentTableNode)&&(!this.selection.isInsideList&&!this.selection.isInsideCodeBlock&&(e.preventDefault(),this.#jo()&&this.#qo()?this.#Wo():this.#jo()?this.#Ko():this.#$o(),!0))}}var hb={"insert-row-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 15C8.29055e-07 15.8284 0.671574 16.5 1.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V4.5L16.4922 4.34668C16.4154 3.59028 15.7767 3 15 3H13.5L13.5 4.5H15V9H1.5L1.5 4.5L3 4.5V3H1.5C0.671574 3 1.20956e-06 3.67157 1.24577e-06 4.5L7.86804e-07 15ZM15 10.5V15H1.5L1.5 10.5H15Z"/>\n <path d="M4.5 4.5H7.5V7.5H9V4.5H12L12 3L9 3V6.55671e-08L7.5 0V3L4.5 3V4.5Z"/>\n </svg>',"insert-row-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86804e-07 13.5C7.50592e-07 14.3284 0.671574 15 1.5 15H3V13.5H1.5L1.5 9L15 9V13.5H13.5V15H15C15.7767 15 16.4154 14.4097 16.4922 13.6533L16.5 13.5V3L16.4922 2.84668C16.4205 2.14069 15.8593 1.57949 15.1533 1.50781L15 1.5L1.5 1.5C0.671574 1.5 1.28803e-06 2.17157 1.24577e-06 3L7.86804e-07 13.5ZM15 3V7.5L1.5 7.5L1.5 3L15 3Z"/>\n <path d="M7.5 15V18H9V15H12V13.5H9V10.5H7.5V13.5H4.5V15H7.5Z"/>\n </svg>',"delete-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M16.4922 12.1533C16.4154 12.9097 15.7767 13.5 15 13.5L12 13.5V12H15V6L1.5 6L1.5 12H4.5V13.5H1.5C0.723337 13.5 0.0846104 12.9097 0.00781328 12.1533L7.86804e-07 12L1.04907e-06 6C1.17362e-06 5.22334 0.590278 4.58461 1.34668 4.50781L1.5 4.5L15 4.5C15.8284 4.5 16.5 5.17157 16.5 6V12L16.4922 12.1533Z"/>\n <path d="M10.3711 15.9316L8.25 13.8096L6.12793 15.9316L5.06738 14.8711L7.18945 12.75L5.06738 10.6289L6.12793 9.56836L8.25 11.6895L10.3711 9.56836L11.4316 10.6289L9.31055 12.75L11.4316 14.8711L10.3711 15.9316Z"/>\n </svg>',"toggle-row":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M0.00781328 13.6533C0.0846108 14.4097 0.723337 15 1.5 15L15 15L15.1533 14.9922C15.8593 14.9205 16.4205 14.3593 16.4922 13.6533L16.5 13.5V4.5L16.4922 4.34668C16.4205 3.64069 15.8593 3.07949 15.1533 3.00781L15 3L1.5 3C0.671574 3 1.24863e-06 3.67157 1.18021e-06 4.5L7.86804e-07 13.5L0.00781328 13.6533ZM15 9V13.5L1.5 13.5L1.5 9L15 9Z"/>\n </svg>',"insert-column-before":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 0C3.67157 0 3 0.671573 3 1.5V3H4.5V1.5H9V15H4.5V13.5H3V15C3 15.7767 3.59028 16.4154 4.34668 16.4922L4.5 16.5H15L15.1533 16.4922C15.8593 16.4205 16.4205 15.8593 16.4922 15.1533L16.5 15V1.5C16.5 0.671573 15.8284 6.03989e-09 15 0H4.5ZM15 15H10.5V1.5H15V15Z"/>\n <path d="M3 7.5H0V9H3V12H4.5V9H7.5V7.5H4.5V4.5H3V7.5Z"/>\n </svg>',"insert-column-after":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 0C14.3284 0 15 0.671573 15 1.5V3H13.5V1.5H9V15H13.5V13.5H15V15C15 15.7767 14.4097 16.4154 13.6533 16.4922L13.5 16.5H3L2.84668 16.4922C2.14069 16.4205 1.57949 15.8593 1.50781 15.1533L1.5 15V1.5C1.5 0.671573 2.17157 6.03989e-09 3 0H13.5ZM3 15H7.5V1.5H3V15Z"/>\n <path d="M15 7.5H18V9H15V12H13.5V9H10.5V7.5H13.5V4.5H15V7.5Z"/>\n </svg>',"delete-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M12.1533 0.0078125C12.9097 0.0846097 13.5 0.723336 13.5 1.5V4.5H12V1.5H6V15H12V12H13.5V15C13.5 15.7767 12.9097 16.4154 12.1533 16.4922L12 16.5H6C5.22334 16.5 4.58461 15.9097 4.50781 15.1533L4.5 15V1.5C4.5 0.671573 5.17157 2.41596e-08 6 0H12L12.1533 0.0078125Z"/>\n <path d="M15.9316 6.12891L13.8105 8.24902L15.9326 10.3711L14.8711 11.4316L12.75 9.31055L10.6289 11.4316L9.56738 10.3711L11.6885 8.24902L9.56836 6.12891L10.6289 5.06836L12.75 7.18848L14.8711 5.06836L15.9316 6.12891Z"/>\n </svg>',"toggle-column":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.6533 17.9922C14.4097 17.9154 15 17.2767 15 16.5L15 3L14.9922 2.84668C14.9205 2.14069 14.3593 1.57949 13.6533 1.50781L13.5 1.5L4.5 1.5L4.34668 1.50781C3.59028 1.58461 3 2.22334 3 3L3 16.5C3 17.2767 3.59028 17.9154 4.34668 17.9922L4.5 18L13.5 18L13.6533 17.9922ZM9 3L13.5 3L13.5 16.5L9 16.5L9 3Z"/>\n </svg>',"delete-table":'<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.2041 1.01074C12.2128 1.113 13 1.96435 13 3V4H15L15.1025 4.00488C15.6067 4.05621 16 4.48232 16 5C16 5.55228 15.5523 6 15 6H14.8457L14.1416 15.1533C14.0614 16.1953 13.1925 17 12.1475 17H5.85254L5.6582 16.9902C4.76514 16.9041 4.03607 16.2296 3.88184 15.3457L3.8584 15.1533L3.1543 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H5V3C5 1.89543 5.89543 1 7 1H11L11.2041 1.01074ZM5.85254 15H12.1475L12.8398 6H5.16016L5.85254 15ZM7 4H11V3H7V4Z"/>\n </svg>'};class gb extends HTMLElement{connectedCallback(){this.tableController=new db(this.#G),this.classList.add("lexxy-floating-controls"),this.#fi(),this.#bo(),this.#Jo(),this.#Yo()}disconnectedCallback(){this.#Xo(),this.unregisterUpdateListener?.(),this.unregisterUpdateListener=null,this.removeEventListener("keydown",this.#Qo),this.tableController?.destroy(),this.tableController=null}get#Ai(){return this.#G.editor}get#G(){return this.closest("lexxy-editor")}get#es(){return Array.from(this.querySelectorAll("button, details > summary"))}#fi(){this.appendChild(this.#ts()),this.appendChild(this.#ns()),this.appendChild(this.#rs()),this.addEventListener("keydown",this.#Qo)}#is(e,t,n){const r=wg("div",{className:`lexxy-floating-controls__group lexxy-table-control lexxy-table-control--${e}`}),i=this.#Si(`Add ${e}`,{action:"insert",childType:e,direction:"after"},"+"),o=this.#Si(`Remove ${e}`,{action:"delete",childType:e},"−"),s=wg("details",{className:"lexxy-table-control__more-menu"});s.setAttribute("name","lexxy-dropdown"),s.tabIndex=-1;const l=wg("summary",{},`_ ${e}s`);return t(l),s.appendChild(l),s.appendChild(n),r.appendChild(o),r.appendChild(s),r.appendChild(i),r}#ts(){return this.#is("row",(e=>{this.rowCount=e}),this.#os("row"))}#ns(){return this.#is("column",(e=>{this.columnCount=e}),this.#os("column"))}#os(e){const t=wg("div",{className:"lexxy-floating-controls__group lexxy-table-control__more-menu-details"}),n=this.#Si(`Add ${e} before`,{action:"insert",childType:e,direction:"before"}),r=this.#Si(`Add ${e} after`,{action:"insert",childType:e,direction:"after"}),i=this.#Si(`Toggle ${e} style`,{action:"toggle",childType:e}),o=this.#Si(`Remove ${e}`,{action:"delete",childType:e});return t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(o),t}#rs(){const e=wg("div",{className:"lexxy-table-control lexxy-floating-controls__group"}),t=this.#Si("Delete this table?",{action:"delete",childType:"table"});return t.classList.add("lexxy-table-control__button--delete-table"),e.appendChild(t),this.deleteContainer=e,e}#Si(e,t={},n=this.#ss(t)){const r=wg("button",{className:"lexxy-table-control__button","aria-label":e,type:"button"});return r.tabIndex=-1,r.innerHTML=`${n} <span>${e}</span>`,r.dataset.action=t.action,r.dataset.childType=t.childType,r.dataset.direction=t.direction,r.addEventListener("click",(()=>this.#ls(t))),r.addEventListener("mouseover",(()=>this.#as())),r.addEventListener("focus",(()=>this.#as())),r.addEventListener("mouseout",(()=>this.#as())),r}#Yo(){this.unregisterKeyboardShortcuts=this.#Ai.registerCommand(Sn,this.#cs,3)}#Xo(){this.unregisterKeyboardShortcuts?.(),this.unregisterKeyboardShortcuts=null}#cs=e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F10"===e.key){const e=this.querySelector("button, [tabindex]:not([tabindex='-1'])");e?.focus()}};#Qo=e=>{"Escape"===e.key?this.#us():ec(this.#es,e)};#us(){const e=this.tableController.currentCell;e&&(this.#Ai.update((()=>{e.select(),this.#Ai.focus()})),this.#ds())}async#as(){await Uf(),this.#hs();const e=this.querySelector("button:hover, button:focus");if(!e)return;const t={action:e.dataset.action,childType:e.dataset.childType,direction:e.dataset.direction};let n=null;switch(t.childType){case"row":n=this.tableController.currentRowCells;break;case"column":n=this.tableController.currentColumnCells;break;case"table":n=this.tableController.tableRows}n&&n.forEach((e=>{const n=this.#Ai.getElementByKey(e.getKey());n&&(n.classList.toggle(Sg.tableCellHighlight,!0),Object.assign(n.dataset,t))}))}#Jo(){this.unregisterUpdateListener=this.#Ai.registerUpdateListener((()=>{this.tableController.updateSelectedTable();this.tableController.currentTableNode?this.#Eo():this.#bo()}))}#ls(e){this.tableController.executeTableCommand(e),this.#ds()}#Eo(){this.#gs(),this.style.display="flex",this.#ps(),this.#fs(),this.#as()}#bo(){this.style.display="none",this.#hs()}#ds(){this.#gs(),this.#ps(),this.#fs(),this.#as()}#fs(){this.querySelector("details[open]")?.removeAttribute("open")}#gs(){const e=this.tableController.currentTableNode;if(!e)return;const t=this.#Ai.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.#G.getBoundingClientRect(),i=n.top-r.top,o=(n.left+n.right)/2-r.left;this.style.top=`${i}px`,this.style.left=`${o}px`}#ps(){const e=this.tableController.currentTableNode;if(!e)return;const t=tf(this.#Ai,e);if(!t)return;const n=t.rows,r=t.columns;this.rowCount.textContent=`${n} row${1===n?"":"s"}`,this.columnCount.textContent=`${r} column${1===r?"":"s"}`}#ms(){const e=this.tableController.currentCell;if(!e)return;const t=this.#Ai.getElementByKey(e.getKey());t&&t.classList.add(Sg.tableCellFocus)}#hs(){this.#G.querySelectorAll(`.${Sg.tableCellFocus}`)?.forEach((e=>{e.classList.remove(Sg.tableCellFocus)})),this.#G.querySelectorAll(`.${Sg.tableCellHighlight}`)?.forEach((e=>{e.classList.remove(Sg.tableCellHighlight),e.removeAttribute("data-action"),e.removeAttribute("data-child-type"),e.removeAttribute("data-direction")})),this.#ms()}#ss(e){const{action:t,childType:n}=e,r=[t,n,"insert"==t?e.direction:null].filter(Boolean).join("-");return hb[r]}}function pb(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(/<br\s*\/?>/gi,"\n");const r=o.languages?.[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=o.highlight(n,r,t),s=wg("code",{"data-language":t,innerHTML:i});e.replaceWith(s)}(e)}))}const fb=Ga.configure;setTimeout((function(){const e={"lexxy-toolbar":_c,"lexxy-editor":Gy,"lexxy-link-dropdown":Xy,"lexxy-highlight-dropdown":nb,"lexxy-prompt":ab,"lexxy-code-language-picker":cb,"lexxy-node-delete-button":ub,"lexxy-table-tools":gb};Object.entries(e).forEach((([e,t])=>{customElements.define(e,t)}))}),0);export{qf as $createActionTextAttachmentNode,om as $createActionTextAttachmentUploadNode,Zf as $isActionTextAttachmentNode,jf as ActionTextAttachmentNode,rm as ActionTextAttachmentUploadNode,tm as CustomActionTextAttachmentNode,kf as Extension,Ng as HorizontalDividerNode,fb as configure,pb as highlightAll,pb as highlightCode};