lexxy 0.9.2.beta → 0.9.4.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.
- checksums.yaml +4 -4
- data/app/assets/javascript/lexxy.js +1719 -920
- data/app/assets/javascript/lexxy.js.br +0 -0
- data/app/assets/javascript/lexxy.js.gz +0 -0
- data/app/assets/javascript/lexxy.js.map +1 -1
- data/app/assets/javascript/lexxy.min.js +3 -3
- data/app/assets/javascript/lexxy.min.js.br +0 -0
- data/app/assets/javascript/lexxy.min.js.gz +0 -0
- data/app/assets/stylesheets/lexxy-editor.css +8 -11
- data/lib/action_text/editor/lexxy_editor.rb +17 -0
- data/lib/lexxy/engine.rb +29 -14
- data/lib/lexxy/version.rb +1 -1
- data/lib/lexxy.rb +23 -15
- metadata +26 -25
|
@@ -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,"&").replace(/</g,"<").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,
|
|
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,"&").replace(/</g,"<").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),I=v.slice(T+O.length),R=w+v.length;d&&R>d.reach&&(d.reach=R);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)),I&&c(t,S,I),E>1){var M={cause:h+","+p,reach:R};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,""")+'"';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
|
*
|
|
@@ -6,6 +6,6 @@ var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?windo
|
|
|
6
6
|
* @author Lea Verou <https://lea.verou.me>
|
|
7
7
|
* @namespace
|
|
8
8
|
* @public
|
|
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(/&/,"&"))})),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(/&/,"&"))})),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;
|
|
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(/&/,"&"))})),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(/&/,"&"))})),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.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),C=R(Array.prototype.push),S=R(Array.prototype.splice),v=R(String.prototype.toLowerCase),w=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]:v;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"]),$=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"]),z=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"]),q=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"]),j=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:ve}=oe,we=null;const ke=I({},[...B,...$,...z,...K,...W]);let Ee=null;const Te=I({},[...V,...q,...j,...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,$e=!1,ze=!1,He=!1,Ke=!1,Ue=!1,We=!0,Ve=!1,qe=!0,je=!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],w);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?w:v,we=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,w):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,ze=e.FORCE_BODY||!1,We=!1!==e.SANITIZE_DOM,Ve=e.SANITIZE_NAMED_PROPS||!1,qe=!1!==e.KEEP_CONTENT,je=e.IN_PLACE||!1,ve=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&&(we=I({},W),Ee=[],!0===Ze.html&&(I(we,B),I(Ee,V)),!0===Ze.svg&&(I(we,$),I(Ee,q),I(Ee,Z)),!0===Ze.svgFilters&&(I(we,z),I(Ee,q),I(Ee,Z)),!0===Ze.mathMl&&(I(we,K),I(Ee,j),I(Ee,Z))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Oe.tagCheck=e.ADD_TAGS:(we===ke&&(we=M(we)),I(we,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)),qe&&(we["#text"]=!0),Be&&I(we,["html","head","body"]),we.table&&(I(we,["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(ze)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},vt=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)},wt=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),wt(e))return xt(e),!0;const r=gt(e.nodeName);if(Et(pe.uponSanitizeElement,e,{tagName:r,allowedTags:we}),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))&&(!we[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(qe&&!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=v(e.tagName),r=v(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(ve,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||wt(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),wt(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=vt(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($e||yt(t),n.removed=[],"string"==typeof e&&(je=!1),je){if(e.nodeName){const t=gt(e.nodeName);if(!we[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&&ze&&xt(r.firstChild);const u=vt(je?e:r);for(;l=u.nextNode();)Tt(l),Lt(l),l.content instanceof s&&Ot(l.content);if(je)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&&we["!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]:{}),$e=!0},n.clearConfig=function(){pt=null,$e=!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),ve=fe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),we=fe&&Se&&ve,ke=fe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&ye&&!ve,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="֑-߿יִ-﷽ﹰ-ﻼ",$e="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",ze=new RegExp("^[^"+$e+"]*["+Be+"]"),He=new RegExp("^[^"+Be+"]*["+$e+"]"),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"},qe={normal:0,segmented:2,token:1},je={[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(vi(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&&!Sl(i);i=js(i)){const e=bs(i,t);if(void 0!==e){const t=ms(e,n);if(t)return Ao(t)||!ul(i)?void 0:[i,t]}else if(i===r)return[r,vs(n)]}}function rt(e,t,n){Je=!0;const r=performance.now()-Ye>100;try{So(e,(()=>{const i=zi()||function(e){return e.getEditorState().read((()=>{const e=zi();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=(ul(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&&ws(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(ml(),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 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),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 wt,kt,Et,Tt,Nt,At,Lt,Ot,Ft,Rt,It="",Pt=null,Mt=null,Dt=!1,Bt=!1;function $t(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);zt(e,0,e.length-1,null)}void 0!==n&&Hs(Rt,Et,Tt,n,"destroyed")}function zt(e,t,n,r){for(let i=t;i<=n;++i){const t=e[i];void 0!==t&&$t(t,r)}}function Ht(e,t){e.setProperty("text-align",t)}const Kt="40px";function Ut(e,t){const n=wt.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 qt(e,t){const n=Ot.get(e);void 0===n&&ge(60);const r=n.createDOM(wt,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;jt(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,wt);null!==t&&Xt(e,t),r.contentEditable="false"}It+=t}return null!==t&&t.insertChild(r),Hs(Rt,Et,Tt,n,"created"),r}function jt(e,t,n,r,i){const o=It;It="";let s=n;for(;s<=r;++s){qt(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=qs(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,wt)){const n=qt(e,null);return null===t&&ge(62),t.replaceChild(n,o),$t(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=qt(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}$t(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&&jt(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;zt(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)),$t(e,o.element),d++,a.delete(e);continue}if(a.has(r)){const e=qs(kt,r);e!==u&&o.withBefore(u).insertChild(e),u=Qt(Yt(r,o.element)),d++,h++}else qt(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);jt(n,0,h,l,o.withBefore(t))}else p&&!g&&zt(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(qs(kt,e.getKey()),e)}else{const t=r.getTextContent();if(Ao(r)){const t=r.decorate(kt,wt);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"),vn=nn("KEY_ARROW_RIGHT_COMMAND"),wn=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"),$n=nn("FORMAT_ELEMENT_COMMAND"),zn=nn("DRAGSTART_COMMAND"),Hn=nn("DRAGOVER_COMMAND"),Kn=nn("DRAGEND_COMMAND"),Un=nn("COPY_COMMAND"),Wn=nn("CUT_COMMAND"),Vn=nn("SELECT_ALL_COMMAND"),qn=nn("CLEAR_EDITOR_COMMAND"),jn=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;dl(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=zi(),r=ll(Xs(t)),i=Hi();if(r)if(vi(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=kl(o,(e=>Eo(e)&&!e.isInline()));Eo(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(ul(n)||ss(n))&&ws($i(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 ws(null);if(!Qo(t,r,o))return;let l=zi();if(gr&&vi(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(),ws(l))}if(gr=null,vi(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=zi();if("deleteContentBackward"===t){if(null===i){const e=Hi();if(!vi(e))return!0;ws(e.clone())}if(vi(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),vi(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=we&&t&&!l&&s;if(a&&i.isCollapsed()&&(a=!Ao(Us(i.anchor,!0))),!a){Vs(r,dn,!0);const e=zi();we&&vi(e)&&e.isCollapsed()&&(gr=e,setTimeout((()=>gr=null)))}}return!0}}var o;if(!vi(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(ul(e.target)&&Yo(e.target))return!0;const t=co(),n=zi(),r=e.data,i=xr(e);if(null!=r&&vi(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),we&&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 vr(e){const t=co(),n=zi();if(vi(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 wr(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=zi();if(vi(t)||ki(t)){if(vi(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,vn,e);else if(function(e){return Is(e,"ArrowRight",Ps)}(e))Vs(t,wn,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||vi(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;(ul(i)||ss(i))&&ws($i(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=zi();if(!vi(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(vi(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(vi(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||zi();if(null==t)return!1;const n=t.getNodes().some((e=>e.__key===this.__key));if(gi(this))return n;if(vi(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?na(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=na(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===Ql(t):("same"!==t.type&&"ancestor"!==t.type&&ge(279),!1)))}isParentOf(e){const t=na(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=zi();if(null!==s&&s.setCachedNodes(null),o.has(r))return gs(i),i;const l=xl(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=zi();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)}))),vi(n)){ws(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=zi();let s=!1,l=!1;if(null!==i){const t=e.getIndexWithinParent();if(hs(r),vi(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&&vi(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=zi();return t&&vi(c)&&Ki(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return $o()}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",$r="paste",zr="collaboration",Hr="skip-scroll-into-view",Kr="skip-dom-selection",Ur="skip-selection-focus",Wr="composition-start",Vr="composition-end";class qr extends Mr{static getType(){return"linebreak"}static clone(e){return new qr(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&&pl(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&&pl(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:jr,priority:0}}}static importJSON(e){return Zr().updateFromJSON(e)}}function jr(e){return{node:Zr()}}function Zr(){return rl(new qr)}function Gr(e){return e instanceof qr}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=zs(i,"base");void 0!==s&&o.add(...s),s=zs(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=zs(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 je[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 ul(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=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){so();let n=e,r=t;const i=zi(),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(!vi(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=zi();if(r&&vi(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=zi();if(vi(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,_),vi(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=zi();if(vi(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(!ul(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,ul(n)){const e=n.style.display;if(""===e&&!gl(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=zs(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:Xl(ha(ra(this,"next")),ha(ra(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((zi()||Hi())===this&&e[0]){const t=zl(e[0],"next");oa(Jl(t,t))}for(const t of e)t.remove()}}function vi(e){return e instanceof wi}class wi{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!!vi(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(Ml(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),Pl(e.focus)&&Eo(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=Wl(e.focus.origin,"previous");Ml(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Vl(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=ha(e.anchor),r=ha(e.anchor.getFlipped()),i=e=>Il(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(fa(la(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 wi(_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),zo(o))o.splice(0,0,[s]);else{const e=Oo(i)?$o().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&&ia(s,ha(ra(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=zi()===this;sa(this,da(la(this))),e&&zi()!==this&&ws(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=zi();return vi(t)||ge(134),t.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),n=kl(t,fl),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=$o();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)&&fl(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=kl(o,fl);l&&Eo(d)&&(l.canMergeWhenEmpty()||fl(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=$o();return Ss().splice(this.anchor.offset,0,[e]),e.select(),e}const e=Ji(this),t=kl(this.anchor.getNode(),fl);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=qs(i,this.anchor.key),t=qs(i,this.focus.key);"text"===this.anchor.type&&(e=as(e)),"text"===this.focus.type&&(t=as(t)),e&&t&&qi(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=Zl(ra(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(Ml(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=ha(t);sa(this,Jl(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(Pl(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()),ws(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return sa(this,Jl(!t.origin.isEmpty()&&n.isEmpty()?aa(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(ul(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=Kl(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=Kl(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,Kl(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,vi(o)?o.anchor:null,i);if(null===s)return null;const l=Oi(n,r,vi(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 wi(_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 wi(e,t,0,"")}function Bi(){return new Si(new Set)}function $i(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(vi(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)&&vi(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(vi(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 wi(p,f,m,y)}function zi(){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 qi(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function ji(e,t,n){const r=qs(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(zr)&&d!==o||null!==d&&Xo(d))return;if(!vi(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]=ji(n,p,h.offset),[b,_]=ji(n,f,g.offset),x=t.format,C=t.style,S=t.isCollapsed();let v=m,w=b,k=!1;var E,T,N,A,L;if("text"===h.type?(v=as(m),k=p.getFormat()!==x||p.getStyle()!==C):vi(e)&&"text"===e.anchor.type&&(k=!0),"text"===g.type&&(w=as(b)),null!==v&&null!==w&&(S&&(null===e||k||vi(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!==v||a!==w||"Range"===r.type&&S||(null!==d&&o.contains(d)||i.has(Ur)||o.focus({preventScroll:!0}),"element"===h.type))){if(qi(r,v,y,w,_),!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=vi(t)&&"element"===t.anchor.type?v.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=js(c)}}(n,t,o)}}lr=!0}}function Gi(e){let t=zi()||Hi();null===t&&(t=Ss().selectEnd()),t.insertNodes(e)}function Ji(e){let t=e;e.isCollapsed()||t.removeText();const n=zi();vi(n)&&(t=n),vi(t)||ge(161);const r=t.anchor;let i=r.getNode(),o=r.offset;for(;!fl(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=$o();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 wi(_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=ra(e.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===t;let a=o,c="decorators-and-blocks"===i;if(!ga(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 Zl(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Ml(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()),ws(e),!0}return a=ha(a),l&&ia(e.anchor,a),ia(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,wt=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,wt=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(vi(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=Ca(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),vi(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();qo(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 vi(n)||null==n?$i(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(vi(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(vi(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 vo{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new vo(this.element,e,this.after)}withAfter(e){return new vo(this.element,this.before,e)}withElement(e){return this.element===e?this:new vo(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=wo(t,n);i.push(r);const o=wo(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 wo(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=zi();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 vi(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=zi();if(vi(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 vo(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(ul(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=zs(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(ul(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return $o().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=$o();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=$o();if(e.style&&(t.setFormat(e.style.textAlign),Cl(e,t)),""===t.getFormatType()){const n=e.getAttribute("align");n&&n&&n in We&&t.setFormat(n)}return{node:t}}function $o(){return rl(new Do)}function zo(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,qr,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,vr,0),e.registerCommand(un,wr,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=_l(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=_l(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=zs(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,zn,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,qo(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=zi(),i=Ss();null!==r?r.dirty||ws(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 qo(e){Vo=e}let jo=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(!ul(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=js(t)}return null}function ns(e){return e?e.__lexicalEditor:null}function rs(e){return ze.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 dl(e)&&3===e.nodeType}function ls(e){return dl(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=""+jo++;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=js(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 vs(ao())}function vs(e){return e._nodeMap.get("root")}function ws(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=js(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||vi(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=zi();if(!vi(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),vi(n)){const t=e.getKey();for(const r of["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===t&&(i.offset=Kl(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 $s(e){const t=Ss();if(vi(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 ws(St(e)),e}}function zs(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=Ca(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 qs(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&ge(75,t),n}function js(e){const t=e.assignedSlot||e.parentElement;return hl(t)?t.host:t}function Zs(e){return ls(e)?e:ul(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,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]}function cl(e){return ul(e)&&"A"===e.tagName}function ul(e){return dl(e)&&1===e.nodeType}function dl(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function hl(e){return dl(e)&&11===e.nodeType}function gl(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 pl(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 fl(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 ml(){return co()}const yl=new WeakMap,bl=new Map;function _l(e){if(!e._readOnly&&e.isEmpty())return bl;e._readOnly||ge(192);let t=yl.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),yl.set(e,t)),t}function xl(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 Sl(e){return!0===e.__lexicalUnmanaged}function vl(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&&vl(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&&(vl(e,"getType")||(e.getType=()=>o),vl(e,"clone")||(e.clone=t=>(qo(t),new e)),vl(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!vl(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}const kl=(e,t)=>{let n=e;for(;null!=n&&!Oo(n);){if(t(n))return n;n=n.getParent()}return null},El={next:"previous",previous:"next"};class Tl{origin;constructor(e){this.origin=e}[Symbol.iterator](){return Yl({hasNext:Pl,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 Nl extends Tl{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Wl(e,this.direction)}getParentCaret(e="root"){return zl(Ol(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ll(this.direction);return zl(this.getNodeAtCaret(),e)||Wl(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Nl&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Al={root:Oo,shadowRoot:tl};function Ll(e){return El[e]}function Ol(e,t="root"){return Al[t](e)?null:e}class Fl extends Tl{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)?Wl(this.origin,this.direction):null}getParentCaret(e="root"){return zl(Ol(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ll(this.direction);return zl(this.getNodeAtCaret(),e)||Wl(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Fl&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Fl||e instanceof Rl)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Rl extends Tl{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Hl(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return zl(Ol(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Hl(this.origin,Ll(this.direction),this.offset)}isSamePointCaret(e){return e instanceof Rl&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Fl||e instanceof Rl)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return zl(this.origin,this.direction)}}function Il(e){return e instanceof Rl}function Pl(e){return e instanceof Fl}function Ml(e){return e instanceof Nl}const Dl={next:class extends Rl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Rl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Bl={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}}},$l={next:class extends Nl{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Nl{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 Bl[t](e):null}function Hl(e,t,n){return e?new Dl[t](e,Kl(e,n)):null}function Kl(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 Ul(e,t){return new jl(e,t)}function Wl(e,t){return Eo(e)?new $l[t](e):null}function Vl(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class ql{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 ql(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Il(t)?function(e,t){const{direction:n,origin:r}=e;return Ul(e,Kl(r,"focus"===t?Ll(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[Ul(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Il(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Il(n),i=t=>t.isSameNodeCaret(n)?null:Vl(t)||t.getParentCaret(e);return Yl({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 Hl(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function Zl(e){return Jl(e,zl(Ss(),e.direction))}function Gl(e){return Jl(e,e)}function Jl(e,t){return e.direction!==t.direction&&ge(265),new ql(e,t,e.direction)}function Yl(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 Xl(e,t){const n=na(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 Ql(n)}}function Ql(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 ea(e,t){return t.is(e)}function ta(e){return Eo(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function na(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};const n=new Map;for(let[t,r]=ta(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=ta(t);r;i=r,r=r.getParent()){const o=n.get(r);if(void 0!==o)return null===o?(ea(e,r)||ge(276),{commonAncestor:r,type:"ancestor"}):null===i?(ea(t,r)||ge(277),{commonAncestor:r,type:"descendant"}):((Eo(o)||ea(e,o))&&(Eo(i)||ea(t,i))&&r.is(o.getParent())&&r.is(i.getParent())||ge(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function ra(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),Hl(o,t,i)):(Eo(o)||ge(267,o.getType(),r),function(e,t,n){let r=Wl(e,"next");for(let e=0;e<t;e++){const e=r.getAdjacentCaret();if(null===e)break;r=e}return pa(r,n)}(o,e.offset,t))}function ia(e,t){const{origin:n,direction:r}=t,i="next"===r;Il(t)?e.set(n.getKey(),t.offset,"text"):Pl(t)?gi(n)?e.set(n.getKey(),Kl(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),"element"):(Ml(t)&&Eo(n)||ge(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function oa(e){const t=zi(),n=vi(t)?t:Di();return sa(n,e),ws(n),n}function sa(e,t){ia(e.anchor,t.anchor),ia(e.focus,t.focus)}function la(e){const{anchor:t,focus:n}=e,r=ra(t,"next"),i=ra(n,"next"),o=Xl(r,i)<=0?"next":"previous";return Jl(pa(r,o),pa(i,o))}function aa(e){const{direction:t,origin:n}=e,r=zl(n,Ll(t)).getNodeAtCaret();return r?zl(r,t):Wl(n.getParentOrThrow(),t)}function ca(e,t="root"){const n=[e];for(let r=Ml(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(aa(r));return n}function ua(e){return!!e&&e.origin.isAttached()}function da(e,t="removeEmptySlices"){if(e.isCollapsed())return e;const n="root",r="next";let i=t;const o=fa(e,r),s=ca(o.anchor,n),l=ca(o.focus.getFlipped(),n),a=new Set,c=[];for(const e of o.iterNodeCarets(n))if(Ml(e))a.add(e.origin.getKey());else if(Pl(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=aa(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=Hl(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(ua(e)){u=ha(e);break}for(const e of l)if(ua(e)){d=ha(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,fl),d=u&&c(s,(e=>n.has(e.getKey())&&fl(e)));return u&&d?[u,d]:null}(u,d,a);if(h){const[e,t]=h;Wl(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(ua);if(g)return Gl(pa(ha(g),e.direction));ge(269,JSON.stringify(s.map((e=>e.origin.__key))))}function ha(e){const t=function(e){let t=e;for(;Ml(t);){const e=Vl(t);if(!Ml(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(gi(t.origin))return Il(t)?t:Hl(t.origin,n,n);const r=t.getAdjacentCaret();return Pl(r)&&gi(r.origin)?Hl(r.origin,n,Ll(n)):t}function ga(e){return Il(e)&&e.offset!==Kl(e.origin,e.direction)}function pa(e,t){return e.direction===t?e:e.getFlipped()}function fa(e,t){return e.direction===t?e:Jl(pa(e.focus,t),pa(e.anchor,t))}function ma(e,t="root"){let n=0,r=e,i=Vl(r);for(;null===i;){if(n--,i=r.getParentCaret(t),!i)return null;r=i,i=Vl(r)}return i&&[i,n]}function ya(e){const{origin:t,offset:n,direction:r}=e;if(n===Kl(t,r))return e.getSiblingCaret();if(n===Kl(t,Ll(r)))return aa(e.getSiblingCaret());const[i]=t.splitText(n);return gi(i)||ge(281),pa(zl(i,"next"),r)}function ba(e,t){return!0}function _a(e,{$copyElementNode:t=nl,$splitTextPointCaretNext:n=ya,rootMode:r="shadowRoot",$shouldSplit:i=ba}={}){if(Il(e))return n(e);const o=e.getParentCaret(r);if(o){const{origin:n}=o;if(Ml(e)&&(!n.canBeEmpty()||!i(n,"first")))return aa(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 xa(e,t){if(!t||e===t)return e;for(const n in t)if(e[n]!==t[n])return{...e,...t};return e}function Ca(...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 Sa(e,...t){const n=Ca(...t);n.length>0&&e.classList.add(...n)}function va(e,...t){const n=Ca(...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 ka(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 Ea=new Map;function Ta(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 Na(e){let t=Ea.get(e);return void 0===t&&(t=Ta(e),Ea.set(e,t)),t}function Aa(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function La(e){const t=ml().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function Oa(e){return La(Oo(e)?e:e.getParentOrThrow())}function Fa(e){const t=Oa(e);return null!==t&&"rtl"===t.direction}function Ra(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=xl(e))[Ir]=!0,t;var t}(t)),t.__text=g)}}return t}function Ia(e){const t=e.getStyle(),n=Ta(t);Ea.set(t,n)}function Pa(e,t){(vi(e)?e.isCollapsed():gi(e)||Eo(e))||ka(280);const n=Na(vi(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=Aa(r);vi(e)||gi(e)?e.setStyle(i):e.setTextStyle(i),Ea.set(i,r)}function Ma(e,t){if(vi(e)&&e.isCollapsed()){Pa(e,t);const n=e.anchor.getNode();Eo(n)&&n.isEmpty()&&Pa(n,t)}!function(e){const t=zi();if(!t)return;const n=new Map,r=e=>n.get(e.getKey())||[0,e.getTextContentSize()];if(vi(t))for(const e of la(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]))}vi(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=>{Pa(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),Pa(r,t))}}}function Da(e,t){const n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function Ba(e,t,n=Da){if(null===e)return;const r=e.getStartEndPoints(),i=new Map;let o=null;if(r){const[e,t]=r;o=Di(),o.anchor.set(e.key,e.offset,e.type),o.focus.set(t.key,t.offset,t.type);const n=kl(e.getNode(),fl),s=kl(t.getNode(),fl);Eo(n)&&i.set(n.getKey(),n),Eo(s)&&i.set(s.getKey(),s)}for(const t of e.getNodes())if(Eo(t)&&fl(t))i.set(t.getKey(),t);else if(null===r){const e=kl(t,fl);Eo(e)&&i.set(e.getKey(),e)}for(const[e,r]of i){const i=t();n(r,i),r.replace(i,!0),o&&(e===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,o.anchor.type),e===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,o.focus.type))}o&&e.is(zi())&&ws(o)}function $a(e){const t=za(e);return null!==t&&"vertical-rl"===t.writingMode}function za(e){const t=e.anchor.getNode();return Eo(t)?La(t):Oa(t)}function Ha(e,t){let n=$a(e)?!t:t;Ka(e)&&(n=!n);const r=ra(e.focus,n?"previous":"next");if(ga(r))return!1;for(const e of Zl(r)){if(Ml(e))return!e.origin.isInline();if(!Eo(e.origin)){if(Ao(e.origin))return!0;break}}return!1}function Ka(e){const t=za(e);return null!==t&&"rtl"===t.direction}function Ua(e,t,n){const r=Ka(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 Wa(e,t,n){const r=Na(e.getStyle());return null!==r&&r[t]||n}function Va(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(vi(e)&&e.isCollapsed()&&""!==e.style){const n=Na(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=Wa(o,t,n);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?n:r}function qa(e,t){const n={...e,...t};for(const[r,i]of Object.entries(t))ja(e[r],i)&&(n[r]=qa(e[r],i));return n}function ja(...e){return e.every((e=>e&&e.constructor==Object))}class Za{#e={};constructor(...e){this.merge(...e)}merge(...e){return this.#e=e.reduce(qa,this.#e)}get(e){return e.split(".").reduce(((e,t)=>e[t]),this.#e)}}function Ga(e,t){return[...Array(1+t-e).keys()].map((t=>t+e))}const Ja=new Za({attachmentTagName:"action-text-attachment",attachmentContentTypeNamespace:"actiontext",authenticatedUploads:!1,extensions:[]}),Ya=new Za({default:{attachments:!0,markdown:!0,multiLine:!0,richText:!0,toolbar:{upload:"both"},highlight:{buttons:{color:Ga(1,9).map((e=>`var(--highlight-${e})`)),"background-color":Ga(1,9).map((e=>`var(--highlight-bg-${e})`))},permit:{color:[],"background-color":[]}}}});var Xa={global:Ja,presets:Ya,configure({global:e,...t}){e&&Ja.merge(e),Ya.merge(t)}};const Qa=["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"],ec=["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"],tc=["color","background-color"];function nc(){const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content}function rc(e,t){const n=document.activeElement;if(e.includes(n)){new ic(e,t.key).selectNext(n)&&t.preventDefault()}}he.addHook("uponSanitizeAttribute",(function(e,t){if("style"===t.attrName&&t.attrValue){const e={...Na(t.attrValue)},n={};for(const t in e)tc.includes(t)&&(n[t]=e[t]);Object.keys(n).length?t.attrValue=Aa(n):t.keepAttr=!1}})),he.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));class ic{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(oc)}#l(e=this.elements){return e.findLast(oc)}#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){oc(e)&&(e.tabIndex=0,e.focus())}#n(e){e.forEach((e=>e.tabIndex=-1))}}function oc(e){return e&&!e.disabled&&e.checkVisibility()}var sc='<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>',lc='<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>',ac='<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>',cc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 14C14.5523 14 15 14.4477 15 15C15 15.5523 14.5523 16 14 16H4C3.44772 16 3 15.5523 3 15C3 14.4477 3.44772 14 4 14H14Z"/>\n <path d="M12.625 1.59375C13.25 1.59375 13.625 1.97656 13.625 2.64062V9.02344C13.625 11.4844 11.8516 13.1875 8.99219 13.1875C6.14062 13.1875 4.35938 11.4844 4.35938 9.02344V2.64062C4.35938 1.97656 4.74219 1.59375 5.36719 1.59375C6 1.59375 6.375 1.97656 6.375 2.64062V8.84375C6.375 10.3828 7.32031 11.4297 8.99219 11.4297C10.6641 11.4297 11.6172 10.3828 11.6172 8.84375V2.64062C11.6172 1.97656 11.9922 1.59375 12.625 1.59375Z"/>\n </svg>',uc='<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>',dc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM13.6445 4.19824C15.5244 4.19824 16.8984 5.34668 16.8984 6.91211C16.8984 7.8759 16.4335 8.7237 15.292 9.84473L13.3438 11.8135V11.9092H16.1875C16.8232 11.9092 17.2197 12.251 17.2197 12.8115C17.2196 13.3651 16.83 13.7002 16.1875 13.7002H11.5117C10.8487 13.7002 10.4112 13.3241 10.4111 12.75C10.4111 12.3399 10.6368 11.9843 11.3203 11.3145L13.6855 8.88086C14.4169 8.13583 14.7245 7.64349 14.7246 7.12402C14.7246 6.4541 14.2393 6.00293 13.5215 6.00293C12.9404 6.00293 12.5166 6.29688 12.2158 6.90527C11.9151 7.37002 11.6552 7.54785 11.2588 7.54785C10.7188 7.54785 10.3429 7.17861 10.3428 6.65918C10.3428 5.3877 11.7783 4.19824 13.6445 4.19824Z"/>\n </svg>',hc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M13.5967 4.19824C15.5928 4.19824 16.9873 5.23047 16.9873 6.7002C16.9872 7.705 16.2421 8.60059 15.2988 8.7168V8.86719C16.4199 8.94923 17.2607 9.89942 17.2607 11.0889C17.2606 12.7362 15.7362 13.9053 13.583 13.9053C11.6827 13.9053 10.1925 12.873 10.1924 11.7041C10.1924 11.1846 10.5547 10.8154 11.0537 10.8154C11.3818 10.8154 11.6553 10.9727 11.9629 11.3555C12.3799 11.9159 12.92 12.2031 13.583 12.2031C14.4853 12.2031 15.0731 11.7313 15.0732 11C15.0732 10.2754 14.4785 9.7832 13.5898 9.7832H13.0361C12.5645 9.7832 12.2159 9.4208 12.2158 8.92188C12.2158 8.44336 12.5576 8.07422 13.0361 8.07422H13.5693C14.3075 8.07422 14.8544 7.60928 14.8545 6.97363C14.8545 6.33789 14.3213 5.90039 13.5557 5.90039C12.9678 5.90039 12.5029 6.16016 12.0859 6.71387C11.8399 7.03508 11.5527 7.17871 11.1973 7.17871C10.671 7.17871 10.295 6.82314 10.2949 6.31738C10.2949 5.18945 11.751 4.19824 13.5967 4.19824ZM8.0332 4.30078C8.75781 4.30078 9.16797 4.74512 9.16797 5.51758V12.5518C9.1679 13.3241 8.75776 13.7686 8.0332 13.7686C7.30865 13.7686 6.90534 13.3309 6.90527 12.5518V9.87207H3.48047V12.5518C3.4804 13.3241 3.07026 13.7686 2.3457 13.7686C1.62115 13.7686 1.21784 13.3309 1.21777 12.5518V5.51758C1.21777 4.73828 1.62109 4.30078 2.3457 4.30078C3.07031 4.30078 3.48047 4.74512 3.48047 5.51758V8.07422H6.90527V5.51758C6.90527 4.73828 7.30859 4.30078 8.0332 4.30078Z"/>\n </svg>',gc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.6357 4.22559C15.7432 4.22559 16.4336 4.80664 16.4336 5.73633V10.3164H16.7275C17.2881 10.3164 17.6436 10.6787 17.6436 11.2256C17.6435 11.7655 17.3017 12.1006 16.7275 12.1006H16.4336V12.6611C16.4335 13.3515 16.0234 13.7891 15.374 13.7891C14.7247 13.7891 14.3282 13.3583 14.3281 12.6611V12.1006H11.04C10.2335 12.1006 9.76863 11.6766 9.76855 10.918C9.76855 10.5762 9.85064 10.3026 10.1104 9.74219C10.7666 8.42289 11.5733 7.0146 12.5713 5.54492C13.2549 4.56738 13.7812 4.22559 14.6357 4.22559ZM7.88965 4.30078C8.61426 4.30078 9.02441 4.74512 9.02441 5.51758V12.5518C9.02435 13.3241 8.6142 13.7686 7.88965 13.7686C7.1651 13.7686 6.76178 13.3309 6.76172 12.5518V9.87207H3.33691V12.5518C3.33685 13.3241 2.9267 13.7686 2.20215 13.7686C1.4776 13.7686 1.07428 13.3309 1.07422 12.5518V5.51758C1.07422 4.73828 1.47754 4.30078 2.20215 4.30078C2.92676 4.30078 3.33691 4.74512 3.33691 5.51758V8.07422H6.76172V5.51758C6.76172 4.73828 7.16504 4.30078 7.88965 4.30078ZM14.2188 6.07812C13.6035 7.02841 12.2158 9.48929 11.7988 10.2686V10.3164H14.3281V6.07812H14.2188Z"/>\n </svg>',pc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M9 12C9.55228 12 10 12.4477 10 13C10 13.5523 9.55228 14 9 14H3C2.44772 14 2 13.5523 2 13C2 12.4477 2.44772 12 3 12H9ZM15 8C15.5523 8 16 8.44772 16 9C16 9.55228 15.5523 10 15 10H3C2.44772 10 2 9.55228 2 9C2 8.44772 2.44772 8 3 8H15ZM15 4C15.5523 4 16 4.44772 16 5C16 5.55228 15.5523 6 15 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H15Z"/>\n </svg>',fc='<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>',mc='<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>',yc='<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>',bc='<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>',_c='<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>',xc='<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>',Cc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 2C15.6569 2 17 3.34315 17 5V13C17 14.6569 15.6569 16 14 16H4C2.34315 16 1 14.6569 1 13V5C1 3.34315 2.34315 2 4 2H14ZM3.06348 13.3496C3.2053 13.7294 3.57078 14 4 14H13.5859L11 11.4141L9.70703 12.707C9.31651 13.0976 8.68349 13.0976 8.29297 12.707C7.90244 12.3165 7.90244 11.6835 8.29297 11.293L8.58594 11L7 9.41406L3.06348 13.3496ZM4 4C3.44772 4 3 4.44772 3 5V10.5859L6.29297 7.29297L6.36914 7.22461C6.76191 6.90427 7.34092 6.92686 7.70703 7.29297L10 9.58594L10.293 9.29297L10.3691 9.22461C10.7619 8.90427 11.3409 8.92686 11.707 9.29297L15 12.5859V5C15 4.44772 14.5523 4 14 4H4ZM12.5 5C13.3284 5 14 5.67157 14 6.5C14 7.32843 13.3284 8 12.5 8C11.6716 8 11 7.32843 11 6.5C11 5.67157 11.6716 5 12.5 5Z"/>\n </svg>',Sc='<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>',vc='<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>',wc='<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>',kc='<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>',Ec='<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>',Tc='<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 Nc 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.dispose()}dispose(){this.#h(),this.#g(),this.#p(),this.#f(),this.unregisterSelectionListener?.(),this.unregisterHistoryListener?.(),this.editorElement=null,this.editor=null,this.selection=null,this.#c()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#m()))}configure(e){if("object"==typeof e&&null!==e)for(const[t,n]of Object.entries(e))this.setAttribute(`data-${t}`,n)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.#y(),this.#b(),this.#_(),this.#x(),this.#C(),this.#S(),this.#u(),this.#v(),this.resolveEditorPromise(e),this.toggleAttribute("connected",!0)}async getEditorElement(){return this.editorElement||await this.editorPromise}#m(){this.disconnectedCallback(),this.connectedCallback()}async#c(){this.editorPromise=new Promise((e=>{this.resolveEditorPromise=e})),this.editorElement=await this.editorPromise}#d(){this.resizeObserver=new ResizeObserver((()=>this.#u())),this.resizeObserver.observe(this)}#h(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}#y(){this.addEventListener("click",this.#w)}#g(){this.removeEventListener("click",this.#w)}#w=e=>{this.#k(e,"[data-command]",this.#E.bind(this))};#k(e,t,n){const r=e.target.closest(t);r&&n(e,r)}#E(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()}#b(){this.editorElement.addEventListener("keydown",this.#T)}#p(){this.editorElement?.removeEventListener("keydown",this.#T)}#T=e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#N(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))};#N(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("+")}#v(){this.editorElement.addEventListener("lexxy:focus",this.#A),this.editorElement.addEventListener("lexxy:blur",this.#L),this.addEventListener("keydown",this.#O)}#f(){this.editorElement?.removeEventListener("lexxy:focus",this.#A),this.editorElement?.removeEventListener("lexxy:blur",this.#L),this.removeEventListener("keydown",this.#O)}#A=()=>{this.#F[0].tabIndex=0};#L=()=>{this.#_(),this.#R()};#O=e=>{rc(this.#F,e)};#_(){this.#F.forEach((e=>{e.tabIndex=-1}))}#C(){this.unregisterSelectionListener=this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#I(),this.#R()}))}))}#S(){this.unregisterHistoryListener=this.editor.registerUpdateListener((()=>{this.#P()}))}#P(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#M("undo",0===e.undoStack.length),this.#M("redo",0===e.redoStack.length))}))}#I(){const e=zi();if(!vi(e))return;if(!e.anchor.getNode().getParent())return;const{isBold:t,isItalic:n,isStrikethrough:r,isUnderline:i,isHighlight:o,isInLink:s,isInQuote:l,isInHeading:a,headingTag:c,isInCode:u,isInList:d,listType:h,isInTable:g}=this.selection.getFormat();this.#D("bold",t),this.#D("italic",n),this.#D("format",a||r||i),this.#D("paragraph",!a),this.#D("heading-large","h2"===c),this.#D("heading-medium","h3"===c),this.#D("heading-small","h4"===c),this.#D("strikethrough",r),this.#D("underline",i),this.#D("lists",d),this.#D("unordered-list",d&&"bullet"===h),this.#D("ordered-list",d&&"number"===h),this.#D("highlight",o),this.#D("link",s),this.#D("quote",l),this.#D("code",u),this.#D("table",g),this.#P()}#D(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#M(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#B(){return this.scrollWidth-this.#$.clientWidth>this.clientWidth+1}#u=()=>{this.#z(),this.#H(),this.#$.style.display=this.#K.children.length?"block":"none",this.#$.setAttribute("nonce",nc());const e=this.#K.children.length>0;this.toggleAttribute("overflowing",e),this.#K.toggleAttribute("disabled",!e)};#H(){const e=this.#U.reverse();let t=!1;for(const n of e){if(!this.#B()){t&&this.#K.prepend(n);break}this.#K.prepend(n),t=!0}}#z(){const e=Array.from(this.#K.children);e.sort(((e,t)=>this.#W(t)-this.#W(e))),e.forEach((e=>{const t=this.querySelector(`[data-position="${this.#W(e)+1}"]`)??this.#$;this.insertBefore(e,t)}))}#W(e){return parseInt(e.dataset.position??"999")}#x(){this.#V.forEach(((e,t)=>{void 0===e.dataset.position&&(e.dataset.position=t)}))}#R(){this.#q.forEach((e=>{e.open=!1}))}get#q(){return this.querySelectorAll("details")}get#$(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#K(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}get#U(){return Array.from(this.querySelectorAll(":scope > button:not([data-prevent-overflow='true'])"))}get#F(){return Array.from(this.querySelectorAll(":scope button, :scope > details > summary"))}get#V(){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="image" data-command="uploadImage" data-prevent-overflow="true" title="Add images and video">\n ${Cc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="file" data-command="uploadFile" title="Upload files">\n ${Sc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">\n ${sc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">\n ${lc}\n </button>\n\n <details class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--chevron" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="format" title="Text formatting">\n ${uc}\n </summary>\n <div class="lexxy-editor__toolbar-dropdown-list">\n <button type="button" name="paragraph" data-command="setFormatParagraph" title="Paragraph">\n ${pc} <span>Normal</span>\n </button>\n <button type="button" name="heading-large" data-command="setFormatHeadingLarge" title="Large heading">\n ${dc} <span>Large Heading</span>\n </button>\n <button type="button" name="heading-medium" data-command="setFormatHeadingMedium" title="Medium heading">\n ${hc} <span>Medium Heading</span>\n </button>\n <button class="lexxy-editor__toolbar-group-end" type="button" name="heading-small" data-command="setFormatHeadingSmall" title="Small heading">\n ${gc} <span>Small Heading</span>\n </button>\n <div class="lexxy-editor__toolbar-separator" role="separator"></div>\n <button type="button" name="strikethrough" data-command="strikethrough" title="Strikethrough">\n ${ac} <span>Strikethrough</span>\n </button>\n <button type="button" name="underline" data-command="underline" title="Underline">\n ${cc} <span>Underline</span>\n </button>\n </div>\n </details>\n\n <details class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--chevron" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="highlight" title="Color highlight">\n ${fc}\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 lexxy-editor__toolbar-group-end" name="link" title="Link" data-hotkey="cmd+k ctrl+k">\n ${mc}\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 ${yc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="code" data-command="insertCodeBlock" title="Code">\n ${bc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">\n ${_c}\n </button>\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">\n ${xc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">\n ${vc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="divider" data-command="insertHorizontalDivider" title="Insert a divider">\n ${wc}\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 ${kc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo">\n ${Ec}\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">${Tc}</summary>\n <div class="lexxy-editor__toolbar-dropdown-content lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons"></div>\n </details>\n `}}function Ac(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 Lc="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Oc=Lc&&"documentMode"in document?document.documentMode:null;function Fc(e,t){return Array.from(function(e){return function(e,t){const n=Ss(),r=t||n,i=Eo(r)?Wl(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=ma(zl(e,t));return n&&n[0]}(r,e);let l=o;return Yl({hasNext:e=>null!==e,initial:i,map:e=>({depth:l,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;Ml(e)&&l++;const t=ma(e);return!t||t[0].isSameNodeCaret(s)?null:(l+=t[1],t[0])}})}("next",e)}(e))}function Rc(e){return e?e.getAdjacentCaret():null}function Ic(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function Pc(e){const t=zi()||Hi();let n;if(vi(t))n=ra(t.focus,"next");else{if(null!=t){const e=t.getNodes(),r=e[e.length-1];r&&(n=zl(r,"next"))}n=n||Wl(Ss(),"previous").getFlipped().insert($o())}const r=function(e,t,n){let r=pa(t,"next");for(let e=r;e;e=_a(e,n))r=e;return Il(r)&&Ac(283),r.insert(e.isInline()?$o().append(e):e),pa(zl(e.getLatest(),"next"),t.direction)}(e,n),i=Vl(r);return oa(Gl(Ml(i)?ha(i):r)),e.getLatest()}function Mc(e,t){const n=t();return e.replace(n),n.append(e),n}function Dc(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Bc(e){const t=zi();if(!vi(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=kl(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 $c(e,t){Wl(e,"next").insert(t)}function zc(e,t){return Hc(e,t,null)}function Hc(e,t,n){let r=!1;for(const i of Wc(e))t(i)?null!==n&&n(i):(r=!0,Eo(i)&&Hc(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function Kc(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 Wc(e))r.push(t);return n}function Uc(e){return Vc(Wl(e,"next"))}function Wc(e){return Vc(Wl(e,"previous"))}function Vc(e){return Yl({hasNext:Pl,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}Lc&&"InputEvent"in window&&!Oc&&new window.InputEvent("input");const qc=Symbol.for("preact-signals");function jc(){if(Yc>1)return void Yc--;let e,t=!1;for(;void 0!==Gc;){let n=Gc;for(Gc=void 0,Xc++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&ru(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(Xc=0,Yc--,t)throw e}let Zc,Gc;function Jc(e){const t=Zc;Zc=void 0;try{return e()}finally{Zc=t}}let Yc=0,Xc=0,Qc=0;function eu(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 tu(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 nu(e,t){return new tu(e,t)}function ru(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 iu(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 ou(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 su(e,t){tu.call(this,void 0),this.x=e,this.s=void 0,this.g=Qc-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 lu(e){const t=e.u;if(e.u=void 0,"function"==typeof t){Yc++;const n=Zc;Zc=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,au(e),t}finally{Zc=n,jc()}}}function au(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,lu(e)}function cu(e){if(Zc!==this)throw new Error("Out-of-order effect");ou(this),Zc=e,this.f&=-2,8&this.f&&au(this),jc()}function uu(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 du(e,t){const n=new uu(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function hu(e,t={}){const n={};for(const r in e){const i=t[r],o=nu(void 0===i?e[r]:i);n[r]=o}return n}function gu(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}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 fu(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]=fu(n[e],r[e]);return e}return t}tu.prototype.brand=qc,tu.prototype.h=function(){return!0},tu.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:Jc((()=>{var e;null==(e=this.W)||e.call(this)})))},tu.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&&Jc((()=>{var e;null==(e=this.Z)||e.call(this)})))}},tu.prototype.subscribe=function(e){return du((()=>{const t=this.value,n=Zc;Zc=void 0;try{e(t)}finally{Zc=n}}),{name:"sub"})},tu.prototype.valueOf=function(){return this.value},tu.prototype.toString=function(){return this.value+""},tu.prototype.toJSON=function(){return this.value},tu.prototype.peek=function(){const e=Zc;Zc=void 0;try{return this.value}finally{Zc=e}},Object.defineProperty(tu.prototype,"value",{get(){const e=eu(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Xc>100)throw new Error("Cycle detected");this.v=e,this.i++,Qc++,Yc++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{jc()}}}}),su.prototype=new tu,su.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===Qc)return!0;if(this.g=Qc,this.f|=1,this.i>0&&!ru(this))return this.f&=-2,!0;const e=Zc;try{iu(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,ou(this),this.f&=-2,!0},su.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)}tu.prototype.S.call(this,e)},su.prototype.U=function(e){if(void 0!==this.t&&(tu.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)}},su.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(su.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=eu(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),uu.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()}},uu.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,lu(this),iu(this),Yc++;const e=Zc;return Zc=this,cu.bind(this,e)},uu.prototype.N=function(){2&this.f||(this.f|=2,this.o=Gc,Gc=this)},uu.prototype.d=function(){this.f|=8,1&this.f||au(this)},uu.prototype.dispose=function(){this.d()},lt("format",{parse:e=>"number"==typeof e?e:0});function mu(e){return 0===e.id}function yu(e){return 2===e.id}const bu=new Set;let _u=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):xa;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;yu(t)||pu(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&&pu(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&&pu(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&&pu(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&&pu(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&&pu(311),this._signal}getInitResult(){void 0===this.extension.init&&pu(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||pu(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)||pu(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&&pu(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&pu(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||pu(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||bu}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)||pu(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const xu={tag:Br};function Cu(){const e=Ss();e.isEmpty()&&e.append($o())}const Su={config:{setOptions:xu,updateOptions:xu},init:({$initialEditorState:e=Cu})=>({$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,qr,fi,Do]},vu=Symbol.for("@lexical/extension/LexicalBuilder");function wu(){}function ku(e){throw e}function Eu(e){return Array.isArray(e)?e:[e]}const Tu="0.41.0+prod.esm";let Nu=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=Tu,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(t){const n=[Eu(Su)];for(const e of t)n.push(Eu(e));return new e(n)}static maybeFromEditor(t){const n=t[vu];return n&&(n.PACKAGE_VERSION!==Tu&&pu(292,n.PACKAGE_VERSION,Tu),n instanceof e||pu(293)),n}static fromEditor(t){const n=e.maybeFromEditor(t);return void 0===n&&pu(294),n}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(Uo({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[vu]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=wu;function t(){try{e()}finally{e=wu}}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&&pu(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&&pu(296);const t=Eu(e),[n]=t;"string"!=typeof n.name&&pu(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&pu(298,n.name),!r){r=new _u(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&pu(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&pu(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=Eu(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(yu(i))return;const o=n.extension.name;var s;mu(i)||pu(300,o,r||"[unknown]"),mu(s=i)||pu(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)||pu(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())mu(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&&pu(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 gu(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&pu(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&&fu(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=ku),e}};function Au(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 Lu(e){let t=1,n=e.getParent();for(;null!=n;){if(ju(n)){const e=n.getParent();if(ed(e)){t++,n=e.getParent();continue}Au(40)}return t}return t}function Ou(e){let t=e.getParent();ed(t)||Au(40);let n=t;for(;null!==n;)n=n.getParent(),ed(n)&&(t=n);return t}function Fu(e){let t=[];const n=e.getChildren().filter(ju);for(let e=0;e<n.length;e++){const r=n[e],i=r.getFirstChild();ed(i)?t=t.concat(Fu(i)):t.push(r)}return t}function Ru(e){return ju(e)&&ed(e.getFirstChild())}function Iu(e){return qu().append(e)}function Pu(e,t){return ju(e)&&(0===t.length||1===t.length&&e.is(t[0])&&0===e.getChildrenSize())}function Mu(e){const t=zi();if(null!==t){let n=t.getNodes();if(vi(t)){const r=t.getStartEndPoints();null===r&&Au(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=$o();o.append(e),n=e.select().getNodes()}}else if(Pu(o,n)){const t=Qu(e);if(tl(s)){o.replace(t);const e=qu();Eo(o)&&(e.setFormat(o.getFormatType()),e.setIndent(o.getIndent())),t.append(e)}else if(ju(o)){const e=o.getParentOrThrow();Du(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()&&!ju(i)&&!r.has(i.getKey())){Bu(i,e);continue}let o=us(i)?i.getParent():ju(i)&&i.isEmpty()?i:null;for(;null!=o;){const t=o.getKey();if(ed(o)){if(!r.has(t)){const n=Qu(e);Du(n,o.getChildren()),o.replace(n),r.add(t)}break}{const n=o.getParent();if(tl(n)&&!r.has(t)){r.add(t),Bu(o,e);break}o=n}}}}}function Du(e,t){e.splice(e.getChildrenSize(),0,t)}function Bu(e,t){if(ed(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),i=qu();let o;if(Du(i,e.getChildren()),ed(n)&&t===n.getListType())n.append(i),ed(r)&&t===r.getListType()&&(Du(n,r.getChildren()),r.remove()),o=n;else if(ed(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),o=r;else{const n=Qu(t);n.append(i),e.replace(n),o=n}i.setFormat(e.getFormatType()),i.setIndent(e.getIndent());const s=zi();return vi(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 $u(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&Ru(n)&&Ru(r)&&($u(n.getFirstChild(),r.getFirstChild()),r.remove());const i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function zu(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())ju(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),ed(r.getFirstChild())||n++)}function Hu(e){const t=new Set;if(Ru(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Ru(r)&&Ru(i)){const n=i.getFirstChild();if(ed(n)){n.append(e);const i=r.getFirstChild();ed(i)&&(Du(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Ru(r)){const t=r.getFirstChild();if(ed(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(Ru(i)){const t=i.getFirstChild();ed(t)&&t.append(e)}else if(ed(n)){const t=qu().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),o=Qu(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 Ku(e){if(Ru(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(ed(n?n.getParent():void 0)&&ju(n)&&ed(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=qu(),o=Qu(r);i.append(o),e.getPreviousSiblings().forEach((e=>o.append(e)));const s=qu(),l=Qu(r);s.append(l),Du(l,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(s),n.replace(e)}}}let Uu=class extends ko{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(null==e.__checked)return;const t=e.getParent();ed(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)},extends:ko,importDOM:{li:()=>({conversion:Wu,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();!ed(r)||"check"!==r.getListType()||ed(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(...Ca(s)),o){const e=n.getParent(),t=ed(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=Ca(l);n.getChildren().some((e=>ed(e)))?r.push(...e):i.push(...e)}i.length>0&&va(e,...i),r.length>0&&Sa(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=Na(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in Na(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(ju(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!ed(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const t=Qu(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)||Au(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(ed(n)||Au(39),ju(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=Qu(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&&Ru(t)&&Ru(n)&&($u(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=qu().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=$o();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=ju(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 ed(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(;ju(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&Au(117),(e=Math.floor(e))>=0||Au(199);let t=this.getIndent();for(;t!==e;)t<e?(Hu(this),t++):(Ku(this),t--);return this}canInsertAfter(e){return ju(e)}canReplaceWith(e){return ju(e)}canMergeWith(e){return ju(e)||zo(e)}extractWithChild(e,t){if(!vi(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 Qu("bullet")}canMergeWhenEmpty(){return!0}};function Wu(e){if(e.classList.contains("task-list-item"))for(const t of e.children)if("INPUT"===t.tagName)return Vu(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 Vu(t.children[0]);const t=e.getAttribute("aria-checked");return{node:qu("true"===t||"false"!==t&&void 0)}}function Vu(e){return"checkbox"!==e.getAttribute("type")?{node:null}:{node:qu(e.hasAttribute("checked"))}}function qu(e){return rl(new Uu(void 0,e))}function ju(e){return e instanceof Uu}let Zu=class extends ko{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{!function(e){const t=e.getNextSibling();ed(t)&&e.getListType()===t.getListType()&&$u(e,t)}(e),zu(e)},extends:ko,importDOM:{ol:()=>({conversion:Yu,priority:0}),ul:()=>({conversion:Yu,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=Xu[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,Gu(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(Gu(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 ul(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];ju(t)||(r===n&&(r=[...n]),r[e]=qu().append(!Eo(t)||ed(t)||t.isInline()?t:hi(t.getTextContent())))}return super.splice(e,t,r)}extractWithChild(e){return ju(e)}};function Gu(e,t,n){const r=[],i=[],o=t.list;if(void 0!==o){const e=o[`${n.__tag}Depth`]||[],t=Lu(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(...Ca(l));for(let t=0;t<e.length;t++)t!==s&&i.push(n.__tag+t)}if(void 0!==c){const e=Ca(c);t>1?r.push(...e):i.push(...e)}}i.length>0&&va(e,...i),r.length>0&&Sa(e,...r)}function Ju(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(ju(r)){t.push(r);const e=r.getChildren();e.length>1&&e.forEach((e=>{ed(e)&&t.push(Iu(e))}))}else t.push(Iu(r))}return t}function Yu(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=Qu("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(ul(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?Qu("check"):Qu("bullet")),{after:Ju,node:n}}const Xu={ol:"number",ul:"bullet"};function Qu(e="number",t=1){return rl(new Zu(e,t))}function ed(e){return e instanceof Zu}const td=nn("UPDATE_LIST_START_COMMAND"),nd=nn("INSERT_UNORDERED_LIST_COMMAND"),rd=nn("INSERT_ORDERED_LIST_COMMAND"),id=nn("REMOVE_LIST_COMMAND");function od(e,t){return wa(e.registerCommand(rd,(()=>(Mu("number"),!0)),1),e.registerCommand(td,(e=>{const{listNodeKey:t,newStart:n}=e,r=ms(t);return!!ed(r)&&("number"===r.getListType()&&(r.setStart(n),zu(r)),!0)}),1),e.registerCommand(nd,(()=>(Mu("bullet"),!0)),1),e.registerCommand(id,(()=>(function(){const e=zi();if(vi(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Pu(r,n))t.add(Ou(r));else for(let e=0;e<n.length;e++){const r=n[e];if(us(r)){const e=Ic(r,Uu);null!=e&&t.add(Ou(e))}}for(const n of t){let t=n;const r=Fu(n);for(const n of r){const r=$o().setTextStyle(e.style).setTextFormat(e.format);Du(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&ia(e.anchor,ha(Wl(r,"next"))),n.__key===e.focus.key&&ia(e.focus,ha(Wl(r,"next"))),n.remove()}n.remove()}}}(),!0)),1),e.registerCommand(gn,(()=>function(e=!1){const t=zi();if(!vi(t)||!t.isCollapsed())return!1;const n=t.anchor.getNode();let r=null;if(ju(n)&&0===n.getChildrenSize())r=n;else if(gi(n)){const e=n.getParent();ju(e)&&e.getChildren().every((e=>gi(e)&&""===e.getTextContent().trim()))&&(r=e)}if(null===r)return!1;const i=Ou(r),o=r.getParent();ed(o)||Au(40);const s=o.getParent();let l;if(tl(s))l=$o(),i.insertAfter(l);else{if(!ju(s))return!1;l=qu(),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=Qu(o.getListType(),t);if(ju(l)){const e=qu();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||!ju(e)&&!ed(e))break;t=e}t.remove()}(r),!0}(!1)),1),e.registerNodeTransform(Uu,(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=zi();vi(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(ju(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}const sd=new Set(["http:","https:","mailto:","sms:","tel:"]);let ld=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),Sa(t,e.theme.link),t}updateLinkDOM(e,t,n){if(cl(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:ad,priority:1})}}static importJSON(e){return cd().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=yd(e);try{const t=new URL(yd(e));if(!sd.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=cd(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(!vi(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 ad(e){let t=null;if(cl(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=cd(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function cd(e="",t){return rl(new ld(e,t))}function ud(e){return e instanceof ld}let dd=class e extends ld{__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 hd().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=hd(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function hd(e="",t){return rl(new dd(e,t))}function gd(e){return e instanceof dd}function pd(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 fd(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=zi();if(null===s||!vi(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=kl(e,(e=>!gd(e)&&ud(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=kl(e,(e=>!gd(e)&&ud(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==o&&t.setRel(o);else{const t=cd(n,{rel:o,target:r});e.insertBefore(t),t.append(e)}}}))}if(s.isCollapsed()&&null===n)for(const e of s.getNodes()){const t=kl(e,(e=>!gd(e)&&ud(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=kl(t,(e=>!gd(e)&&ud(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=cd(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=kl(e,ud);if(null!==t)return c(t)}!function(e){const t=zi();if(!vi(t))return e();const n=St(t),r=n.isBackward(),i=pd(n.anchor,r?-1:0),o=pd(n.focus,r?0:-1);if(e(),i||o){const e=zi();if(vi(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")}ws(St(t))}}}((()=>{let e=null;for(const t of l){if(!t.isAttached())continue;const s=kl(t,ud);if(s){c(s);continue}if(Eo(t)){if(!t.isInline())continue;if(ud(t)){if(!(gd(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();ud(l)&&l.is(e)?l.append(t):(e=cd(n,{rel:o,target:r,title:i}),t.insertAfter(e),e.append(t))}}))}const md=/^\+?[0-9\s()-]{5,}$/;function yd(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:md.test(e)?`tel:${e}`:`https://${e}`}function bd(e,t){const n=ls(t)?t.body.childNodes:t.childNodes;let r=[];const i=[];for(const t of n)if(!Cd.has(t.nodeName)){const n=Sd(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 _d(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++)xd(e,r[i],n,t);return n.innerHTML}function xd(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=Ra(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=xd(e,o,h,r);!i&&Eo(t)&&s&&t.extractWithChild(o,r,"html")&&(i=!0)}if(i&&!o){if((ul(u)||hl(u))&&u.append(h),n.append(u),d){const e=d.call(s,u);e&&(hl(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(h);return i}const Cd=new Set(["STYLE","SCRIPT"]);function Sd(e,t,n,r,i=new Map,o){let s=[];if(Cd.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(...Sd(d[e],t,n,g,new Map(i),l));return null!=u&&(h=u(h)),pl(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}:$o)),null==l?h.length>0?s=s.concat(h):pl(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(gl(e.nextSibling)&&gl(e.previousSibling))}(e)&&(s=s.concat(Zr())):Eo(l)&&l.append(...h),s}function vd(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 wd(e,t=zi()){return null==t&&vd(166),vi(t)&&t.isCollapsed()||0===t.getNodes().length?"":_d(e,t)}function kd(e,t){const n=e.getData("text/plain")||e.getData("text/uri-list");null!=n&&t.insertRawText(n)}function Ed(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 Td(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=fo(e[n]);gi(r)&&Ia(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 Td(n,bd(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(vi(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=zi();if(vi(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 Td(e,t,n){e.dispatchCommand(on,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(vi(e)&&e.isCollapsed()){let t=null;const n=ra(e.anchor,"previous");if(n)if(Il(n))t=n.origin;else{const e=Jl(n,Wl(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 Nd(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=Ra(t,s,"clone"));const l=Eo(s)?s.getChildren():[],a=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&vd(58,n.name),Eo(e)){const e=t.children;Array.isArray(e)||vd(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=Nd(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 Ad=null;async function Ld(e,t,n){if(null!==Ad)return!1;if(null!==t)return new Promise(((r,i)=>{e.update((()=>{r(Od(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=>(Dc(r,ClipboardEvent)&&(s(),null!==Ad&&(i.clearTimeout(Ad),Ad=null),t(Od(e,r,n))),!0)),4);Ad=i.setTimeout((()=>{s(),Ad=null,t(!1)}),50),o.execCommand("copy"),l.remove()}))}function Od(e,t,n){if(void 0===n){const t=ll(e._window),r=zi();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=Rd(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of Fd)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 Fd=[["text/html",wd],["application/x-lexical-editor",function(e,t=zi()){return null==t&&vd(166),vi(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++)Nd(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function Rd(e=zi()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=ml();for(const[r,i]of Fd){const o=i(n,e);null!==o&&(t[r]=o)}}return t}const Id={build:(e,t,n)=>hu(t),config:{disabled:"undefined"==typeof window},name:"@lexical/dragon",register:(e,t,n)=>du((()=>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=zi();if(vi(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)))},Pd="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Md=Pd&&"documentMode"in document?document.documentMode:null,Dd=Pd&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Bd=!(!Pd||!("InputEvent"in window)||Md)&&"getTargetRanges"in new window.InputEvent("input"),$d=Pd&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),zd=Pd&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Hd=Pd&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Kd=Pd&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Dd&&!Hd;function Ud(e,t){t.update((()=>{if(null!==e){const n=Dc(e,KeyboardEvent)?null:e.clipboardData,r=zi();if(null!==r&&!r.isCollapsed()&&null!=n){e.preventDefault();const i=wd(t);null!==i&&n.setData("text/html",i),n.setData("text/plain",r.getTextContent())}}}))}function Wd(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 Vd="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,qd=Vd&&"documentMode"in document?document.documentMode:null,jd=Vd&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Zd=!(!Vd||!("InputEvent"in window)||qd)&&"getTargetRanges"in new window.InputEvent("input"),Gd=Vd&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Jd=Vd&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Yd=Vd&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xd=Vd&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&jd&&!Yd,Qd=nn("DRAG_DROP_PASTE_FILE");let eh=class e extends ko{static getType(){return"quote"}static clone(t){return new e(t.__key)}createDOM(e){const t=document.createElement("blockquote");return Sa(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:sh,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ul(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 th().updateFromJSON(e)}insertNewAfter(e,t){const n=$o(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=$o();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function th(){return rl(new eh)}function nh(e){return e instanceof eh}let rh=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){Sa(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:oh,priority:0}),h2:e=>({conversion:oh,priority:0}),h3:e=>({conversion:oh,priority:0}),h4:e=>({conversion:oh,priority:0}),h5:e=>({conversion:oh,priority:0}),h6:e=>({conversion:oh,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&ih(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>ih(e)?{conversion:e=>({node:lh("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ul(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 lh(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?$o():lh(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=$o();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?$o():lh(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function ih(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function oh(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=lh(t),null!==e.style&&(Cl(e,n),n.setFormat(e.style.textAlign))),{node:n}}function sh(e){const t=th();return null!==e.style&&(t.setFormat(e.style.textAlign),Cl(e,t)),{node:t}}function lh(e="h1"){return rl(new rh(e))}function ah(e){return e instanceof rh}function ch(e){let t=null;if(Dc(e,DragEvent)?t=e.dataTransfer:Dc(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 uh(e){return Ao(_s(e))}function dh(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function hh(e){return wa(e.registerCommand(sn,(e=>{const t=zi();return!!ki(t)&&(t.clear(),!0)}),0),e.registerCommand(dn,(e=>{const t=zi();return vi(t)?(t.deleteCharacter(e),!0):!!ki(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(yn,(e=>{const t=zi();return!!vi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(bn,(e=>{const t=zi();return!!vi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(pn,(t=>{const n=zi();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Ed(r,n,e);else if(vi(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(mn,(()=>{const e=zi();return!!vi(e)&&(e.removeText(),!0)}),0),e.registerCommand(_n,(e=>{const t=zi();return!!vi(t)&&(t.formatText(e),!0)}),0),e.registerCommand($n,(e=>{const t=zi();if(!vi(t)&&!ki(t))return!1;const n=t.getNodes();for(const t of n){const n=kl(t,(e=>Eo(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(hn,(e=>{const t=zi();return!!vi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(gn,(()=>{const e=zi();return!!vi(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(Pn,(()=>{const e=mi(),t=zi();return vi(t)&&(e.setFormat(t.format),e.setStyle(t.style)),Gi([e]),!0}),0),e.registerCommand(Mn,(()=>Bc((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(Dn,(()=>Bc((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(Tn,(e=>{const t=zi();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(vi(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=zi();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(vi(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=zi();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Fa(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!vi(t))return!1;if(Ha(t,!0)){const n=e.shiftKey;return e.preventDefault(),Ua(t,n,!0),!0}return!1}),0),e.registerCommand(vn,(e=>{const t=zi();if(ki(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Fa(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!vi(t))return!1;const n=e.shiftKey;return!!Ha(t,!1)&&(e.preventDefault(),Ua(t,n,!1),!0)}),0),e.registerCommand(On,(t=>{if(uh(t.target))return!1;const n=zi();if(vi(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=kl(e,(e=>Eo(e)&&!e.isInline()));return Eo(t)||Ac(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(Jd&&"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(uh(t.target))return!1;const n=zi();return!(!vi(n)&&!ki(n))&&(t.preventDefault(),e.dispatchCommand(dn,!1))}),0),e.registerCommand(An,(t=>{const n=zi();if(!vi(n))return!1;if(dh(n),null!==t){if((Jd||Gd||Xd)&&Zd)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(hn,!1)}return e.dispatchCommand(gn,void 0)}),0),e.registerCommand(Fn,(()=>!!vi(zi())&&(e.blur(),!0)),0),e.registerCommand(Bn,(t=>{const[,n]=ch(t);if(n.length>0){const r=Wd(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")}ws(St(e))}e.dispatchCommand(Qd,n)}return t.preventDefault(),!0}return!!vi(zi())}),0),e.registerCommand(zn,(e=>{const[t]=ch(e),n=zi();return!(t&&!vi(n))}),0),e.registerCommand(Hn,(e=>{const[t]=ch(e),n=zi();if(t&&!vi(n))return!1;const r=Wd(e.clientX,e.clientY);if(null!==r){Ao(_s(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Vn,(()=>($s(),!0)),0),e.registerCommand(Un,(t=>(Ld(e,Dc(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Wn,(t=>(async function(e,t){await Ld(t,Dc(e,ClipboardEvent)?e:null),t.update((()=>{const e=zi();vi(e)?e.removeText():ki(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(fn,(t=>{const[,n,r]=ch(t);return n.length>0&&!r?(e.dispatchCommand(Qd,n),!0):(!dl(t.target)||!Xo(t.target))&&(null!==zi()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=zi(),r=Dc(e,InputEvent)||Dc(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Ed(r,n,t)}),{tag:$r})}(t,e),!0))}),0),e.registerCommand(Ln,(e=>{const t=zi();return vi(t)&&dh(t),!1}),0),e.registerCommand(In,(e=>{const t=zi();return vi(t)&&dh(t),!1}),0))}const gh={conflictsWith:["@lexical/plain-text"],dependencies:[Id],name:"@lexical/rich-text",nodes:()=>[rh,eh],register:hh};var ph;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:/[;[\]()`,.]/},(ph=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:ph},boolean:ph.boolean,variable:ph.variable};var fh;fh||(fh=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://,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 mh;mh||(mh=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 yh;yh||(yh=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 bh;bh||(bh=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 _h;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.`)}_h||(_h=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 Ch(e,t){for(const n of e.childNodes){if(ul(n)&&n.tagName===t)return!0;Ch(n,t)}return!1}const Sh="data-language",vh="data-highlight-language",wh="data-theme";let kh=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");Sa(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Sh,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(vh,n));const r=this.getTheme();r&&t.setAttribute(wh,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(Sh,r):i&&t.removeAttribute(Sh);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute(vh,r):t.removeAttribute(vh):o&&r&&t.setAttribute(vh,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(wh,s):l&&t.removeAttribute(wh);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");Sa(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Sh,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(vh,n));const r=this.getTheme();r&&t.setAttribute(wh,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)||Ch(e,"BR"))?{conversion:Nh,priority:1}:null,div:()=>({conversion:Ah,priority:1}),pre:()=>({conversion:Nh,priority:0}),table:e=>Rh(e)?{conversion:Lh,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&Rh(n)?{conversion:Oh,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&Rh(t)?{conversion:Oh,priority:3}:null}}}static importJSON(e){return Eh().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=$o();return this.insertAfter(e,t),e}const{anchor:i,focus:o}=e,s=(i.isBefore(o)?i:o).getNode();if(gi(s)){let e=$h(s);const t=[];for(;;)if(yi(e))t.push(mi()),e=e.getNextSibling();else{if(!Dh(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(Mh(" ".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(Th(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=$o();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 Eh(e,t){return function(e){const t=ml();return so(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(kh).setLanguage(e).setTheme(t)}function Th(e){return e instanceof kh}function Nh(e){return{node:Eh(e.getAttribute(Sh))}}function Ah(e){const t=e,n=Fh(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(Fh(t))return!0;t=t.parentElement}return!1}(t)?{node:n?Eh():null}:{node:null}}function Lh(){return{node:Eh()}}function Oh(){return{node:null}}function Fh(e){return null!==e.style.fontFamily.match("monospace")}function Rh(e){return e.classList.contains("js-file-line-container")}let Ih=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 Sa(t,Ph(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=Ph(n.theme,e.__highlightType),o=Ph(n.theme,this.__highlightType);return i!==o&&(i&&va(t,i),o&&Sa(t,o)),r}static importJSON(e){return Mh().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 Eh()}};function Ph(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Mh(e="",t){return rl(new Ih(e,t))}function Dh(e){return e instanceof Ih}function Bh(e,t){let n=e;for(let r=zl(e,t);r&&(Dh(r.origin)||yi(r.origin));r=Rc(r))n=r.origin;return n}function $h(e){return Bh(e,"previous")}function zh(e){return Bh(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 Hh=globalThis.Prism||window.Prism,Kh={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"},Uh={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function Wh(e){return Uh[e]||e}function Vh(e){return"string"==typeof e?e:Array.isArray(e)?e.map(Vh).join(""):Vh(e.content)}function qh(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent();let i=Hh.tokenize(r,Hh.languages[n?"diff":t]);return n&&(i=function(e,t){const n=t,r=Hh.languages[n],i={tokens:e},o=Hh.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 Hh.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=Hh.tokenize(Vh(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])),jh(i)}function jh(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(Mh(i,t))}}else{const{content:e,alias:t}=r;"string"==typeof e?n.push(...jh([e],"prefix"===r.type&&"string"==typeof t?t:r.type)):Array.isArray(e)&&n.push(...jh(e,"unchanged"===r.type?void 0:r.type))}return n}const Zh={$tokenize(e,t){return qh(e,t||this.defaultLanguage)},defaultLanguage:"javascript",tokenize(e,t){return Hh.tokenize(e,Hh.languages[t||""]||Hh.languages[this.defaultLanguage])}};function Gh(e,t,n){const r=e.getParent();Th(r)?Xh(r,t,n):Dh(e)&&e.replace(hi(e.__text))}function Jh(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 Yh=new Set;function Xh(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&&Hh.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),Yh.has(i)||(Yh.add(i),t.update((()=>{!function(e,t){const n=ms(e);if(!Th(n)||!n.isAttached())return;const r=zi();if(!vi(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(!Th(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&&Qh(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++,!Qh(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:()=>{Yh.delete(i)},skipTransforms:!0}))}function Qh(e,t){return Dh(e)&&Dh(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||yi(e)&&yi(t)||Gr(e)&&Gr(t)}function eg(e){if(!vi(e))return!1;const t=e.anchor.getNode(),n=Th(t)?t:t.getParent(),r=e.focus.getNode(),i=Th(r)?r:r.getParent();return Th(n)&&n.is(i)}function tg(e){const t=e.getNodes(),n=[];if(1===t.length&&Th(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];Dh(i)||yi(i)||Gr(i)||xh(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 ng(e){const t=zi();if(!vi(t)||!eg(t))return!1;const n=tg(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]),oa(fa(Jl(Hl(e,"next",0),ha(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=$h(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 rg(e,t){const n=zi();if(!vi(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(!eg(n)||!Dh(l)&&!yi(l)||!Dh(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=$h(l),d=zh(a)):(u=$h(a),d=zh(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(!Dh(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=Dh(p)||yi(p)||Gr(p)?c?$h(p):zh(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 ig(e,t){const n=zi();if(!vi(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=e===En;if(!eg(n)||!Dh(o)&&!yi(o)||!Dh(s)&&!yi(s))return!1;const a=s;if("rtl"===function(e){const t=$h(e),n=zh(e);let r=t;for(;null!==r;){if(Dh(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(Dh(i)||yi(i)||Gr(i)||xh(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];Dh(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let l=null;if(t<e.getTextContentSize())Dh(e)&&(l=e.getTextContent()[t]);else{const t=e.getNextSibling();Dh(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(!Dh(n)||r===o){if(n=n.getNextSibling(),null===n||Gr(n))return null;Dh(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if(Dh(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=zh(e);return Gr(t)&&xh(168),t})(a).select();return t.preventDefault(),t.stopPropagation(),!0}function og(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 sg=/[!-/:-@[-`{-~\s]/;function lg(e){return gi(e)&&!e.hasFormat("code")}function ag(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 cg=lt("mdListMarker",{parse:e=>"string"==typeof e&&/^[-*+]$/.test(e)?e:"-"}),ug=lt("mdCodeFence",{parse:e=>"string"==typeof e&&/^`{3,}$/.test(e)?e:"```"}),dg=e=>(t,n,r,i)=>{const o=e(r);o.append(...n),t.replace(o),i||o.select(0,0)},hg=e=>(t,n,r,i)=>{const o=t.getPreviousSibling(),s=t.getNextSibling(),l=qu("check"===e?"x"===r[3]:void 0),a=r[0].trim()[0],c="bullet"!==e&&"check"!==e||a!==cg.parse(a)?void 0:a;if(ed(s)&&s.getListType()===e){c&&ct(s,cg,c);const e=s.getFirstChild();null!==e?e.insertBefore(l):s.append(l),t.remove()}else if(ed(o)&&o.getListType()===e)c&&ct(o,cg,c),o.append(l),t.remove();else{const n=Qu(e,"number"===e?Number(r[2]):void 0);c&&ct(n,cg,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)},gg=(e,t,n)=>{const r=[],i=e.getChildren();let o=0;for(const s of i)if(ju(s)){if(1===s.getChildrenSize()){const e=s.getFirstChild();if(ed(e)){r.push(gg(e,t,n+1));continue}}const i=" ".repeat(4*n),l=e.getListType(),a=at(e,cg),c="number"===l?`${e.getStart()+o}. `:"check"===l?`${a} [${s.getChecked()?"x":" "}] `:a+" ";r.push(i+c+t(s)),o++}return r.join("\n")},pg={dependencies:[rh],export:(e,t)=>{if(!ah(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:dg((e=>lh("h"+e[1].length))),type:"element"},fg={dependencies:[eh],export:(e,t)=>{if(!nh(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(nh(n))return n.splice(n.getChildrenSize(),0,[Zr(),...t]),void e.remove()}const i=th();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},mg={dependencies:[kh],export:e=>{if(!Th(e))return null;const t=e.getTextContent();let n=at(e,ug);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]="",mg.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),mg.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),mg.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=Eh(c),l=i[0]):(s=Eh(c),l=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{for(s=Eh(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,ug,a);const t=hi(l);s.append(t),e.append(s)}else t&&dg((e=>Eh(e?e[2]:void 0)))(e,t,n,o)},type:"multiline-element"},yg={dependencies:[Zu,Uu],export:(e,t)=>ed(e)?gg(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:hg("bullet"),type:"element"},bg={dependencies:[Zu,Uu],export:(e,t)=>ed(e)?gg(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:hg("number"),type:"element"},_g={dependencies:[ld],export:(e,t,n)=>{if(!ud(e)||gd(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(kl(e,ud))return;const[,n,r,i]=t,o=cd(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"},xg=[...[pg,fg,yg,bg],...[mg],...[{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"}],...[_g]];function Cg(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 Sg(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(vg(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function vg(e,t,n,r,i){for(let o=0;o<i;o++)if(e[t+o]!==n[r+o])return!1;return!0}function wg(e,t=xg){const n=function(e){const t=og(e,(e=>e.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=og(n.textFormat,(({tag:e})=>e[e.length-1])),i=og(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)||ag(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)||Cg(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&&!vg(r,l,n,0,s))continue;if(" "===r[l-1])continue;const a=r[i+1];if(!1===t.intraword&&a&&!sg.test(a))continue;const c=e;let u=c,d=Sg(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=Sg(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&&!sg.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=zi(),_=Di();ws(_);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 vi(b)&&(_.format=b.format),!0}}(t,o,r)};return wa(e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(zr)||t.has(Dr))return;if(e.isComposing())return;const s=r.read(zi),l=i.read(zi);if(!vi(l)||!vi(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(!lg(u))return;const e=u.getParent();null===e||Th(e)||o(e,u,s.anchor.offset)}))})),e.registerCommand(An,(e=>{if(null!==e&&e.shiftKey)return!1;const t=zi();if(!vi(t)||!t.isCollapsed())return!1;const r=t.anchor.offset,i=t.anchor.getNode();if(!gi(i)||!lg(i))return!1;const o=i.getParent();return null!==o&&!Th(o)&&(r===i.getTextContent().length&&!!Cg(o,i,r,n.multilineElement,!0)&&(null!==e&&e.preventDefault(),!0))}),1))}const kg=/[^\w]/;function Eg(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();ws(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 Tg(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(!(vi(o)&&vi(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!(vi(o)&&vi(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 Ng(e){e.undoStack=[],e.redoStack=[],e.current=null}function Ag(e,t,n){const r=Tg(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(qn,(()=>(Ng(t),!1)),0),e.registerCommand(jn,(()=>(Ng(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 Lg(){return{current:null,redoStack:[],undoStack:[]}}var Og={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 Fg(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 Rg(e){return(new DOMParser).parseFromString(e,"text/html")}function Ig(e){return e.startsWith("image/")&&!e.includes("svg")}function Pg(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Mg(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function Dg(e=""){return Rg(e).body.textContent.trim()}class Bg extends No{static getType(){return"horizontal_divider"}static clone(e){return new Bg(e.__key)}static importJSON(e){return new Bg}static importDOM(){return{hr:e=>({conversion:()=>({node:new Bg}),priority:1})}}constructor(e){super(e)}createDOM(){const e=Fg("figure",{className:"horizontal-divider"}),t=Fg("hr");e.appendChild(t);const n=Fg("lexxy-node-delete-button");return e.appendChild(n),e}updateDOM(){return!0}getTextContent(){return"┄\n\n"}isInline(){return!1}exportDOM(){return{element:Fg("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const $g=/^(\d+(?:\.\d+)?)px$/,zg=3,Hg=2,Kg=0,Ug=1;let Wg=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:qg,priority:0}),th:e=>({conversion:qg,priority:0})}}static importJSON(e){return jg().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=Kg,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),Vg(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),Sa(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(ul(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(),...Vg(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=zg){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!==Kg}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 Vg(e){return"middle"===e||"bottom"===e}function qg(e){const t=e,n=e.nodeName.toLowerCase();let r;$g.test(t.style.width)&&(r=parseFloat(t.style.width));let i=Kg;if("th"===n){i="col"===t.getAttribute("scope")?Hg:Ug}const o=jg(i,t.colSpan,r);o.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;""!==s&&(o.__backgroundColor=s);const l=t.style.verticalAlign;Vg(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=$o().append(i),t.push(n))):(t.push(i),r(),n=null);return r(),0===t.length&&t.push($o()),t},node:o}}function jg(e=Kg,t=1,n){return rl(new Wg(e,t,n))}function Zg(e){return e instanceof Wg}const Gg=nn("INSERT_TABLE_COMMAND");function Jg(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 Yg=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:Xg,priority:0})}}static importJSON(e){return Qg().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`),Sa(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 Xg(e){const t=e;let n;return $g.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>Kc(e,Zg),node:Qg(n)}}function Qg(e){return rl(new Yg(e))}function ep(e){return e instanceof Yg}const tp="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,np=tp&&"documentMode"in document?document.documentMode:null,rp=tp&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function ip(e){const t=kl(e,(e=>Zg(e)));return Zg(t)?t:null}function op(e){const t=kl(e,(e=>ep(e)));if(ep(t))return t;throw new Error("Expected table cell to be inside of table row.")}function sp(e){const t=kl(e,(e=>ff(e)));if(ff(t))return t;throw new Error("Expected table cell to be inside of table.")}tp&&"InputEvent"in window&&!np&&new window.InputEvent("input");const lp=(e,t)=>e===zg||e===t?t:Kg;function ap(e=!0){const t=zi();vi(t)||wp(t)||Jg(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=_p(n),[o,,s]=_p(r),[,l,a]=yp(s,o,i),{startRow:c}=a,{startRow:u}=l;return e?cp(c+i.__rowSpan>u+o.__rowSpan?i:o,!0):cp(u<c?o:i,!1)}function cp(e,t=!0){const[,,n]=_p(e),[r,i]=yp(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=Qg();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=lp(t,Hg);a.append(jg(n).append($o()))}else n.setRowSpan(n.__rowSpan+1)}const c=n.getChildAtIndex(t);ep(c)||Jg(256),c.insertAfter(a),l=a}else{const e=s,t=r[e],i=Qg();for(let n=0;n<o;n++){const{cell:r,startRow:o}=t[n];if(o===e){const e=t[n].cell.__headerState,r=lp(e,Hg);i.append(jg(r).append($o()))}else r.setRowSpan(r.__rowSpan+1)}const a=n.getChildAtIndex(e);ep(a)||Jg(257),a.insertBefore(i),l=i}return l}function up(e=!0){const t=zi();vi(t)||wp(t)||Jg(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=_p(n),[o,,s]=_p(r),[,l,a]=yp(s,o,i),{startColumn:c}=a,{startColumn:u}=l;return e?dp(c+i.__colSpan>u+o.__colSpan?i:o,!0):dp(u<c?o:i,!1)}function dp(e,t=!0,n=!0){const[,,r]=_p(e),[i,o]=yp(r,e,e),s=i.length,{startColumn:l}=o,a=t?l+e.__colSpan-1:l-1,c=r.getFirstChild();ep(c)||Jg(120);let u=null;function d(e=Kg){const t=jg(e).append($o());return null===u&&(u=t),t}let h=c;e:for(let e=0;e<s;e++){if(0!==e){const e=h.getNextSibling();ep(e)||Jg(121),h=e}const t=i[e],n=t[a<0?0:a].cell.__headerState,r=lp(n,Ug);if(a<0){gp(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&&hp(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 hp(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function gp(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function pp(e){if(0===e.length)return null;const t=sp(e[0]),[n]=bp(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),fp(i)||d.append(...i.getChildren()),i.remove())}return 0===d.getChildrenSize()&&d.append($o()),d}function fp(e){if(1!==e.getChildrenSize())return!1;const t=e.getFirstChildOrThrow();return!(!zo(t)||!t.isEmpty())}function mp(e){const[t,n,r]=_p(e),i=t.__colSpan,o=t.__rowSpan;if(1===i&&1===o)return;const[s,l]=yp(r,t,t),{startColumn:a,startRow:c}=l,u=t.__headerState&Hg,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&Ug,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(jg(d[e]|g[0]).append($o()));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(),ep(e)||Jg(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--)gp(e,jg(d[n]|g[t]).append($o()));else for(let e=i-1;e>=0;e--)l.insertAfter(jg(d[e]|g[t]).append($o()))}t.setRowSpan(1)}}function yp(e,t,n){const[r,i,o]=bp(e,t,n);return null===i&&Jg(207),null===o&&Jg(208),[r,i,o]}function bp(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];ep(r)||Jg(209);const a=s(e);for(let c=r.getFirstChild(),u=0;null!=c;c=c.getNextSibling()){for(Zg(c)||Jg(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 _p(e){let t;if(e instanceof Wg)t=e;else if("__type"in e){const n=kl(e,Zg);Zg(n)||Jg(148),t=n}else{const n=kl(e.getNode(),Zg);Zg(n)||Jg(148),t=n}const n=t.getParent();ep(n)||Jg(149);const r=n.getParent();return ff(r)||Jg(210),[t,n,r]}function xp(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 Cp(e){const[t,,n]=_p(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 Sp(e){const[[t,n,r,i],[o,s,l,a]]=["anchor","focus"].map((t=>{const n=e[t].getNode(),r=kl(n,Zg);Zg(r)||Jg(238,t,n.getKey(),n.getType());const i=r.getParent();ep(i)||Jg(239,t);const o=i.getParent();return ff(o)||Jg(240,t),[n,r,i,o]}));return i.is(a)||Jg(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:i,focusCell:s,focusNode:o,focusRow:l,focusTable:a}}class vp{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 wp(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 vp(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(Zg).forEach((e=>{const n=e.getFirstChild();zo(n)&&(t|=n.getTextFormat())}));return 0!==(t&Ke[e])}insertNodes(e){const t=this.focus.getNode();Eo(t)||Jg(151),St(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Sp(this),n=Cp(e);null===n&&Jg(153);const r=Cp(t);null===r&&Jg(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}=Sp(this),i=r.getParents()[1];if(i!==t){if(t.isParentOf(r)){const e=i.getParent();null==e&&Jg(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{const e=t.getParent();null==e&&Jg(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}const[o,s,l]=yp(t,n,r),{minColumn:a,maxColumn:c,minRow:u,maxRow:d}=xp(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();ep(r)||Jg(160),r!==g&&(h.set(r.getKey(),r),g=r),h.has(n.getKey())||Ep(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=>Zg(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 wp(e){return e instanceof vp}function kp(e,t,n){e.getKey(),t.getKey(),n.getKey();const r=zi(),i=wp(r)?r.clone():function(){const e=_i("root",0,"element"),t=_i("root",0,"element");return new vp("root",e,t)}();return i.set(e.getKey(),t.getKey(),n.getKey()),i}function Ep(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 Tp(e,t=ml()){const n=ms(e);ff(n)||Jg(231,e);const r=Op(n,t.getElementByKey(e));return null===r&&Jg(232,e),{tableElement:r,tableNode:n}}class Np{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 Tp(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=Hp(n,r)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{const{tableNode:t,tableElement:n}=this.$lookup();this.table=Hp(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();Kp(e,Hp(t,n),null),null!==zi()&&(ws(null),e.dispatchCommand(rn,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();va(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();Sa(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(null!==e){e.tableKey!==this.tableNodeKey&&Jg(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Kp(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=lf(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=kp(r,t,e),ws(this.tableSelection),n.dispatchCommand(rn,void 0),Kp(n,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?ms(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return null===e&&Jg(234),e}$getFocusTableCell(){return this.focusCellNodeKey?ms(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return null===e&&Jg(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=lf(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=kp(t,n,n),this.anchorCellNodeKey=e}}$formatCells(e){const t=zi();wp(t)||Jg(236);const n=Di(),r=n.anchor,i=n.focus,o=t.getNodes().filter(Zg);o.length>0||Jg(237);const s=o[0].getFirstChild(),l=zo(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)})),ws(t),this.editor.dispatchCommand(rn,void 0)}$clearText(){const{editor:e}=this,t=ms(this.tableNodeKey);if(!ff(t))throw new Error("Expected TableNode.");const n=zi();wp(n)||Jg(253);const r=n.getNodes().filter(Zg),i=t.getFirstChild(),o=t.getLastChild();if(r.length>0&&null!==i&&null!==o&&ep(i)&&ep(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=$o(),n=hi();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),Kp(e,this.table,null),ws(null),e.dispatchCommand(rn,void 0)}}const Ap="__lexicalTableSelection";function Lp(e){return ul(e)&&"TABLE"===e.nodeName}function Op(e,t){if(!t)return t;const n=Lp(t)?t:e.getDOMSlot(t).element;return"TABLE"!==n.nodeName&&Jg(245,t.nodeName),n}function Fp(e){return e._window}function Rp(e,t){for(let n=t,r=null;null!==n;n=n.getParent()){if(e.is(n))return r;Zg(n)&&(r=n)}return null}const Ip=[[Nn,"down"],[Tn,"up"],[kn,"backward"],[vn,"forward"]],Pp=[yn,bn,dn],Mp=[On,Rn];function Dp(e,t,n,r){const i=n.getRootElement(),o=Fp(n);null!==i&&null!==o||Jg(246);const s=new Np(n,e.getKey()),l=Op(e,t);!function(e,t){null!==Bp(e)&&Jg(205),e[Ap]=t}(l,s),s.listenersToRemove.add((()=>function(e,t){Bp(e)===t&&delete e[Ap]}(l,s)));const a=t=>{if(s.pointerType=t.pointerType,0!==t.button||!dl(t.target)||!o)return;const r=$p(t.target);null!==r&&n.update((()=>{const n=Hi();if(rp&&t.shiftKey&&Gp(n,e)&&(vi(n)||wp(n))){const i=n.anchor.getNode(),o=Rp(e,n.anchor.getNode());o?(s.$setAnchorCellForSelection(sf(s,o)),s.$setFocusCellForSelection(r),nf(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(!dl(e.target))return;let i=null;const a=!(rp||l.contains(e.target));if(a)i=zp(l,e.target);else for(const t of document.elementsFromPoint(e.clientX,e.clientY))if(i=zp(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&&dl(e.target)&&null!==$p(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&&dl(t)&&n.update((()=>{const e=zi();wp(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 Ip)s.listenersToRemove.add(n.registerCommand(t,(t=>tf(n,t,r,e,s)),3));s.listenersToRemove.add(n.registerCommand(Fn,(t=>{const n=zi();if(wp(n)){const r=Rp(e,n.focus.getNode());if(null!==r)return nf(t),r.selectEnd(),!0}return!1}),3));const d=t=>()=>{const n=zi();if(!Gp(n,e))return!1;if(wp(n))return s.$clearText(),!0;if(vi(n)){if(!Zg(Rp(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=kl(n.anchor.getNode(),(e=>Eo(e))),c=a&&kl(a,(e=>Eo(e)&&Zg(e.getParent())));if(!Eo(c)||!Eo(a))return!1;if(t===bn&&null===c.getPreviousSibling())return!0}return!1};for(const e of Pp)s.listenersToRemove.add(n.registerCommand(e,d(e),3));const h=t=>{const n=zi();if(!wp(n)&&!vi(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!!Gp(n,e)&&!!wp(n)&&(t&&(t.preventDefault(),t.stopPropagation()),s.$clearText(),!0)};for(const e of Mp)s.listenersToRemove.add(n.registerCommand(e,h,3));return s.listenersToRemove.add(n.registerCommand(Wn,(e=>{const t=zi();if(t){if(!wp(t)&&!vi(t))return!1;Ld(n,Dc(e,ClipboardEvent)?e:null,Rd(t));const r=h(e);return vi(t)?(t.removeText(),!0):r}return!1}),3)),s.listenersToRemove.add(n.registerCommand(_n,(t=>{const n=zi();if(!Gp(n,e))return!1;if(wp(n))return s.$formatCells(t),!0;if(vi(n)){const e=kl(n.anchor.getNode(),(e=>Zg(e)));if(!Zg(e))return!1}return!1}),3)),s.listenersToRemove.add(n.registerCommand($n,(t=>{const n=zi();if(!wp(n)||!Gp(n,e))return!1;const r=n.anchor.getNode(),i=n.focus.getNode();if(!Zg(r)||!Zg(i))return!1;if(function(e,t){if(wp(e)){const n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){const[e]=yp(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]=yp(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=zi();if(!Gp(r,e))return!1;if(wp(r))return s.$clearHighlight(),!1;if(vi(r)){const i=kl(r.anchor.getNode(),(e=>Zg(e)));if(!Zg(i))return!1;if("string"==typeof t){const i=of(n,r,e);if(i)return rf(i,e,[hi(t)]),!0}}return!1}),3)),r&&s.listenersToRemove.add(n.registerCommand(In,(t=>{const n=zi();if(!vi(n)||!n.isCollapsed()||!Gp(n,e))return!1;const r=Qp(n.anchor.getNode());return!(null===r||!e.is(ef(r))||(nf(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=kl(e,ep);null===o&&Jg(247);for(let e=o[n]();ep(e);e=e[n]()){const t=e[r]();if(Eo(t))return t.selectEnd()}const s=kl(o,ff);null===s&&Jg(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=zi(),r=Hi(),i=s.getAndClearNextFocus();if(null!==i){const{focusCell:e}=i;if(wp(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()&&vi(r)&&vi(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=e.getFirstChild(),i=Qp(n);if(null!==i&&ep(r)){const t=r.getFirstChild();if(Zg(t)&&e.is(kl(i,(n=>n.is(e)||n.is(t)))))return t.selectStart(),!0}}if(vi(t)){const{anchor:i,focus:o}=t,l=i.getNode(),a=o.getNode(),c=Qp(l),u=Qp(a),d=!(!c||!e.is(ef(c))),h=!(!u||!e.is(ef(u))),g=d!==h,p=d&&h,f=t.isBackward();if(g){const r=t.clone();if(h){const[t]=yp(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]=yp(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")}ws(r),Wp(n,s)}else if(p&&(c.is(u)||(s.$setAnchorCellForSelection(sf(s,c)),s.$setFocusCellForSelection(sf(s,u),!0)),"touch"===s.pointerType&&s.isSelecting&&t.isCollapsed()&&vi(r)&&r.isCollapsed())){const e=Qp(r.anchor.getNode());e&&!e.is(u)&&(s.$setAnchorCellForSelection(sf(s,e)),s.$setFocusCellForSelection(sf(s,u),!0),s.pointerType=null)}}else if(t&&wp(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 $i(null,e,t,null)}(r,n);i&&(i.anchor.set(e.getKey(),t.isBackward()?e.getChildrenSize():0,"element"),r.removeAllRanges(),ws(i))}}}return t&&!t.is(r)&&(wp(t)||wp(r))&&s.tableSelection&&!s.tableSelection.is(r)?(wp(t)&&t.tableKey===s.tableNodeKey?s.$updateTableTableSelection(t):!wp(t)&&wp(r)&&r.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!e.isSelected()?function(e,t){t.$enableHighlightStyle(),Up(t.table,(t=>{const n=t.elem;t.highlighted=!1,Xp(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(n,s):!s.hasHijackedSelectionStyles&&e.isSelected()&&Wp(n,s),!1)}),3)),s.listenersToRemove.add(n.registerCommand(gn,(()=>{const t=zi();if(!vi(t)||!t.isCollapsed()||!Gp(t,e))return!1;const r=of(n,t,e);return!!r&&(rf(r,e),!0)}),3)),s}function Bp(e){return e[Ap]||null}function $p(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 zp(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 Hp(e,t){const n=[],r={columns:0,domRows:n,rows:0};let i=Op(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 Kp(e,t,n){const r=new Set(n?n.getNodes():[]);Up(t,((t,n)=>{const i=t.elem;r.has(n)?(t.highlighted=!0,Yp(e,t)):(t.highlighted=!1,Xp(e,t),i.getAttribute("style")||i.removeAttribute("style"))}))}function Up(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 Wp(e,t){t.$disableHighlightStyle(),Up(t.table,(t=>{t.highlighted=!0,Yp(e,t)}))}const Vp=(e,t,n,r,i)=>{const o="forward"===i;switch(i){case"backward":case"forward":return n!==(o?e.table.columns-1:0)?Jp(t.getCellNodeFromCordsOrThrow(n+(o?1:-1),r,e.table),o):r!==(o?e.table.rows-1:0)?Jp(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?Jp(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1):t.selectPrevious(),!0;case"down":return r!==e.table.rows-1?Jp(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0):t.selectNext(),!0;default:return!1}};function qp(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 jp([e,t]){return["minColumn"===e?"maxColumn":"minColumn","minRow"===t?"maxRow":"minRow"]}function Zp(e,t,[n,r]){const i=t[r],o=e[i];void 0===o&&Jg(250,r,String(i));const s=t[n],l=o[s];return void 0===l&&Jg(250,n,String(s)),l}function Gp(e,t){if(vi(e)||wp(e)){const n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function Jp(e,t){t?e.selectStart():e.selectEnd()}function Yp(e,t){const n=t.elem,r=e._config.theme;Zg(_s(n))||Jg(131),Sa(n,r.tableCellSelected)}function Xp(e,t){const n=t.elem;Zg(_s(n))||Jg(131);va(n,e._config.theme.tableCellSelected)}function Qp(e){const t=kl(e,Zg);return Zg(t)?t:null}function ef(e){const t=kl(e,ff);return ff(t)?t:null}function tf(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=zi();if(!Gp(o,r)){if(vi(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!!ff(n)&&(nf(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=kl(e,(e=>ff(e)));if(Zg(i)&&(i=kl(i,ff)),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"),ws(c),nf(t),!0}if(tl(e)){const e="up"===n?o.getNodes()[o.getNodes().length-1]:o.getNodes()[0];if(e&&null!==Rp(r,e)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=_p(e),[o]=_p(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=kl(e,(e=>Eo(e)&&!e.isInline()));if(Zg(r)&&(r=kl(r,ff)),!r)return!1;const s="down"===n?r.getNextSibling():r.getPreviousSibling();if(ff(s)&&i.tableNodeKey===s.getKey()){const e=s.getFirstDescendant(),r=s.getLastDescendant();if(!e||!r)return!1;const[i]=_p(e),[l]=_p(r),a=o.clone();return a.focus.set(("up"===n?i:l).getKey(),"up"===n?0:l.getChildrenSize(),"element"),nf(t),ws(a),!0}}}}return"down"===n&&uf(e)&&i.setShouldCheckSelection(),!1}if(vi(o)){if("backward"===n||"forward"===n)return function(e,t,n,r,i,o,s){const l=ra(n.focus,i?"previous":"next");if(ga(l))return!1;let a=l;for(const e of Zl(l).iterNodeCarets("shadowRoot")){if(!Pl(e)||!Eo(e.origin))return!1;a=e}const c=a.getParentAtCaret();if(!Zg(c))return!1;const u=c,d=function(e){for(const t of Zl(e).iterNodeCarets("root")){const{origin:n}=t;if(Zg(n)){if(Ml(t))return Wl(n,e.direction)}else if(!ep(n))break}return null}(zl(u,a.direction)),h=kl(u,ff);if(!h||!h.is(o))return!1;const g=e.getElementByKey(u.getKey()),p=$p(g);if(!g||!p)return!1;const f=hf(e,h);if(s.table=f,d)if("extend"===r){const t=$p(e.getElementByKey(d.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(t,!0)}else{const e=ha(d);ia(n.anchor,e),ia(n.focus,e)}else if("extend"===r)s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(p,!0);else{const e=function(e){const t=Vl(e);return Ml(t)?ha(t):e}(zl(h,l.direction));ia(n.anchor,e),ia(n.focus,e)}return nf(t),!0}(e,t,o,t.shiftKey?"extend":"move","backward"===n,r,i);if(o.isCollapsed()){const{anchor:s,focus:l}=o,a=kl(s.getNode(),Zg),c=kl(l.getNode(),Zg);if(!Zg(a)||!a.is(c))return!1;const u=ef(a);if(u!==r&&null!=u){const r=Op(u,e.getElementByKey(u.getKey()));if(null!=r)return i.table=Hp(u,r),tf(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(Fp(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){nf(t);const e=r.getCordsFromCellNode(a,i.table);if(!t.shiftKey)return Vp(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(wp(o)){const{anchor:s,focus:l}=o,a=kl(s.getNode(),Zg),c=kl(l.getNode(),Zg),[u]=o.getNodes();ff(u)||Jg(251);const d=Op(u,e.getElementByKey(u.getKey()));if(!Zg(a)||!Zg(c)||!ff(u)||null==d)return!1;i.$updateTableTableSelection(o);const h=Hp(u,d),g=r.getCordsFromCellNode(a,h),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,h);if(i.$setAnchorCellForSelection(p),nf(t),t.shiftKey){const[e,t,o]=yp(r,a,c);return function(e,t,n,r,i){const o=xp(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=qp(e,t);return null===n&&Jg(249,t.cell.getKey()),n}(o,n),[h,g]=jp(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=xp(e,t,n),i=qp(r,t);if(i)return[Zp(e,r,i),Zp(e,r,jp(i))];const o=qp(r,n);if(o)return[Zp(e,r,jp(o)),Zp(e,r,o)];const s=["minColumn","minRow"];return[Zp(e,r,s),Zp(e,r,jp(s))]}(t,n,y),x=sf(e,b.cell),C=sf(e,_.cell);return e.$setAnchorCellForSelection(x),e.$setFocusCellForSelection(C,!0),!0}(i,e,t,o,n)}return c.selectEnd(),!0}return!1}function nf(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function rf(e,t,n){const r=$o();"first"===e?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function of(e,t,n){const r=n.getParent();if(!r)return;const i=ll(Fp(e));if(!i)return;const o=i.anchorNode,s=e.getElementByKey(r.getKey()),l=Op(n,e.getElementByKey(n.getKey()));if(!o||!s||!l||!s.contains(o)||l.contains(o))return;const a=kl(t.anchor.getNode(),(e=>Zg(e)));if(!a)return;const c=kl(a,(e=>ff(e)));if(!ff(c)||!c.is(n))return;const[u,d]=yp(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 sf(e,t){const{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function lf(e,t,n){return Rp(e,_s(t,n))}function af(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)}va(e,...r),Sa(e,...i)}const cf=new WeakSet;function uf(e=ml()){return cf.has(e)}class df 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 df(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:gf,priority:1})}}static importJSON(e){return pf().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=Lp(e)?e:e.querySelector("table");return Lp(t)||Jg(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),Sa(n,e.theme.table),this.updateTableElement(null,n,e),uf(t)){const t=document.createElement("div"),r=e.theme.tableScrollableWrapper;return r?Sa(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?(Sa(e,n.theme.tableFrozenColumn),t.setAttribute("data-lexical-frozen-column","true")):(va(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?(Sa(e,n.theme.tableFrozenRow),t.setAttribute("data-lexical-frozen-row","true")):(va(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?(Sa(e,t.theme.tableRowStriping),e.setAttribute("data-lexical-row-striping","true")):(va(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()),af(t,n,this.getFormatType())}updateDOM(e,t,n){const r=this.getDOMSlot(t).element;return t===r===uf()||(ul(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)),!Lp(n)&&ul(n)&&(n=n.querySelector("table")),!Lp(n))return null;af(n,e._config,this.getFormatType());const[r]=bp(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:!Lp(n)&&ul(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=lf(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 Zg(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=>{Zg(e)&&(t+=e.getColSpan())})),t}}function hf(e,t){const n=e.getElementByKey(t.getKey());return null===n&&Jg(230),Hp(t,n)}function gf(e){const t=pf();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(!$g.test(n)&&(n=t.getAttribute("width")||"",!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>Kc(e,ep),node:t}}function pf(){return rl(new df)}function ff(e){return e instanceof df}function mf(e){ep(e.getParent())?e.isEmpty()&&e.append($o()):e.remove()}function yf(e){ff(e.getParent())?zc(e,Zg):e.remove()}function bf(e){zc(e,ep);const[t]=bp(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;ep(i)||Jg(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=jg();e.append($o()),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 _f(e){if(e.detail<3||!dl(e.target))return!1;const t=_s(e.target);if(null===t)return!1;const n=kl(t,(e=>Eo(e)&&!e.isInline()));return null!==n&&(!!Zg(n.getParent())&&(n.select(0),!0))}function xf(){const e=zi();if(!vi(e))return!1;const t=ef(e.anchor.getNode());if(null===t)return!1;const n=Ss();if(!n.is(t.getParent())||1!==n.getChildrenSize())return!1;const[r]=bp(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 ws(kp(t,i.cell,s.cell)),!0}function Cf(e,t){e.hasNodes([df])||Jg(255);const{hasNestedTables:n=nu(!1),hasFitNestedTables:r=nu(!1)}={};return wa(e.registerCommand(Gg,(e=>function({rows:e,columns:t,includeHeaders:n},r){const i=zi()||Hi();if(!i||!vi(i))return!1;if(!r&&ef(i.anchor.getNode()))return!1;const o=function(e,t,n=!0){const r=pf();for(let i=0;i<e;i++){const e=Qg();for(let r=0;r<t;r++){let t=Kg;"object"==typeof n?(0===i&&n.rows&&(t|=Ug),0===r&&n.columns&&(t|=Hg)):n&&(0===i&&(t|=Ug),0===r&&(t|=Hg));const o=jg(t),s=$o();s.append(hi()),o.append(s),e.append(o)}r.append(e)}return r}(Number(e),Number(t),n);Pc(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=>ff(e)||Fc(e).some((e=>ff(e.node))))))return!1;const o=wp(i),s=vi(i);return!!(s&&null!==kl(i.anchor.getNode(),(e=>Zg(e)))&&null!==kl(i.focus.getNode(),(e=>Zg(e)))||o)&&(1===r.length&&ff(r[0])?function(e,t){const n=t.getStartEndPoints(),r=wp(t);if(null===n)return!1;const[i,o]=n,[s,l,a]=_p(i),c=kl(o.getNode(),(e=>Zg(e)));if(!(Zg(s)&&Zg(c)&&ep(l)&&ff(a)))return!1;const[u,d,h]=yp(a,s,c),[g]=bp(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=xp(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,v=new Set;for(let e=m;e<=C;e++)for(let t=y;t<=S;t++){const n=u[e][t];v.has(n.cell.getKey())||1===n.cell.__rowSpan&&1===n.cell.__colSpan||(mp(n.cell),v.add(n.cell.getKey()),x=!0)}let[w]=bp(a.getWritable(),null,null);const k=b-p+m;for(let e=0;e<k;e++)cp(w[p-1][0].cell);const E=_-f+y;for(let e=0;e<E;e++)dp(w[0][f-1].cell,!0,!1);[w]=bp(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=w[o][e];n.push(t.cell)}pp(n),x=!0}const{cell:s}=w[e][t],l=o.getBackgroundColor();null!=l&&s.setBackgroundColor(l);const a=s.getChildren();o.getChildren().forEach((e=>{gi(e)?($o().append(e),s.append(e)):s.append(e)})),a.forEach((e=>e.remove()))}if(r&&x){const[e]=bp(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=wp(t)&&!t.focus.getNode().is(t.anchor.getNode()),i=vi(t)&&Zg(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=kl(o,Zg);if(!s)return!1;const l=Sf(s);if(void 0===l)return!1;const a=function(e){const t=ml().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(!($g.test(r)&&$g.test(i)&&$g.test(o)&&$g.test(s)))return 0;return parseFloat(r)+parseFloat(i)+parseFloat(o)+parseFloat(s)}(s),c=e.filter(ff);for(const e of c)vf(e,l,a);return!1}(r,i,n.peek()))}(t,n,r)),0),e.registerCommand(Vn,xf,1),e.registerCommand(sn,_f,0),e.registerNodeTransform(df,bf),e.registerNodeTransform(Yg,yf),e.registerNodeTransform(Wg,mf))}function Sf(e){const t=sp(e),n=Cp(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 vf(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(ep);for(const e of l){const t=e.getChildren().filter(Zg);for(const e of t){const t=Sf(e);if(void 0!==t)for(const r of e.getChildren().filter(ff))vf(r,t,n)}}}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]}`}class kf extends No{static getType(){return"custom_action_text_attachment"}static clone(e){return new kf({...e},e.__key)}static importJSON(e){return new kf({...e})}static importDOM(){return{[this.TAG_NAME]:e=>e.getAttribute("content")?{conversion:e=>{const t=[],n=e.previousSibling;n&&n.nodeType===Node.TEXT_NODE&&/\s$/.test(n.textContent)&&t.push(hi(" "));const r=function(e){try{return JSON.parse(e)}catch{return e}}(e.getAttribute("content"));t.push(new kf({sgid:e.getAttribute("sgid"),innerHtml:r,plainText:e.textContent.trim()||Dg(r),contentType:e.getAttribute("content-type")}));const i=e.nextSibling;return i&&i.nodeType===Node.TEXT_NODE&&/^\s/.test(i.textContent)&&t.push(hi(" ")),{node:t}},priority:2}:null}}static get TAG_NAME(){return Xa.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,contentType:n,innerHtml:r,plainText:i},o){super(o);const s=Xa.global.get("attachmentContentTypeNamespace");this.tagName=e||kf.TAG_NAME,this.sgid=t,this.contentType=n||`application/vnd.${s}.unknown`,this.innerHtml=r,this.plainText=i??Dg(r)}createDOM(){const e=Fg(this.tagName,{"content-type":this.contentType,"data-lexxy-decorator":!0});e.insertAdjacentHTML("beforeend",this.innerHtml);const t=Fg("lexxy-node-delete-button");return e.appendChild(t),e}updateDOM(){return!1}getTextContent(){return"\ufeff"}getReadableTextContent(){return this.plainText||`[${this.contentType}]`}isInline(){return!0}exportDOM(){return{element:Fg(this.tagName,{sgid:this.sgid,content: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,plainText:this.plainText}}decorate(){return null}}const Ef=[Br,Hr];function Tf(e){if(gi(e))return Mc(e,$o);if(e.isParentRequired()){const t=e.createRequiredParent();return Mc(e,t)}return e}function Nf(e){const t=Ic(e,Zu);return t?.getListType()??null}function Af(e,t=null){return null===t?Af(e,!0)||Af(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)||ka(177),e.offset===t.getChildrenSize()}(e)}function Lf(e,...t){return Of(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 Of(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 Ff(e){const t=e.anchor.getNode(),n=Eo(t)?t:t.getParentOrThrow(),r=n.getChildren();if(0===r.length)return!0;const i=r[r.length-1];if(t===n.getLatest()&&e.anchor.offset===r.length)return!0;if(t===i)return!0;const o=r.findLastIndex((e=>Gr(e)));if(-1===o)return!0;return r.indexOf(t)>o}function Rf(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren?.();return!t||0===t.length||t.every((e=>!!Gr(e)||Rf(e)))}function If(e){for(const t of Wc(e)){if(!Rf(t))break;t.remove()}}function Pf(e,t,n,r){return gi(e)&&" "===e.getTextContent()&&n===r-1&&t instanceof kf}function Mf(e){return!!vi(e)&&(e.isCollapsed()?Df(e.style):e.hasFormat("highlight"))}function Df(e){const t="string"==typeof e?Na(e):e;return!(!t.color&&!t["background-color"])}class Bf{constructor(e,t=[]){this._property=e,this._allowedValues=t,this._canonicalValues=this.#j}applyCanonicalization(e){const t={...Na(e)};return t[this._property]=this.getCanonicalAllowedValue(t[this._property]),t[this._property]||delete t[this._property],Aa(t)}getCanonicalAllowedValue(e){return this._canonicalValues[e]||=this.#Z(e)}get#j(){return this._allowedValues.reduce(((e,t)=>({...e,[t]:t})),{})}#Z(e){let t=this.#G.indexOf(e);return t||=this.#G.indexOf($f(this._property,e)),-1===t?null:this._allowedValues[t]}get#G(){return this._computedAllowedValues||=this._allowedValues.map((e=>$f(this._property,e)))}}function $f(e,t){const n=`${e}: ${t};`,r=document.body.appendChild(Fg("span",{style:"display: none;"+n})),i=window.getComputedStyle(r).getPropertyValue(e);return r.remove(),i}class zf{#J;constructor(e){this.#J=e}get editorElement(){return this.#J}get editorConfig(){return this.#J.config}get enabled(){return!0}get lexicalExtension(){return null}initializeToolbar(e){}}const Hf=nn(),Kf=nn(),Uf={color:null,"background-color":null},Wf=lt("hasPastedStyles",{parse:e=>e||!1}),Vf=new WeakMap;class qf extends zf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return[{dependencies:[gh],name:"lexxy/highlight",config:{color:{buttons:[],permit:[]},"background-color":{buttons:[],permit:[]}},html:{import:{mark:Zf}},register(e,t){const n=function(e){return[new Bf("color",[...e.buttons.color,...e.permit.color]),new Bf("background-color",[...e.buttons["background-color"],...e.permit["background-color"]])]}(t);return function(e){if(!e._htmlConversions)return;let t=e._htmlConversions.get("pre");t||(t=[],e._htmlConversions.set("pre",t));t.push(function(e){return function(t){const n=function(e){const t=[],n=e.querySelector("code")||e;let r=0;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent.length;else if(e.nodeType===Node.ELEMENT_NODE){if("BR"===e.tagName)return void(r+=1);const n="MARK"===e.tagName,o=r;for(const t of e.childNodes)i(t);if(n){const n=function(e){const t={};e.style?.color&&(t.color=e.style.color);e.style?.backgroundColor&&(t["background-color"]=e.style.backgroundColor);const n=Aa(t);return n.length>0?n:null}(e);n&&t.push({start:o,end:r,style:n})}}}for(const e of n.childNodes)i(e);return t}(t);return 0===n.length?null:{conversion:t=>{const r=Eh(t.getAttribute("data-language"));return Gf(e).set(r.getKey(),n),{node:r}},priority:2}}}(e))}(e),wa(e.registerCommand(Hf,(t=>Xf(e,t)),2),e.registerCommand(Kf,(()=>Xf(e,Uf)),2),e.registerNodeTransform(ri,rm),e.registerNodeTransform(Ih,im),e.registerNodeTransform(ri,(e=>function(e,t=[]){if(function(e){return at(e,Wf)}(e)){om(e,!1);const n=function(e,t=[]){return t.reduce(((e,t)=>t.applyCanonicalization(e)),e)}(e.getStyle(),t);e.setStyle(n);const r=zi();e.isSelected(r)&&(r.setStyle(e.getStyle()),r.setFormat(e.getFormat()))}}(e,n))),e.registerMutationListener(kh,(t=>{!function(e,t){const n=Gf(e),r=[];for(const[e,i]of t)"destroyed"!==i&&n.has(e)&&r.push(e);if(0===r.length)return;e.update((()=>{for(const e of r){const t=n.get(e);if(n.delete(e),!t)continue;const r=ms(e);r&&Th(r)&&Jf(r,t)}}),{skipTransforms:!0,discrete:!0})}(e,t)}),{skipInitialization:!0}))}},this.editorConfig.get("highlight")]}}function jf(e,t){const n={color:t.style?.color,"background-color":t.style?.backgroundColor};(function(e){return co()._updateTags.has(e)})($r)&&om(e);const r=Aa(n);if(r.length)return e.setStyle(e.getStyle()+r)}function Zf(){return{conversion:Lf("mark",jf),priority:1}}function Gf(e){let t=Vf.get(e);return t||(t=new Map,Vf.set(e,t)),t}function Jf(e,t){if(0!==t.length)for(const{start:n,end:r,style:i}of t){const t=Yf(e);for(const{node:e,start:o,end:s}of t){const t=Math.max(n,o),l=Math.min(r,s);if(t>=l)continue;const a=t-o,c=l-o,u=s-o;if(0===a&&c===u)e.setStyle(i),tm(e,!0);else{const t=e.getTextContent(),n=e.getHighlightType(),r=[];a>0&&r.push(Mh(t.slice(0,a),n));const o=Mh(t.slice(a,c),n);o.setStyle(i),tm(o,!0),r.push(o),c<u&&r.push(Mh(t.slice(c),n));for(const t of r)e.insertBefore(t);e.remove()}}}}function Yf(e){const t=[];let n=0;for(const r of e.getChildren())if(Dh(r)){const e=r.getTextContent();t.push({node:r,start:n,end:n+e.length}),n+=e.length}else n+=1;return t}function Xf(e,t){const n=zi();if(!vi(n))return;const r={};for(const e in t){const i=Va(n,e);r[e]=nm(i,t[e])}!function(e){const t=e.getNodes();return t.some((e=>Th(Dh(e)?e.getParent():e)))}(n)?Ma(n,r):function(e,t,n){const r=t.getNodes().filter((e=>Dh(e))).map((e=>({key:e.getKey(),startOffset:Qf(e,t)[0],endOffset:Qf(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||!Dh(r))continue;if(Th(r.getParent())&&t!==i)if(0===t&&i===o)em(r,n);else{em(r.splitText(t,i)[0===t?0:1],n)}}}),{skipTransforms:!0,discrete:!0})}(e,n,r)}function Qf(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 em(e,t){const n={...Na(e.getStyle())};for(const[e,r]of Object.entries(t))null===r?delete n[e]:n[e]=r;const r=Aa(n);e.setStyle(r);const i=Df(r);i!==e.hasFormat("highlight")&&tm(e,i)}function tm(e,t){const n=e.getWritable();t?n.__format|=128:n.__format&=-129}function nm(e,t){return e===t?null:t}function rm(e){Df(e.getStyle())!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}function im(e){if(!Th(e.getParent()))return;const t=Df(e.getStyle());t!==e.hasFormat("highlight")&&tm(e,t)}function om(e,t=!0){ct(e,Wf,t)}const sm=["bold","italic","strikethrough","underline","link","unlink","toggleHighlight","removeHighlight","setFormatHeadingLarge","setFormatHeadingMedium","setFormatHeadingSmall","setFormatParagraph","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","insertHorizontalDivider","uploadImage","uploadFile","insertTable","undo","redo"];class lm{#Y=null;#X=[];static configureFor(e){return new lm(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#Q(),this.#ee(),this.#te()}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")}dispatchUnderline(){this.editor.dispatchCommand(_n,"underline")}dispatchToggleHighlight(e){this.editor.dispatchCommand(Hf,e)}dispatchRemoveHighlight(){this.editor.dispatchCommand(Kf)}dispatchLink(e){this.editor.update((()=>{const t=zi();if(vi(t))if(t.isCollapsed()){const n=hd(e),r=hi(e);n.append(r),t.insertNodes([n])}else fd(e)}))}dispatchUnlink(){this.#ne(null)}dispatchInsertUnorderedList(){const e=zi();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===Nf(t)?this.contents.applyParagraphFormat():this.editor.dispatchCommand(nd,void 0)}dispatchInsertOrderedList(){const e=zi();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===Nf(t)?this.contents.applyParagraphFormat():this.editor.dispatchCommand(rd,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleBlockquote()}dispatchInsertCodeBlock(){this.selection.hasSelectedWordsInSingleLine?this.#re():this.contents.toggleCodeBlock()}#re(){const e=zi();if(vi(e)){if(!e.isCollapsed()){const t=e.getNodes().filter(gi);!t.every((e=>e.hasFormat("code")))&&this.#ie(e,t)}this.editor.dispatchCommand(_n,"code")}}#ie(e,t){const n=e.isBackward(),r=n?e.focus:e.anchor,i=n?e.anchor:e.focus;for(let e=0;e<t.length;e++){const n=t[e];if(0===n.getFormat())continue;const o=0===e,s=e===t.length-1,l=o&&"text"===r.type?r.offset:0,a=s&&"text"===i.type?i.offset:n.getTextContentSize();if(0===l&&a===n.getTextContentSize())n.setFormat(0);else{const e=n.splitText(l,a),t=0===l?e[0]:e[1];t.setFormat(0),o&&"text"===r.type&&r.set(t.getKey(),0,"text"),s&&"text"===i.type&&i.set(t.getKey(),a-l,"text")}}}dispatchInsertHorizontalDivider(){this.contents.insertAtCursorEnsuringLineBelow(new Bg),this.editor.focus()}dispatchSetFormatHeadingLarge(){this.contents.applyHeadingFormat("h2")}dispatchSetFormatHeadingMedium(){this.contents.applyHeadingFormat("h3")}dispatchSetFormatHeadingSmall(){this.contents.applyHeadingFormat("h4")}dispatchSetFormatParagraph(){this.contents.applyParagraphFormat()}dispatchUploadImage(){this.#oe("image/*,video/*")}dispatchUploadFile(){this.#oe()}#oe(e=null){const t={type:"file",multiple:!0,style:"display: none;",onchange:({target:{files:e}})=>{this.contents.uploadFiles(e,{selectLast:!0})}};e&&(t.accept=e);const n=Fg("input",t);this.editorElement.appendChild(n),n.click(),setTimeout((()=>n.remove()),1e3)}dispatchInsertTable(){this.editor.dispatchCommand(Gg,{rows:3,columns:3,includeHeaders:!0})}dispatchUndo(){this.editor.dispatchCommand(xn,void 0)}dispatchRedo(){this.editor.dispatchCommand(Cn,void 0)}dispose(){for(;this.#X.length;){this.#X.pop()()}}#Q(){for(const t of sm){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#se(t,0,this[n].bind(this))}var e;this.#se(fn,1,this.dispatchPaste.bind(this))}#se(e,t,n){this.#X.push(this.editor.registerCommand(e,n,t))}#ee(){this.#se(vn,2,this.#le.bind(this)),this.#se(In,2,this.#ae.bind(this))}#le(e){const t=zi();if(!vi(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))}#te(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#ce.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#ue.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#de.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#he.bind(this)))}#de(e){this.#ge(e)||(this.dragCounter++,1===this.dragCounter&&(this.#pe(),this.editor.getRootElement().classList.add("lexxy-editor--drag-over")))}#he(e){this.#ge(e)||(this.dragCounter--,0===this.dragCounter&&(this.#Y=null,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")))}#ce(e){this.#ge(e)||e.preventDefault()}#ue(e){if(this.#ge(e))return;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.#fe(),this.contents.uploadFiles(n,{selectLast:!0}),this.editor.focus())}#pe(){this.editor.getEditorState().read((()=>{this.#Y=zi()?.clone()}))}#fe(){this.#Y&&(this.editor.update((()=>{ws(this.#Y)})),this.#Y=null)}#ge(e){return e.dataTransfer?.types.includes("application/x-lexxy-node-key")}#ae(e){return this.selection.isInsideList?this.#me(e):!!this.selection.isInsideCodeBlock&&this.#ye()}#me(e){if(e.shiftKey&&!this.selection.isIndentedList)return!1;e.preventDefault();const t=e.shiftKey?Dn:Mn;return this.editor.dispatchCommand(t)}#ye(){const e=zi();return vi(e)&&e.isCollapsed()}#ne(e){this.editor.update((()=>{fd(null===e?null:e)}))}}function am(){return new Promise(requestAnimationFrame)}function cm(e){try{return new URL(e),!0}catch{return!1}}function um(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function dm(e){return e.charAt(0).toUpperCase()+e.slice(1)}class hm extends No{static getType(){return"action_text_attachment"}static clone(e){return new hm({...e},e.__key)}static importJSON(e){return new hm({...e})}static importDOM(){return{[this.TAG_NAME]:()=>({conversion:e=>({node:new hm({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 hm({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 hm({src:t,fileName:n,contentType:r})}},priority:1})}}static get TAG_NAME(){return Xa.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){var h;super(d),this.tagName=e||hm.TAG_NAME,this.sgid=t,this.src=n,this.previewable="string"==typeof(h=r)?"true"===h:Boolean(h),this.altText=i||"",this.caption=o||"",this.contentType=s||"",this.fileName=l||"",this.fileSize=a,this.width=c,this.height=u,this.editor=ml()}createDOM(){const e=this.createAttachmentFigure();return this.isPreviewableAttachment?(e.appendChild(this.#be()),e.appendChild(this.#_e())):(e.appendChild(this.#xe()),e.appendChild(this.#Ce())),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:Fg(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,Fg("figure",{className:`attachment attachment--${n?"preview":"file"} attachment--${r?r.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":t}));var t,n,r;e.draggable=!0,e.dataset.lexicalNodeKey=this.__key;const i=Fg("lexxy-node-delete-button");return e.appendChild(i),e}get isPreviewableAttachment(){return this.isPreviewableImage||this.previewable}get isPreviewableImage(){return Ig(this.contentType)}#be(e={}){const t=Fg("img",{src:this.src,draggable:!1,alt:this.altText,...this.#Se,...e});this.previewable&&!this.isPreviewableImage&&(t.onerror=()=>this.#ve(t));const n=Fg("div",{className:"attachment__container"});return n.appendChild(t),n}#ve(e){const t=e.closest("figure.attachment");if(!t)return;t.className=t.className.replace("attachment--preview","attachment--file");const n=t.querySelector(".attachment__container");n&&n.remove();const r=t.querySelector("figcaption");r&&r.remove(),t.appendChild(this.#xe()),t.appendChild(this.#Ce())}get#Se(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#xe(){return Fg("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#Ce(){const e=Fg("figcaption",{className:"attachment__caption"}),t=Fg("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=Fg("span",{className:"attachment__size",textContent:wf(this.fileSize)});e.appendChild(t)}return e}#_e(){const e=Fg("figcaption",{className:"attachment__caption"}),t=Fg("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",(e=>this.#we(e))),t.addEventListener("keydown",(e=>this.#ke(e))),t.addEventListener("copy",(e=>e.stopPropagation())),t.addEventListener("cut",(e=>e.stopPropagation())),t.addEventListener("paste",(e=>e.stopPropagation())),e.appendChild(t),e}#we(e){this.#Ee(e.target)}#Ee(e){e.placeholder=this.fileName,this.editor.update((()=>{this.getWritable().caption=e.value}))}#ke(e){"Enter"===e.key&&(e.preventDefault(),e.target.blur(),this.editor.update((()=>{this.selectNext(0,0)}),{tag:Br})),e.stopPropagation()}}function gm(...e){return new hm(...e)}function pm(e){return e instanceof hm}class fm{#X=[];constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#Te(),this.#Ne(),this.#Ae(),this.#Le()}set current(e){this.editor.update((()=>{this.#Oe()}))}get hasNodeSelection(){return this.editor.getEditorState().read((()=>{const e=zi();return null!==e&&ki(e)}))}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#Fe();if(!t)return;const n=this.#Re(t);n&&(e=this.#Ie(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{const e=Ss(),t=e.getLastDescendant();t&&gi(t)?t.selectEnd():e.selectEnd()}))}selectedNodeWithOffset(){const e=zi();if(!e)return{node:null,offset:0};if(vi(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=zi();e&&vi(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=zi();e&&vi(e)&&(e.anchor.set(t.anchor.key,t.anchor.offset,"text"),e.focus.set(t.focus.key,t.focus.offset,"text"))}))}getFormat(){const e=zi();if(!vi(e))return{};const t=e.anchor.getNode();if(!t.getParent())return{};const n=t.getTopLevelElementOrThrow(),r=Nf(t),i=this.#Pe(t);return{isBold:e.hasFormat("bold"),isItalic:e.hasFormat("italic"),isStrikethrough:e.hasFormat("strikethrough"),isUnderline:e.hasFormat("underline"),isHighlight:Mf(e),isInLink:null!==Ic(t,ld),isInQuote:nh(n),isInHeading:null!==i,isInCode:this.#Me(e,t),headingTag:i?.getTag()??null,isInList:null!==r,listType:r,isInTable:null!==ip(t)}}nearestNodeOfType(e){const t=zi()?.anchor?.getNode();return Ic(t,e)}get hasSelectedWordsInSingleLine(){const e=zi();if(!vi(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(Uu)}get isIndentedList(){const e=this.nearestNodeOfType(Zu);return e&&Lu(e)>1}get isInsideCodeBlock(){return null!==this.nearestNodeOfType(kh)}get isTableCellSelected(){const e=zi(),{anchor:t,focus:n}=e;return!(!vi(e)||t.key!==n.key)&&null!==this.nearestNodeOfType(Wg)}get isOnPreviewableImage(){const e=zi(),t=e?.getNodes().at(0);return pm(t)&&t.isPreviewableImage}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#De();return e?gi(e)?this.#Be(e,t):Eo(e)?this.#$e(e,t):this.#ze(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#De();if(!e)return null;if(gi(e)){if(t===e.getTextContentSize())return this.#He(e);if(this.#Ke(e)){const t=e.getTopLevelElement();return t?t.getNextSibling():null}return null}return Eo(e)?this.#$e(e,t):this.#ze(e)}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#De();return e?gi(e)?this.#Ue(e,t):Eo(e)?this.#We(e,t):this.#Ve(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#De();if(!e)return null;if(gi(e)){if(0===t)return this.#qe(e);if(this.#je(e)){const t=e.getTopLevelElement();return t?t.getPreviousSibling():null}return null}return Eo(e)?this.#We(e,t):this.#Ve(e)}dispose(){for(this.editorElement=null,this.editorContentElement=null,this.editor=null,this.previouslySelectedKeys=null;this.#X.length;){this.#X.pop()()}}#Me(e,t){return null!==Ic(t,kh)||!!e.hasFormat("code")&&(gi(t)&&t.hasFormat("code"))}#Le(){this.#X.push(this.editor.registerUpdateListener((({editorState:e,tags:t})=>{if(t.has("history-merge")||t.has("skip-dom-selection"))return;let n=!1;e.read((()=>{const e=zi();if(!vi(e)||!e.isCollapsed())return;if(!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#Me(e,t)||(n=!0)})),n&&setTimeout((()=>{this.editor.update((()=>{const e=zi();if(!vi(e)||!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#Me(e,t)||e.toggleFormat("code")}))}),0)})))}get#Ze(){if(this.currentlySelectedKeys)return this.currentlySelectedKeys;this.currentlySelectedKeys=new Set;const e=zi();if(e&&ki(e))for(const t of e.getNodes())this.currentlySelectedKeys.add(t.getKey());return this.currentlySelectedKeys}#Ne(){this.#X.push(wa(this.editor.registerCommand(kn,this.#Ge.bind(this),1),this.editor.registerCommand(vn,this.#Je.bind(this),1),this.editor.registerCommand(Tn,this.#Ye.bind(this),1),this.editor.registerCommand(Nn,this.#Xe.bind(this),1),this.editor.registerCommand(dn,this.#Qe.bind(this),1),this.editor.registerCommand(rn,(()=>{this.current=zi()}),1)))}#Te(){this.#X.push(this.editor.registerCommand(sn,(({target:e})=>{if(!dl(e))return!1;const t=_s(e);return Ao(t)&&this.#et(t)}),1));const e=()=>this.#tt(),t=this.editor.getRootElement();t.addEventListener("lexxy:internal:move-to-next-line",e),this.#X.push((()=>t.removeEventListener("lexxy:internal:move-to-next-line",e)))}#Ae(){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)}#Oe(){this.#nt(),this.#rt(),this.previouslySelectedKeys=this.#Ze,this.currentlySelectedKeys=null}#nt(){for(const e of this.previouslySelectedKeys)if(!this.#Ze.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#rt(){for(const e of this.#Ze)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#Ge(e){return!e?.shiftKey&&(this.hasNodeSelection?await this.#it((e=>e.selectPrevious())):this.#et(this.nodeBeforeCursor))}async#Je(e){return!e?.shiftKey&&(this.hasNodeSelection?await this.#it((e=>e.selectNext(0,0))):this.#et(this.nodeAfterCursor))}async#Ye(){return this.hasNodeSelection?await this.#it((e=>e.getTopLevelElement().selectPrevious())):this.#et(this.topLevelNodeBeforeCursor)}async#Xe(){return this.hasNodeSelection?await this.#it((e=>e.getTopLevelElement().selectNext(0,0))):this.#et(this.topLevelNodeAfterCursor)}async#it(e){await am(),this.hasNodeSelection&&this.editor.update((()=>{e(zi().getNodes()[0]),this.editor.focus()}))}async#tt(){this.editor.update((()=>{const e=this.#ot();e&&this.#st(e)}))}#ot(){const e=zi();return e?ki(e)?this.#lt(e):vi(e)?this.#at(e):null:null}#lt(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#at(e){return e.anchor.getNode().getTopLevelElement()}#Pe(e){const t=e.getTopLevelElementOrThrow();let n=ah(t)?t:null;if(!n){let t=e.getParent();for(;t;){if(ah(t)){n=t;break}t=t.getParent()}}return n}#st(e){const t=e.getNextSibling();t?t.selectStart():this.#ct()}#ct(){const e=Ss(),t=$o();e.append(t),t.selectStart()}#et(e){if(Ao(e)){const t=function(...e){const t=Bi();return e.forEach((e=>t.add(e.getKey()))),t}(e);return ws(t),t}return!1}#Qe(e){if(e&&this.#ut())return!0;const t=e?this.nodeBeforeCursor:this.nodeAfterCursor;if(!Ao(t))return!1;if(this.#dt(t))return!0;this.#ht();const n=this.#et(t);return Boolean(n)}#ut(){const e=zi();if(!vi(e)||!e.isCollapsed())return!1;const t=Ic(e.anchor.getNode(),Uu);if(!t)return!1;if(!function(e){const t=e.getChildren();for(const e of t){if(Ao(e))return!1;if(!Gr(e))if(gi(e)){if(""!==e.getTextContent().trim())return!1}else if(Eo(e)&&""!==e.getTextContent().trim())return!1}return!0}(t))return!1;const n=t.getNextSibling();if(!n)return!1;const r=t.getPreviousSibling();return r?r.selectEnd():n.selectStart(),t.remove(),!0}#dt(e){const t=zi()?.anchor?.getNode(),n=t&&Ic(t,Uu);if(!n)return!1;if(n.isParentOf(e))return!1;const r=Ic(n,Zu);if(!r)return!1;const i=$o();return n.getChildren().forEach((e=>i.append(e))),1===r.getChildrenSize()?(r.insertBefore(i),r.remove()):(r.insertBefore(i),n.remove()),i.selectStart(),!0}#ht(e=zi()?.anchor){const t=e?.getNode();Eo(t)&&t?.isEmpty()&&t.remove()}#Fe(){const e=zi();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#Re(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",nc()),e}#ft(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#Ie(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}#De(){const e=zi();if(!vi(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#Be(e,t){return t===e.getTextContentSize()?this.#He(e):null}#He(e){const t=e.getNextSibling();if(Ao(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getNextSibling():null}#$e(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#ze(e)}#Ue(e,t){return 0===t?this.#qe(e):null}#qe(e){const t=e.getPreviousSibling();if(Ao(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getPreviousSibling():null}#We(e,t){return t>0?e.getChildAtIndex(t-1):this.#Ve(e)}#ze(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#Ve(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}#je(e){return this.#_t(e,"first")}#Ke(e){return this.#_t(e,"last")}#_t(e,t){const n=e.getTopLevelElement();if(!n)return!1;const r=this.editor.getElementByKey(n.getKey());if(!r)return!1;const i=window.getSelection();if(!i?.rangeCount)return!1;const o=this.#Re(i.getRangeAt(0));if(!o||this.#gt(o))return!1;const s=this.#xt(r,t);if(!s||this.#gt(s))return!1;const l=s.height>0?.5*s.height:5;return Math.abs(o.top-s.top)<l}#xt(e,t){const n=document.createTreeWalker(e,4);let r;if("first"===t)r=n.nextNode();else for(;n.nextNode();)r=n.currentNode;if(!r||0===r.length)return null;const i=document.createRange();return"first"===t?(i.setStart(r,0),i.setEnd(r,1)):(i.setStart(r,r.length-1),i.setEnd(r,r.length)),i.getBoundingClientRect()}}function mm(e){return he.sanitize(e,{ALLOWED_TAGS:Qa.concat(Xa.global.get("attachmentTagName")),ALLOWED_ATTR:ec,ADD_URI_SAFE_ATTR:["caption","filename"],SAFE_FOR_XML:!1})}class ym{#J;#Ct;constructor(e){this.#J=e,this.#Ct=new Za(Xa.presets.get("default"),Xa.presets.get(e.preset),this.#St)}get(e){return this.#Ct.get(e)}get#St(){const e={};for(const t of this.#vt){const n=t.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`));this.#J.hasAttribute(n)&&(e[t]=this.#wt(n))}return e}get#vt(){return Object.keys(Xa.presets.get("default"))}#wt(e){const t=this.#J.getAttribute(e);try{return JSON.parse(t)}catch{return t}}}class bm extends hm{static getType(){return"action_text_attachment_upload"}static clone(e){return new bm({...e},e.__key)}static importJSON(e){return new bm({...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.#kt();this.#Et();const e=this.createAttachmentFigure();if(this.isPreviewableAttachment){const t=e.appendChild(this.#be());(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.#Tt(e)))}else e.appendChild(this.#xe());return e.appendChild(this.#Nt()),e.appendChild(this.#At()),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#Lt(){return null!==this.progress}#kt(){const e=this.createAttachmentFigure();return e.classList.add("attachment--error"),e.appendChild(Fg("div",{innerText:`Error uploading ${this.file?.name??"file"}`})),e}#be(){return Fg("img")}#xe(){return Fg("span",{className:"attachment__icon",textContent:this.#Ot()})}#Ot(){return this.file.name.split(".").pop().toLowerCase()}#Nt(){const e=Fg("figcaption",{className:"attachment__caption"}),t=Fg("span",{className:"attachment__name",textContent:this.caption||this.file.name||""}),n=Fg("span",{className:"attachment__size",textContent:wf(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#At(){return Fg("progress",{value:this.progress??0,max:100})}#Tt({width:e,height:t}){this.#Ft||this.editor.update((()=>{const n=this.getWritable();n.width=e,n.height=t}),{tag:this.#Rt})}get#Ft(){return Boolean(this.width&&this.height)}async#Et(){if(this.#Lt)return;this.#It();const{DirectUpload:e}=await import("@rails/activestorage"),t=new e(this.file,this.uploadUrl,this);t.delegate=this.#Pt(),this.#Mt("lexxy:upload-start",{file:this.file}),t.create(((e,t)=>{e?(this.#Mt("lexxy:upload-end",{file:this.file,error:e}),this.#Dt(e)):(this.#Mt("lexxy:upload-end",{file:this.file,error:null}),this.#Bt(t))}))}#Pt(){const e=Xa.global.get("authenticatedUploads");return{directUploadWillCreateBlobWithXHR:t=>{e&&(t.withCredentials=!0)},directUploadWillStoreFileWithXHR:t=>{e&&(t.withCredentials=!0);t.upload.addEventListener("progress",(e=>this.#$t(e)))}}}#It(){this.#zt(1)}#$t(e){const t=Math.round(e.loaded/e.total*100);this.#zt(t),this.#Mt("lexxy:upload-progress",{file:this.file,progress:t})}#zt(e){this.editor.update((()=>{this.getWritable().progress=e}),{tag:this.#Rt})}#Dt(e){console.warn(`Upload error for ${this.file?.name??"file"}: ${e}`),this.editor.update((()=>{this.getWritable().uploadError=!0}),{tag:this.#Rt})}#Bt(e){const t=this.#Ht;this.editor.update((()=>{const n=this.#Kt(e);this.replace(n),t&&tl(n.getParent())&&n.selectNext()}),{tag:this.#Rt})}get#Rt(){return this.#Ht?Ef:[...Ef,Kr]}get#Ht(){const e=this.editor.getRootElement();return null!==e&&e.contains(document.activeElement)}#Kt(e){return new _m(this,e).toAttachmentNode()}#Mt(e,t){const n=this.editor.getElementByKey(this.getKey());n&&Pg(n,e,t)}}class _m{constructor(e,t){this.uploadNode=e,this.blob=t}toAttachmentNode(){return new hm({...this.uploadNode,...this.#Ut,src:this.#Wt})}get#Ut(){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#Wt(){return this.blob.previewable?this.blob.url:this.#Vt}get#Vt(){return this.uploadNode.blobUrlTemplate.replace(":signed_id",this.blob.signed_id).replace(":filename",encodeURIComponent(this.blob.filename))}}function xm(...e){return new bm(...e)}class Cm 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=>this.#qt(e)?{conversion:()=>({node:Sm()}),priority:2}:null}}static canCollapseWith(e){return vm(e)||this.isValidChild(e)}static isValidChild(e){return pm(e)&&e.isPreviewableImage}static#qt(e){const t=e.querySelectorAll(`:scope > :is(${this.#jt.join()})`);return""===e.textContent.trim()&&t.length>0&&e.children.length===t.length}static get#jt(){return Object.keys(hm.importDOM())}createDOM(){const e=document.createElement("div");return e.className=this.#Zt,e}updateDOM(e,t){return t.className=this.#Zt,!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=$o();return this.insertAfter(e,!1),e.insertAfter(this.getLastChild(),!1),e.selectEnd(),null}const n=Sm();return this.insertAfter(n,t),n}getImageAttachments(){return this.getChildren().filter(pm)}exportDOM(){const e=document.createElement("div");return e.className=this.#Zt,{element:e}}collapseWith(e,t){return!!Cm.canCollapseWith(e)&&(t?$c(this,e):this.append(e),zc(this,Cm.isValidChild),!0)}unwrapEmptyNode(){if(this.isEmpty()){const e=$o();return this.replace(e)}}replaceWithSingularChild(){if(this.#Gt){const e=this.getFirstChild();return this.replace(e)}}splitAroundInvalidChild(){for(const e of Uc(this)){if(Cm.isValidChild(e))continue;const t=Tf(e),[n,r]=this.splitAtIndex(t.getIndexWithinParent());n.insertAfter(t),t.selectEnd(),r.isEmpty()&&r.remove();break}}splitAtIndex(e){return al(this,e)}get#Gt(){return 1===this.getChildrenSize()}get#Zt(){return`attachment-gallery attachment-gallery--${this.getChildrenSize()}`}}function Sm(){return new Cm}function vm(e){return e instanceof Cm}function wm(e){if(!Cm.canCollapseWith(e))return null;return Ic(e,Cm)??Mc(e,Sm)}class km{#Jt;static for(e,t){return new(Em.handle(e,t)?Em:km)(e,t)}constructor(e,t){this.#Jt=t,this.editorElement=e,this.contents=e.contents,this.selection=e.selection}get files(){return Array.from(this.#Jt)}$uploadFiles(){this.$createUploadNodes(),this.$insertUploadNodes()}$createUploadNodes(){this.nodes=this.files.map((e=>xm({...this.#Yt,file:e,contentType:e.type})))}$insertUploadNodes(){this.nodes.forEach(this.contents.insertAtCursor)}get#Yt(){return{uploadUrl:this.editorElement.directUploadUrl,blobUrlTemplate:this.editorElement.blobUrlTemplate}}}class Em extends km{#Xt;static handle(e,t){return this.#Qt(t)||this.#en(e.selection)}static#Qt(e){let t=0;for(const n of e)if(Ig(n.type)&&t++,t>1)return!0;return!1}static#en(e){if(e.isOnPreviewableImage)return!0;const{node:t}=e.selectedNodeWithOffset();return null!==Ic(t,Cm)}$insertUploadNodes(){this.#tn(),this.#nn(),this.#rn()}#tn(){this.selection.isOnPreviewableImage?this.#Xt=wm(this.#in):(this.#Xt=Sm(),this.contents.insertAtCursor(this.#Xt))}get#in(){const{node:e}=this.selection.selectedNodeWithOffset();return e}get#on(){const e=zi()?.anchor,t=e?.getNode().is(this.#Xt);if(t)return e.offset;const n=this.#in,r=this.#Xt.isParentOf(n)&&n.getIndexWithinParent();return!1!==r?r+1:0}get#sn(){return this.nodes.filter((e=>Cm.isValidChild(e)))}get#ln(){return this.nodes.filter((e=>!Cm.isValidChild(e)))}#nn(){this.#Xt.splice(this.#on,0,this.#sn)}#rn(){let e=this.#Xt;for(const t of this.#ln)e.insertAfter(t),e=t}}class Tm{constructor(e){this.editorElement=e,this.editor=e.editor}dispose(){this.editorElement=null,this.editor=null}insertHtml(e,{tag:t}={}){this.insertDOM(Rg(e),{tag:t})}insertDOM(e,{tag:t}={}){this.#an(e),t===$r&&this.#cn(e),this.editor.update((()=>{const t=zi();if(!vi(t))return;const n=bd(this.editor,e);this.#un(n)||t.insertNodes(n)}),{tag:t})}insertAtCursor(e){let t=zi()??Ss().selectEnd();const n=t?.getNodes();if(vi(t)){const n=t.anchor.getNode();if(Nm(n)){const e=$o();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.#dn(e)}applyParagraphFormat(){const e=zi();vi(e)&&Ba(e,(()=>$o()))}applyHeadingFormat(e){const t=zi();vi(t)&&Ba(t,(()=>lh(e)))}#hn(){const e=zi();vi(e)&&Ba(e,(()=>Eh("plain")))}toggleCodeBlock(){const e=zi();if(!vi(e))return;if(this.#gn(Eh("plain")))return;const t=e.anchor.getNode().getTopLevelElementOrThrow();t&&!Th(t)?this.#hn():this.applyParagraphFormat()}toggleBlockquote(){const e=zi();if(!vi(e))return;if(this.#gn(th()))return;const t=this.#pn(e);if(t.length>0&&t.every(nh))t.forEach((e=>this.#fn(e)));else{t.filter(nh).forEach((e=>this.#fn(e))),this.#mn(e);const n=this.#pn(e);if(0===n.length)return;const r=th();n[0].insertBefore(r),n.forEach((e=>r.append(e)))}}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=zi();e=vi(t)&&!t.isCollapsed()})),e}createLink(e){let t=null;return this.editor.update((()=>{const n=hi(e),r=cd(e);r.append(n);const i=zi();vi(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{fd(null),fd(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=zi();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=zi();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=zi(),{anchorNode:r,offset:i}=this.#yn();if(!r)return;const o=this.#bn(r,i,e);-1!==o&&this.#_n(r,n,i,o,t)}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.#xn.bind(this));this.editor.update((()=>{const e=km.for(this.editorElement,n);if(e.$uploadFiles(),t&&e.nodes?.length){e.nodes.at(-1).selectEnd(),this.#Cn()}}))}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=ms(e);if(!r)return;const i=zi();let o=!1;if(vi(i)){const e=i.getNodes();o=e.includes(r)||e.some((e=>e.getParent()===r)),o&&ws(null)}const s=n.attachment?this.#Sn(t,n.attachment):this.#vn(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.#Sn(t,n.attachment):this.#vn(t);i.insertAfter(o)}))}#gn(e){const t=zi();if(!vi(t))return!1;const n=t.anchor.getNode();return!!tl(n)&&(n.append(e),e.selectEnd(),!0)}#mn(e){const t=e.anchor.getNode().getKey(),n=e.focus.getNode().getKey(),r=this.#pn(e);for(const e of r){if(!zo(e))continue;const r=e.getChildren();if(!r.some(Gr))continue;if(!r.some((e=>e.getKey()===t||e.getKey()===n)))continue;const i=[[]];for(const e of r)Gr(e)?(i.push([]),e.remove()):i[i.length-1].push(e);for(const t of i){if(0===t.length)continue;const n=$o();t.forEach((e=>n.append(e))),e.insertBefore(n)}i.some((e=>e.length>0))&&e.remove()}}#pn(e){const t=new Set;for(const n of e.getNodes()){const e=n.getTopLevelElement();e&&t.add(e)}return Array.from(t)}#un(e){if(e.every(pm)){const t=km.for(this.editorElement,[]);return t.nodes=e,t.$insertUploadNodes(),!0}}#dn(e){this.editor.update((()=>{if(!e.getNextSibling()){const t=$o();e.insertAfter(t),t.selectStart()}}))}#fn(e){const t=e.getChildren();0==t.length?e.insertBefore($o()):t.forEach((t=>{if(gi(t)&&""!==t.getTextContent().trim()){const n=$o();n.append(t),e.insertBefore(n)}else Gr(t)||e.insertBefore(t)})),e.remove()}#an(e){for(const t of e.querySelectorAll("a")){const e=t.getAttribute("href")||"";""!==e&&"#"!==e||t.replaceWith(...t.childNodes)}}#cn(e){for(const t of e.querySelectorAll("td, th"))t.style.removeProperty("background-color"),t.style.removeProperty("background"),t.style.removeProperty("color")}#yn(){const e=zi();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}}#bn(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#_n(e,t,n,r,i){const o=e.getTextContent(),s=o.slice(0,r),l=o.slice(n),a=this.#wn(e,t,s),c=this.#wn(e,t,l||" ");e.replace(a);this.#kn(a,i).insertAfter(c),this.#En(c.getParentOrThrow());const u=l?0:1;c.select(u,u)}#wn(e,t,n){const r=e.getParent(),i=r?.getTextFormat?.()||0,o=r?.getTextStyle?.()||"",s=vi(t)&&t.format?t.format:e.getFormat()||i,l=vi(t)&&t.style?t.style:e.getStyle()||o;return hi(n).setFormat(s).setDetail(e.getDetail()).setMode(e.getMode()).setStyle(l)}#kn(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#En(e){if(zo(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())}}#Sn(e,t={}){return new kf({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#vn(e){return bd(this.editor,Rg(e))[0]||$o()}#xn(e){return Pg(this.editorElement,"lexxy:file-accept",{file:e},!0)}#Cn(){const e=zi();if(!vi(e))return;const t=e.anchor.getNode();if(!Nm(t))return;const n=$o();t.append(n),n.selectStart()}}function Nm(e){return Eo(e)&&tl(e)&&!Oo(e)}function Am(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Lm={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Om(e){Lm=e}var Fm={exec:()=>null};function Rm(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(Im.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Im={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")},Pm=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mm=/(?:[*+-]|\d{1,9}[.)])/,Dm=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Bm=Rm(Dm).replace(/bull/g,Mm).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(),$m=Rm(Dm).replace(/bull/g,Mm).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(),zm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Hm=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Km=Rm(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Hm).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Um=Rm(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Mm).getRegex(),Wm="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",Vm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qm=Rm("^ {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",Vm).replace("tag",Wm).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jm=Rm(zm).replace("hr",Pm).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",Wm).getRegex(),Zm={blockquote:Rm(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jm).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Km,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Pm,html:qm,lheading:Bm,list:Um,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:jm,table:Fm,text:/^[^\n]+/},Gm=Rm("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Pm).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",Wm).getRegex(),Jm={...Zm,lheading:$m,table:Gm,paragraph:Rm(zm).replace("hr",Pm).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Gm).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",Wm).getRegex()},Ym={...Zm,html:Rm("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Vm).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:Fm,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Rm(zm).replace("hr",Pm).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Bm).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xm=/^( {2,}|\\)\n(?!\s*$)/,Qm=/[\p{P}\p{S}]/u,ey=/[\s\p{P}\p{S}]/u,ty=/[^\s\p{P}\p{S}]/u,ny=Rm(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ey).getRegex(),ry=/(?!~)[\p{P}\p{S}]/u,iy=Rm(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),oy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,sy=Rm(oy,"u").replace(/punct/g,Qm).getRegex(),ly=Rm(oy,"u").replace(/punct/g,ry).getRegex(),ay="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",cy=Rm(ay,"gu").replace(/notPunctSpace/g,ty).replace(/punctSpace/g,ey).replace(/punct/g,Qm).getRegex(),uy=Rm(ay,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,ry).getRegex(),dy=Rm("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ty).replace(/punctSpace/g,ey).replace(/punct/g,Qm).getRegex(),hy=Rm(/\\(punct)/,"gu").replace(/punct/g,Qm).getRegex(),gy=Rm(/^<(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(),py=Rm(Vm).replace("(?:--\x3e|$)","--\x3e").getRegex(),fy=Rm("^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",py).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),my=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,yy=Rm(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",my).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),by=Rm(/^!?\[(label)\]\[(ref)\]/).replace("label",my).replace("ref",Hm).getRegex(),_y=Rm(/^!?\[(ref)\](?:\[\])?/).replace("ref",Hm).getRegex(),xy=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Cy={_backpedal:Fm,anyPunctuation:hy,autolink:gy,blockSkip:iy,br:Xm,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Fm,emStrongLDelim:sy,emStrongRDelimAst:cy,emStrongRDelimUnd:dy,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:yy,nolink:_y,punctuation:ny,reflink:by,reflinkSearch:Rm("reflink|nolink(?!\\()","g").replace("reflink",by).replace("nolink",_y).getRegex(),tag:fy,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Fm},Sy={...Cy,link:Rm(/^!?\[(label)\]\((.*?)\)/).replace("label",my).getRegex(),reflink:Rm(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",my).getRegex()},vy={...Cy,emStrongRDelimAst:uy,emStrongLDelim:ly,url:Rm(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",xy).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:Rm(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",xy).getRegex()},wy={...vy,br:Rm(Xm).replace("{2,}","*").getRegex(),text:Rm(vy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ky={normal:Zm,gfm:Jm,pedantic:Ym},Ey={normal:Cy,gfm:vy,breaks:wy,pedantic:Sy},Ty={"&":"&","<":"<",">":">",'"':""","'":"'"},Ny=e=>Ty[e];function Ay(e,t){if(t){if(Im.escapeTest.test(e))return e.replace(Im.escapeReplace,Ny)}else if(Im.escapeTestNoEncode.test(e))return e.replace(Im.escapeReplaceNoEncode,Ny);return e}function Ly(e){try{e=encodeURI(e).replace(Im.percentDecode,"%")}catch{return null}return e}function Oy(e,t){let n=e.replace(Im.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(Im.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(Im.slashPipe,"|");return r}function Fy(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 Ry(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 Iy=class{options;rules;lexer;constructor(e){this.options=e||Lm}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:Fy(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=Fy(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:Fy(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Fy(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=Oy(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(Oy(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=Fy(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)),Ry(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 Ry(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}}}},Py=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Lm,this.options.tokenizer=this.options.tokenizer||new Iy,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:Im,block:ky.normal,inline:Ey.normal};this.options.pedantic?(t.block=ky.pedantic,t.inline=Ey.pedantic):this.options.gfm&&(t.block=ky.gfm,this.options.breaks?t.inline=Ey.breaks:t.inline=Ey.gfm),this.tokenizer.rules=t}static get rules(){return{block:ky,inline:Ey}}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(Im.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(Im.tabCharGlobal," ").replace(Im.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}},My=class{options;parser;constructor(e){this.options=e||Lm}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Im.notSpaceStart)?.[0],i=e.replace(Im.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Ay(r)+'">'+(n?i:Ay(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:Ay(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+" "+Ay(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>${Ay(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=Ly(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+Ay(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=Ly(e);if(null===i)return Ay(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${Ay(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ay(e.text)}},Dy=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""}},By=class e{options;renderer;textRenderer;constructor(e){this.options=e||Lm,this.options.renderer=this.options.renderer||new My,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Dy}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}},$y=class{options;block;constructor(e){this.options=e||Lm}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?Py.lex:Py.lexInline}provideParser(){return this.block?By.parse:By.parseInline}},zy=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=By;Renderer=My;TextRenderer=Dy;Lexer=Py;Tokenizer=Iy;Hooks=$y;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 My(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 Iy(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 $y;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];$y.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&$y.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 Py.lex(e,t??this.defaults)}parser(e,t){return By.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?Py.lex:Py.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?By.parse:By.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?Py.lex:Py.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?By.parse:By.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>"+Ay(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Hy(e,t){return zy.parse(e,t)}Hy.options=Hy.setOptions=function(e){return zy.setOptions(e),Hy.defaults=zy.defaults,Om(Hy.defaults),Hy},Hy.getDefaults=Am,Hy.defaults=Lm,Hy.use=function(...e){return zy.use(...e),Hy.defaults=zy.defaults,Om(Hy.defaults),Hy},Hy.walkTokens=function(e,t){return zy.walkTokens(e,t)},Hy.parseInline=zy.parseInline,Hy.Parser=By,Hy.parser=By.parse,Hy.Renderer=My,Hy.TextRenderer=Dy,Hy.Lexer=Py,Hy.lexer=Py.lex,Hy.Tokenizer=Iy,Hy.Hooks=$y,Hy.parse=Hy,Hy.options,Hy.setOptions,Hy.use,Hy.walkTokens,Hy.parseInline,By.parse,Py.lex;class Ky{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;if(!t||this.#Tn())return!1;if(this.#Nn(t))return this.#An(t),e.preventDefault(),!0;const n=this.#Ln(t);return n&&e.preventDefault(),n}#Nn(e){return this.#On(e)||this.#Fn(e)}#On(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#Fn(e){const t=Array.from(e.types);return 2===t.length&&t.includes("text/uri-list")&&t.includes("text/plain")}#Tn(){let e=!1;return this.editor.getEditorState().read((()=>{const t=zi();if(!vi(t))return;let n=t.anchor.getNode();for(;n;){if(Th(n))return void(e=!0);n=n.getParent()}})),e}#An(e){e.items[0].getAsString((t=>{if(cm(t)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(t);else if(cm(t)){const e=this.contents.createLink(t);this.#Rn(e,{url:t})}else this.editorElement.supportsMarkdown?this.#In(t):this.#Pn(e)}))}#Rn(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};Pg(this.editorElement,"lexxy:insert-link",{...t,...n})}#In(e){const t=Rg(Hy(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)});Pg(this.editorElement,"lexxy:insert-markdown",n),this.contents.insertDOM(t,{tag:$r})}#Pn(e){this.editor.update((()=>{const t=zi();Ed(e,t,this.editor)}),{tag:$r})}#Ln(e){if(!this.editorElement.supportsAttachments)return!1;const t=e.getData("text/html"),n=e.files;return n.length&&this.#Mn(t)?(this.#Dn(n),!0):t&&!this.#Bn(e)?(this.contents.insertHtml(t,{tag:$r}),!0):!!n.length&&(this.#Dn(n),!0)}#Bn(e){return Array.from(e.types).includes("application/x-lexical-editor")}#Mn(e){if(!e)return!1;const t=Rg(e),n=Array.from(t.body.children);return 1===n.length&&"IMG"===n[0].tagName}#Dn(e){this.#$n((()=>{e.length&&this.contents.uploadFiles(e,{selectLast:!0})}))}async#$n(e){const t=window.scrollY,n=window.scrollX;e(),await am(),window.scrollTo(n,t),this.editor.focus()}}class Uy{constructor(e){this.lexxyElement=e,this.enabledExtensions=this.#zn()}get lexicalExtensions(){return this.enabledExtensions.map((e=>e.lexicalExtension)).filter(Boolean)}initializeToolbars(){this.#Hn&&this.enabledExtensions.forEach((e=>e.initializeToolbar(this.#Hn)))}get#Hn(){return this.lexxyElement.toolbar}get#Kn(){return this.lexxyElement.baseExtensions}get#Un(){return Xa.global.get("extensions")}#zn(){return this.#Kn.concat(this.#Un).map((e=>new e(this.lexxyElement))).filter((e=>e.enabled))}}function Wy(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")&&!Vy(n,"strong")&&(r=qy(r,"b")),t.hasFormat("italic")&&!Vy(n,"em")&&(r=qy(r,"i")),t.hasFormat("strikethrough")&&(r=qy(r,"s")),t.hasFormat("underline")&&(r=qy(r,"u")),{element:r}}function Vy(e,t){const n=t.toUpperCase();return e.tagName===n||null!==e.querySelector(t)}function qy(e,t){const n=document.createElement(t);return n.appendChild(e),n}class jy 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!Gy(e,"next")&&!Gy(t,"previous")}createDOM(e){const t=super.createDOM(e),n=this.isSelected(zi());return t.classList.add("provisional-paragraph"),t.classList.toggle("hidden",!n),t}updateDOM(e,t){const n=this.isSelected(zi());return t.classList.toggle("hidden",!n),!1}getTextContent(){return""}exportDOM(){return{element:null}}isSelected(e=null){const t=e||zi();if(!t)return!1;if(t.getNodes().some((e=>e.is(this)||this.isParentOf(e))))return!0;if(vi(t)&&t.isCollapsed()){const{anchor:e}=t,n=this.getParent();if(n&&e.getNode().is(n)&&"element"===e.type){const t=this.getIndexWithinParent();return e.offset===t||e.offset===t+1}}return!1}removeUnlessRequired(e=this.getLatest()){e.required||e.remove()}concretizeIfEdited(e=this.getLatest()){e.getTextContentSize()>0&&e.replace($o(),!0)}get required(){return this.isDirectRootChild&&jy.neededBetween(...this.immediateSiblings)}get isDirectRootChild(){return tl(this.getParent())}get immediateSiblings(){return[this.getPreviousSibling(),this.getNextSibling()]}}function Zy(e){return e instanceof jy}function Gy(e,t){return Eo(e)&&("next"===t?e.canInsertTextBefore():e.canInsertTextAfter())}class Jy extends zf{get lexicalExtension(){return{name:"lexxy/provisional-paragraph",nodes:[jy],register:e=>wa(e.registerNodeTransform(Lo,Yy),e.registerNodeTransform(Lo,Xy),e.registerCommand(rn,Qy,3))}}}function Yy(e){const t=e.getFirstChild();jy.neededBetween(null,t)&&$c(e,new jy);for(const t of Uc(e)){const e=t.getNextSibling();jy.neededBetween(t,e)&&t.insertAfter(new jy)}}function Xy(e){for(const t of eb(e))t.removeUnlessRequired()}function Qy(){for(const e of eb())e.markDirty()}function eb(e=Ss()){return Kc(e.getChildren(),Zy)}const tb="language";class nb extends zf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/trix-content",html:{import:{em:e=>rb(e,{conversion:Lf("i",jf),priority:1}),span:e=>rb(e,{conversion:Lf("mark",jf),priority:1}),strong:e=>rb(e,{conversion:Lf("b",jf),priority:1}),del:()=>({conversion:Lf("s",ib,jf),priority:1}),pre:e=>function(e,t){return e.hasAttribute(tb)?t:null}(e,{conversion:Of(kh,"pre",ob),priority:1})}}}}}function rb(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function ib(e){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),e}function ob(e,t){const n=Wh(t.getAttribute(tb));e.node.setLanguage(n)}class sb extends df{$config(){return this.config("wrapped_table_node",{extends:df})}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 Fg("figure",{className:"lexxy-content__table-wrapper"},(e=t.after(e)).cloneNode(!0).outerHTML)}return e}}}}class lb extends zf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/tables",nodes:[sb,{replace:df,with:()=>new sb,withKlass:sb},Wg,Yg],register:e=>(function(e){cf.add(e)}(e),wa(Cf(e),function(e,t=!0){const n=new Map,r=(r,i,o)=>{const s=Op(r,o),l=Dp(r,s,e,t);n.set(i,[l,s])},i=e.registerMutationListener(df,(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}=Tp(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),e.registerNodeTransform(Wg,(e=>{null===e.getBackgroundColor()&&e.setBackgroundColor("")})),e.registerNodeTransform(Wg,(e=>{const t=e.getHeaderStyles();if(t!==Ug)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()!==Kg)),l=i.every((e=>{const t=e.getChildren()[o];return t&&t.getHeaderStyles()!==Kg}));let a=Kg;s&&(a|=Ug),l&&(a|=Hg),a!==t&&e.setHeaderStyles(a,zg)})),e.registerCommand("insertTableRowAfter",(()=>{ap(!0)}),2),e.registerCommand("insertTableRowBefore",(()=>{ap(!1)}),2),e.registerCommand("insertTableColumnAfter",(()=>{up(!0)}),2),e.registerCommand("insertTableColumnBefore",(()=>{up(!1)}),2),e.registerCommand("deleteTableRow",(()=>{!function(){const e=zi();vi(e)||wp(e)||Jg(188);const[t,n]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[r,,i]=_p(t),[o]=_p(n),[s,l,a]=yp(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&&Jg(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?gp(p,n):r.insertAfter(n)}}}const t=i.getChildAtIndex(e);ep(t)||Jg(206,String(e)),t.remove()}if(void 0!==g){const{cell:e}=g[0];hp(e)}else{const e=s[c-1],{cell:t}=e[0];hp(t)}}()}),2),e.registerCommand("deleteTableColumn",(()=>{!function(){const e=zi();vi(e)||wp(e)||Jg(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[r,,i]=_p(t),[o]=_p(n),[s,l,a]=yp(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;hp(e)}else{const e=d<c?m[d-1]:m[c-1],{cell:t}=e;hp(t)}const b=i.getColWidths();if(b){const e=[...b];e.splice(h,p),i.setColWidths(e)}}()}),2),e.registerCommand("deleteTable",(()=>{const e=zi();if(!vi(e))return!1;ef(e.anchor.getNode())?.remove()}),2)))}}}class ab{#Wn;#Vn=null;#qn=null;#jn=null;#Zn=[];constructor(e){this.#Wn=e,this.#Zn.push(e.registerCommand(zn,(e=>this.#Gn(e)),3),e.registerCommand(Bn,(e=>this.#ue(e)),3));const t=e.registerRootListener(((e,t)=>{t&&(t.removeEventListener("dragover",this.#Jn),t.removeEventListener("dragend",this.#Yn)),e&&(e.addEventListener("dragover",this.#Jn),e.addEventListener("dragend",this.#Yn))}));this.#Zn.push(t)}destroy(){this.#Xn();for(const e of this.#Zn)e();this.#Zn=[]}#Gn(e){if(e.target.closest("textarea"))return!1;const t=e.target.closest("figure.attachment[data-lexical-node-key]");return!!t&&(this.#Vn=t.dataset.lexicalNodeKey,e.dataTransfer.setData("application/x-lexxy-node-key",this.#Vn),e.dataTransfer.effectAllowed="move",this.#jn=requestAnimationFrame((()=>{this.#jn=null,t.classList.add("lexxy-dragging")})),!0)}#Jn=e=>{this.#Vn&&(e.preventDefault(),e.dataTransfer.dropEffect="move",this.#qn||(this.#qn=requestAnimationFrame((()=>{this.#qn=null,this.#Qn(e)}))))};#ue(e){if(!this.#Vn)return!1;e.preventDefault();const t=this.#er(e),n=this.#Vn;return this.#Xn(),t&&this.#tr(n,t),!0}#Yn=()=>{this.#Xn()};#Qn(e){this.#nr();const t=this.#er(e);t&&("gallery"===t.type||"gallery-reorder"===t.type?t.element.classList.add(`lexxy-drop-target--gallery-${t.position}`):"list-item"===t.type?t.element.classList.add(`lexxy-drop-target--list-${t.position}`):t.element.classList.add(`lexxy-drop-target--block-${t.position}`))}#er(e){const t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return null;const n=this.#Wn.getRootElement();if(!n||!n.contains(t))return null;const r=t.closest("figure.attachment--preview[data-lexical-node-key]");if(r&&r.dataset.lexicalNodeKey!==this.#Vn){const t=r.closest(".attachment-gallery");if(t){const i=n.querySelector(`[data-lexical-node-key="${this.#Vn}"]`);if(i&&t.contains(i)){const t=this.#rr(r,e.clientX);return{type:"gallery-reorder",element:r,nodeKey:r.dataset.lexicalNodeKey,position:t}}}const i=this.#rr(r,e.clientX);return{type:"gallery",element:r,nodeKey:r.dataset.lexicalNodeKey,position:i}}if(r&&r.closest(".attachment-gallery"))return null;const i=t.closest(".attachment-gallery");if(i){let n=t.closest("figure.attachment[data-lexical-node-key]");if(n||(n=this.#ir(i,e.clientX)),n&&n.dataset.lexicalNodeKey!==this.#Vn){const t=this.#rr(n,e.clientX);return{type:"gallery-reorder",element:n,nodeKey:n.dataset.lexicalNodeKey,position:t}}if(n)return null}const o=t.closest("li");if(o&&n.contains(o)){return{type:"list-item",element:o,position:this.#or(o,e.clientY)}}const s=this.#sr(t,n,e.clientY);if(!s)return null;const l=this.#or(s,e.clientY);return"before"===l&&s.previousElementSibling?{type:"block",element:s.previousElementSibling,position:"after"}:{type:"block",element:s,position:l}}#sr(e,t,n){let r=e;for(;r&&r!==t;){if(r.parentElement===t)return r;r=r.parentElement}let i=null,o=1/0;for(const e of t.children){const t=e.getBoundingClientRect(),r=Math.min(Math.abs(n-t.top),Math.abs(n-t.bottom));r<o&&(o=r,i=e)}return i}#or(e,t){const n=e.getBoundingClientRect();return t<n.top+n.height/2?"before":"after"}#rr(e,t){const n=e.getBoundingClientRect();return t<n.left+n.width/2?"before":"after"}#ir(e,t){const n=e.querySelectorAll("figure.attachment[data-lexical-node-key]");let r=null,i=1/0;for(const e of n){const n=e.getBoundingClientRect(),o=n.left+n.width/2,s=Math.abs(t-o);s<i&&(i=s,r=e)}return r}static#lr=["lexxy-drop-target--gallery-before","lexxy-drop-target--gallery-after","lexxy-drop-target--list-before","lexxy-drop-target--list-after","lexxy-drop-target--block-before","lexxy-drop-target--block-after"];#nr(){const e=this.#Wn.getRootElement();if(e)for(const t of e.querySelectorAll("[class*='lexxy-drop-target--']"))t.classList.remove(...ab.#lr)}#tr(e,t){const n=ms(e);n&&pm(n)&&("gallery"===t.type?this.#ar(n,t.nodeKey,t.position):"gallery-reorder"===t.type?this.#cr(n,t.nodeKey,t.position):"list-item"===t.type?this.#ur(n,t):this.#dr(n,t),ws(null))}#ar(e,t,n){const r=ms(t);if(!r||!pm(r))return;if(e.is(r))return;e.remove();wm(r)&&("before"===n?r.insertBefore(e):r.insertAfter(e))}#cr(e,t,n){const r=ms(t);r&&!e.is(r)&&(e.remove(),"before"===n?r.insertBefore(e):r.insertAfter(e))}#ur(e,t){const n=_s(t.element);if(!n||!ju(n))return;const r=n.getParent();if(!r||!ed(r))return;const i=r.getChildren(),o=i.indexOf(n);if(-1===o)return;const s="before"===t.position?o:o+1;if(e.remove(),0===s)r.insertBefore(e);else if(s>=i.length)r.insertAfter(e);else{const[,t]=al(r,s);t.insertBefore(e)}}#dr(e,t){const n=_s(t.element);if(!n)return;const r=n.getTopLevelElement?.()||n;e.is(r)||(e.remove(),"before"===t.position?r.insertBefore(e):r.insertAfter(e))}#Xn(){if(this.#nr(),this.#Vn){const e=this.#Wn.getRootElement();if(e){const t=e.querySelector(`[data-lexical-node-key="${this.#Vn}"]`);t?.classList.remove("lexxy-dragging")}}this.#Vn=null,this.#qn&&(cancelAnimationFrame(this.#qn),this.#qn=null),this.#jn&&(cancelAnimationFrame(this.#jn),this.#jn=null)}}class cb extends zf{get enabled(){return this.editorElement.supportsAttachments}get lexicalExtension(){return{name:"lexxy/action-text-attachments",nodes:[hm,bm,Cm],register(e){const t=new ab(e);return wa(e.registerNodeTransform(hm,ub),e.registerCommand(dn,db,2),(()=>t.destroy()))}}}}function ub(e){const t=e.getParent();if(zo(t))if(1===t.getChildrenSize())t.replace(e);else{const n=e.getIndexWithinParent(),[r,i]=al(t,n);r.insertAfter(e);for(const e of[r,i])e.isEmpty()&&e.remove()}}function db(e){const t=zi()?.anchor;return!!t&&(!!function(e,t){const n=e.getNode();if(!vm(n))return!1;const r=Af(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=zo(t)&&t.isEmpty(),r=wm(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(!vm(e.getNode())||!Af(e,!0)||!t)return!1;if(Ao(t))return!1;t.isEmpty()?t.remove():t.selectEnd();return!0}(t)))}class hb extends kh{$config(){return this.config("early_escape_code",{extends:kh})}static $fromSelection(e){const t=e.anchor.getNode();return Ic(t,hb)||(t instanceof hb?t:null)}insertNewAfter(e,t){if(!e.isCollapsed())return super.insertNewAfter(e,t);if(this.#hr(e)){If(this);const e=$o();return this.insertAfter(e),e}return super.insertNewAfter(e,t)}#hr(e){if(!Ff(e))return!1;const t=this.getTextContent();return""===t||t.endsWith("\n")}}class gb extends Uu{$config(){return this.config("early_escape_listitem",{extends:Uu})}insertNewAfter(e,t){return this.#gr(e)?this.#pr():super.insertNewAfter(e,t)}#gr(e){if(!Ic(this,eh))return!1;if(Rf(this))return!0;const t=Ic(e.anchor.getNode(),Do);return t&&Rf(t)&&ju(t.getParent())}#pr(){const e=this.getParent();if(!e||!ed(e))return;const t=e.getParent();if(t&&nh(t)){if(this.getNextSiblings().some((e=>ju(e)&&!Rf(e))))return this.#fr()}const n=$o();return e.insertAfter(n),this.remove(),n}#fr(){const e=al(this.getParent(),this.getIndexWithinParent());this.remove();const t=$o();return e[0].insertAfter(t),e.forEach(If),t}}class pb extends zf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/format-escape",nodes:[hb,{replace:kh,with:e=>new hb(e.getLanguage()),withKlass:hb},gb,{replace:Uu,with:()=>new gb,withKlass:gb}],register:e=>wa(e.registerCommand(gn,(()=>function(){const e=Ic(zi().anchor.getNode(),Do);if(!e||!Rf(e))return!1;const t=e.getParent();if(!t||!nh(t))return!1;e.getNextSiblings().filter((e=>!Rf(e))).length>0?function(e,t){const n=al(e,t.getIndexWithinParent());n[0].insertAfter(t),n.forEach(If),t.selectEnd()}(t,e):(t.insertAfter(e),e.selectStart());return!0}()),3),e.registerCommand(Nn,(e=>function(e){const t=zi();if(!vi(t)||!t.isCollapsed())return!1;const n=hb.$fromSelection(t);if(!n)return!1;if(Ff(t)&&!n.getNextSibling()){e?.preventDefault();const t=$o();return n.insertAfter(t),t.selectEnd(),!0}return!1}(e)),2))}}}class fb extends HTMLElement{static formAssociated=!0;static debug=!1;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#mr="";#yr=document.createElement("textarea");#br=[];constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Mg("lexxy-editor"),this.config=new ym(this),this.extensions=new Uy(this),this.editor=this.#_r(),this.#br.push(this.editor),this.contents=new Tm(this),this.#br.push(this.contents),this.selection=new fm(this),this.#br.push(this.selection),this.clipboard=new Ky(this);const e=lm.configureFor(this);this.#br.push(e),this.#xr(),requestAnimationFrame((()=>Pg(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.#Cr(),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#Sr()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#m())),"required"===e&&this.isConnected&&(this.#yr.required=this.hasAttribute("required"),this.#vr())}formResetCallback(){this.value=this.#mr,this.editor.dispatchCommand(jn,void 0)}toString(){return null==this.cachedStringValue&&this.editor?.getEditorState().read((()=>{this.cachedStringValue=mb(Ss())})),this.cachedStringValue}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get toolbarElement(){return this.#wr?(this.toolbar??=this.#kr(),this.toolbar):null}get baseExtensions(){return[Jy,qf,nb,lb,cb,pb]}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.#Er()))}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=mm(_d(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{Gs(Kr);const t=Ss();t.clear(),t.append(...this.#Tr(e)),t.selectEnd(),this.#Nr(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#Tr(e){e||(e="<p></p>");return bd(this.editor,Rg(`${e}`)).filter(this.#Ar).map(this.#Lr)}#Ar(e){return!Gr(e)&&(!gi(e)||""!==e.getTextContent().trim())}#Lr(e){if(!gi(e))return e;const t=$o();return t.append(e),t}#xr(){this.#Or(),this.#Fr(),this.#Rr(),this.#Ir(),this.#Pr(),this.#Mr(),this.#Dr(),this.#Br()}#_r(){this.editorContentElement||=this.#$r(),this.appendChild(this.editorContentElement);const e=function(...e){return Nu.fromExtensions(e).buildEditor()}({name:"lexxy/core",namespace:"Lexxy",theme:Og,nodes:this.#zr,html:{export:new Map([[ri,Wy]])}},...this.extensions.lexicalExtensions);return e.setRootElement(this.editorContentElement),e}get#zr(){const e=[kf];return this.supportsRichText&&e.push(eh,rh,Zu,Uu,kh,Ih,ld,dd,Bg),e}#$r(){const e=Fg("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#Hr,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#Kr.forEach((t=>e.setAttribute(t.name,t.value))),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#Hr(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#Kr(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#Ur(e){const t=void 0!==this.#Ur&&this.#Ur!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#yr.value=this.isEmpty?"":e,t&&Pg(this,"lexxy:change")}get#Ur(){return this._internalFormValue}#Dr(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"<p></p>";this.value=this.#mr=e}#Br(){document.addEventListener("turbo:before-cache",this.#Wr)}#Wr=e=>{this.#Sr()};#Or(){this.#Vr(this.editor.registerUpdateListener((({editorState:e})=>{this.#qr(),this.#Ur=this.value,this.#Nr(),this.#vr()})))}#qr(){this.cachedValue=null,this.cachedStringValue=null}#Vr(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#jr(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#Fr(){const e=[];this.supportsRichText?(e.push(hh(this.editor),od(this.editor)),this.#Zr(),this.#Gr(),this.supportsMarkdown&&e.push(wg(this.editor,xg),function(e,t){const n=t.filter((e=>"text-format"===e.type)).sort(((e,t)=>t.tag.length-e.tag.length));return 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(zi),l=o.read(zi);if(!vi(l)||!vi(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&&!kg.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&&!kg.test(e))continue}e.update((()=>{const e=ms(a);if(!e||!gi(e))return;const n=e.getParent();null===n||Th(n)||Eg(e,i,t)}));break}}}))}(this.editor,xg))):e.push(function(e){return wa(e.registerCommand(dn,(e=>{const t=zi();return!!vi(t)&&(t.deleteCharacter(e),!0)}),0),e.registerCommand(yn,(e=>{const t=zi();return!!vi(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(bn,(e=>{const t=zi();return!!vi(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(pn,(e=>{const t=zi();if(!vi(t))return!1;if("string"==typeof e)t.insertText(e);else{const n=e.dataTransfer;if(null!=n)kd(n,t);else{const n=e.data;n&&t.insertText(n)}}return!0}),0),e.registerCommand(mn,(()=>{const e=zi();return!!vi(e)&&(e.removeText(),!0)}),0),e.registerCommand(hn,(e=>{const t=zi();return!!vi(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(gn,(()=>{const e=zi();return!!vi(e)&&(e.insertLineBreak(),!0)}),0),e.registerCommand(kn,(e=>{const t=zi();if(!vi(t))return!1;const n=e,r=n.shiftKey;return!!Ha(t,!0)&&(n.preventDefault(),Ua(t,r,!0),!0)}),0),e.registerCommand(vn,(e=>{const t=zi();if(!vi(t))return!1;const n=e,r=n.shiftKey;return!!Ha(t,!1)&&(n.preventDefault(),Ua(t,r,!1),!0)}),0),e.registerCommand(On,(t=>!!vi(zi())&&(!zd||"ko-KR"!==navigator.language)&&(t.preventDefault(),e.dispatchCommand(dn,!0))),0),e.registerCommand(Rn,(t=>!!vi(zi())&&(t.preventDefault(),e.dispatchCommand(dn,!1))),0),e.registerCommand(An,(t=>{if(!vi(zi()))return!1;if(null!==t){if((zd||$d||Kd)&&Bd)return!1;t.preventDefault()}return e.dispatchCommand(hn,!1)}),0),e.registerCommand(Vn,(()=>($s(),!0)),0),e.registerCommand(Un,(t=>!!vi(zi())&&(Ud(t,e),!0)),0),e.registerCommand(Wn,(t=>!!vi(zi())&&(function(e,t){Ud(e,t),t.update((()=>{const e=zi();vi(e)&&e.removeText()}))}(t,e),!0)),0),e.registerCommand(fn,(t=>!!vi(zi())&&(function(e,t){e.preventDefault(),t.update((()=>{const t=zi(),n=Dc(e,ClipboardEvent)?e.clipboardData:null;null!=n&&vi(t)&&kd(n,t)}),{tag:$r})}(t,e),!0)),0),e.registerCommand(Bn,(e=>!!vi(zi())&&(e.preventDefault(),!0)),0),e.registerCommand(zn,(e=>!!vi(zi())&&(e.preventDefault(),!0)),0))}(this.editor)),this.historyState={current:null,redoStack:[],undoStack:[]},e.push(Ag(this.editor,this.historyState,20)),this.#Vr(wa(...e))}#Zr(){let e=this.querySelector("lexxy-table-tools");e??=Fg("lexxy-table-tools"),this.append(e),this.#br.push(e)}#Gr(){!function(e,t){if(!e.hasNodes([kh,Ih]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=Zh);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(kh,(t=>{e.getEditorState().read((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=ms(n);null!==t&&Jh(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(kh,(n=>Xh(n,e,t))),e.registerNodeTransform(ri,(n=>Gh(n,e,t))),e.registerNodeTransform(Ih,(n=>Gh(n,e,t))),e.registerCommand(In,(t=>{const n=function(e){const t=zi();if(!vi(t)||!eg(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=tg(t);if(1!==s.length)return n;const l=s[0];let a,c;0===l.length&&xh(285),t.isBackward()?(a=o,c=i):(a=i,c=o);const u=$h(l[0]),d=zh(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,(()=>!!eg(zi())&&(Gi([mi()]),!0)),1),e.registerCommand(Mn,(e=>ng(Mn)),1),e.registerCommand(Dn,(e=>ng(Dn)),1),e.registerCommand(Tn,(e=>{const t=zi();if(!vi(t)||!eg(t))return!1;const n=Ss().getFirstDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&rg(Tn,e)}),1),e.registerCommand(Nn,(e=>{const t=zi();if(!vi(t)||!eg(t))return!1;const n=Ss().getLastDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&rg(Nn,e)}),1),e.registerCommand(En,(e=>ig(En,e)),1),e.registerCommand(wn,(e=>ig(wn,e)),1)),wa(...n)}(this.editor);let e=this.querySelector("lexxy-code-language-picker");e??=Fg("lexxy-code-language-picker"),this.append(e),this.#br.push(e)}#Rr(){this.#Vr(this.editor.registerCommand(An,(e=>(e.ctrlKey||e.metaKey||!this.supportsMultiLine)&&(e.preventDefault(),!0)),2))}#Ir(){this.addEventListener("focusin",this.#Jr),this.addEventListener("focusout",this.#Yr),this.#Vr((()=>{this.removeEventListener("focusin",this.#Jr),this.removeEventListener("focusout",this.#Yr)}))}#Jr(e){this.#Xr(e.target)&&!this.currentlyFocused&&(Pg(this,"lexxy:focus"),this.currentlyFocused=!0)}#Yr(e){this.#Xr(e.relatedTarget)||(Pg(this,"lexxy:blur"),this.currentlyFocused=!1)}#Xr(e){return this.contains(e)||this.toolbarElement?.contains(e)}#Er(){this.isEmpty&&this.selection.placeCursorAtTheEnd()}#Cr(){document.querySelector(":focus")||this.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===this&&this.focus()}#Pr(){}#Mr(){this.#wr&&(this.toolbarElement.setEditor(this),"function"==typeof this.toolbarElement.dispose&&this.#br.push(this.toolbarElement),this.extensions.initializeToolbars())}#kr(){const e=this.config.get("toolbar");return"string"==typeof e?document.getElementById(e):this.querySelector("lexxy-toolbar")??this.#Qr()}get#wr(){return this.supportsRichText&&!!this.config.get("toolbar")}#Qr(){const e=Fg("lexxy-toolbar");return e.innerHTML=Nc.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),e.configure(this.config.get("toolbar")),this.prepend(e),e}#Nr(){this.classList.toggle("lexxy-editor--empty",this.isEmpty)}#vr(){this.#yr.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#yr.validity,this.#yr.validationMessage,this.editorContentElement)}#Sr(){this.#ei(),this.editorContentElement?.remove(),this.editorContentElement=null,this.toolbar=null}#ei(){for(this.#jr(),document.removeEventListener("turbo:before-cache",this.#Wr);this.#br.length;)this.#br.pop().dispose()}#m(){this.disconnectedCallback(),this.valueBeforeDisconnect=null,this.connectedCallback()}}function mb(e){if(e instanceof kf)return e.getReadableTextContent();if(Eo(e)){let t="";const n=e.getChildren();for(let e=0;e<n.length;e++){const r=n[e];Pf(r,n[e-1],e,n.length)||(t+=mb(r),Eo(r)&&e!==n.length-1&&!r.isInline()&&(t+="\n\n"))}return t}return e.getTextContent()}class yb extends HTMLElement{connectedCallback(){this.container=this.closest("details"),this.container.addEventListener("toggle",this.#ti),this.container.addEventListener("keydown",this.#ni),this.#ri(this.initialize.bind(this))}disconnectedCallback(){this.container?.removeEventListener("toggle",this.#ti),this.container?.removeEventListener("keydown",this.#ni)}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#ri(e){await this.toolbar.editorElement,e()}#ti=()=>{this.container.open&&this.#ii()};async#ii(){this.#oi[0].focus(),this.#_()}#ni=e=>{"Escape"===e.key&&(e.stopPropagation(),this.close())};async#_(){await am(),this.#U.forEach(((e,t)=>{e.setAttribute("tabindex",0===t?0:"-1")}))}get#oi(){return Array.from(this.querySelectorAll("button, input"))}get#U(){return Array.from(this.querySelectorAll("button"))}}class bb extends yb{connectedCallback(){super.connectedCallback(),this.input=this.querySelector("input"),this.container.addEventListener("toggle",this.#ti),this.addEventListener("submit",this.#si),this.querySelector("[value='unlink']").addEventListener("click",this.#li)}disconnectedCallback(){this.container?.removeEventListener("toggle",this.#ti),this.removeEventListener("submit",this.#si),this.querySelector("[value='unlink']")?.removeEventListener("click",this.#li),super.disconnectedCallback()}#ti=({newState:e})=>{this.input.value=this.#ai,this.input.required="open"===e};#si=e=>{const t=e.submitter?.value;this.editor.dispatchCommand(t,this.input.value),this.close()};#li=()=>{this.editor.dispatchCommand("unlink"),this.close()};get#ai(){let e="";return this.editor.getEditorState().read((()=>{const t=zi();if(!vi(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if(ud(n)){e=n.getURL();break}n=n.getParent()}})),e}}const _b="button.lexxy-highlight-button",xb="[data-command='removeHighlight']",Cb=Symbol("no_style");class Sb extends yb{initialize(){this.#ci(),this.#ui()}connectedCallback(){super.connectedCallback(),this.container.addEventListener("toggle",this.#ti)}disconnectedCallback(){this.container?.removeEventListener("toggle",this.#ti),this.#di(),super.disconnectedCallback()}#ui(){this.#hi.forEach((e=>e.addEventListener("click",this.#gi))),this.querySelector(xb).addEventListener("click",this.#pi)}#di(){this.#hi.forEach((e=>e.removeEventListener("click",this.#gi))),this.querySelector(xb)?.removeEventListener("click",this.#pi)}#ci(){this.#fi.innerHTML="";const e=this.editorElement.config.get("highlight.buttons");this.#mi("color",e.color),this.#mi("background-color",e["background-color"]);const t=Math.max(e.color.length,e["background-color"].length);this.style.setProperty("--max-colors",t)}#mi(e,t){t.forEach(((t,n)=>{this.#fi.appendChild(this.#yi(e,t,n))}))}#yi(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}#ti=({newState:e})=>{"open"===e&&this.editor.getEditorState().read((()=>{this.#bi(zi())}))};#gi=e=>{e.preventDefault();const t=e.target.closest(_b);if(!t)return;const n=t.dataset.style,r=t.dataset.value;this.editor.dispatchCommand("toggleHighlight",{[n]:r}),this.close()};#pi=e=>{e.preventDefault(),this.editor.dispatchCommand("removeHighlight"),this.close()};#bi(e){if(!vi(e))return;const t=Va(e,"color",Cb),n=Va(e,"background-color",Cb);this.#hi.forEach((e=>{const r=e.dataset.value===t||e.dataset.value===n;e.setAttribute("aria-pressed",r)}));const r=t!==Cb||n!==Cb;this.querySelector(xb).disabled=!r}get#fi(){return this.querySelector(".lexxy-highlight-colors")}get#hi(){return Array.from(this.querySelectorAll(_b))}}class vb{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=Fg("li",{role:"option",id:Mg("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=Rg(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class wb extends vb{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#_i(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#_i(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return um(e).includes(um(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class kb extends wb{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class Eb extends wb{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class Tb extends vb{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.#xi(e));return this.#_i(t)}#xi(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#_i(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 Nb extends HTMLElement{constructor(){super(),this.keyListeners=[],this.showPopoverId=0}static observedAttributes=["connected"];connectedCallback(){this.source=this.#Ci(),this.#Si(),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.#m()))}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#vi(){return!this.supportsSpaceInSearches}#Ci(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new Tb(e):new Eb(e):new kb(this.querySelectorAll("lexxy-prompt-item"))}#Si(){const e=this.#Wn.registerUpdateListener((({editorState:t})=>{t.read((()=>{if(this.#wi.isInsideCodeBlock)return;const{node:t,offset:n}=this.#wi.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.#ki())}}}}))}))}#Ei(){this.cursorPositionListener=this.#Wn.registerUpdateListener((({editorState:e})=>{this.closed||e.read((()=>{if(this.#wi.isInsideCodeBlock)return void this.#Ti();const{node:e,offset:t}=this.#wi.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.#Ti()}else this.#Ti()}))}))}#Ni(){this.cursorPositionListener&&(this.cursorPositionListener(),this.cursorPositionListener=null)}get#Wn(){return this.#J.editor}get#J(){return this.closest("lexxy-editor")}get#wi(){return this.#J.selection}async#ki(){const e=++this.showPopoverId;this.popoverElement??=await this.#Ai(),this.showPopoverId===e&&(this.#Li(),await this.#Oi(),this.showPopoverId===e&&(this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#Fi(),this.#J.addEventListener("keydown",this.#Ri),this.#J.addEventListener("lexxy:change",this.#Oi),this.#Ii(),this.#Ei()))}#Ii(){this.keyListeners.push(this.#Wn.registerCommand(An,this.#Pi.bind(this),4)),this.keyListeners.push(this.#Wn.registerCommand(In,this.#Pi.bind(this),4)),this.#vi&&this.keyListeners.push(this.#Wn.registerCommand(Ln,this.#Pi.bind(this),4)),this.keyListeners.push(this.#Wn.registerCommand(Tn,this.#Mi.bind(this),4)),this.keyListeners.push(this.#Wn.registerCommand(Nn,this.#Di.bind(this),4))}#Mi(e){return this.#Bi(),e.preventDefault(),!0}#Di(e){return this.#$i(),e.preventDefault(),!0}#Fi(){const e=this.#zi[0];e&&this.#Hi(e)}get#zi(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#Hi(e){this.#Ki(),e.toggleAttribute("aria-selected",!0),e.scrollIntoView({block:"nearest",behavior:"smooth"}),e.focus(),this.#wi.preservingSelection((()=>{this.#J.focus()})),this.#Ui.setAttribute("aria-controls",this.popoverElement.id),this.#Ui.setAttribute("aria-activedescendant",e.id),this.#Ui.setAttribute("aria-haspopup","listbox")}#Ki(){this.#zi.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#Ui.removeAttribute("aria-controls"),this.#Ui.removeAttribute("aria-activedescendant"),this.#Ui.removeAttribute("aria-haspopup")}#Wi(){const{x:e,y:t,fontSize:n}=this.#wi.cursorPosition,r=this.#J.getBoundingClientRect(),i=this.#Ui.getBoundingClientRect(),o=i.top-r.top;this.popoverElement.hasAttribute("data-anchored")||(this.#Vi(e),this.#qi(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.#qi(i.height-t+n),this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#Vi(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-x",`${e}px`)}#qi(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-y",`${e}px`)}#Li(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-clipped-at-right"),this.popoverElement.removeAttribute("data-anchored")}async#Ti(){this.showPopoverId++,this.#Ki(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#J.removeEventListener("lexxy:change",this.#Oi),this.#J.removeEventListener("keydown",this.#Ri),this.#ji(),this.#Ni(),await am(),this.#Si()}#ji(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#Oi=async()=>{if(this.initialPrompt)this.initialPrompt=!1;else if(this.#Zi.containsTextBackUntil(this.trigger)){if(await this.#Gi(),!this.#Zi.containsTextBackUntil(this.trigger))return void this.#Ti();await am(),this.#Wi()}else this.#Ti()};async#Gi(){const e=this.showPopoverId,t=this.#Zi.textBackUntil(this.trigger),n=await this.source.buildListItems(t);this.showPopoverId===e&&this.#Zi.containsTextBackUntil(this.trigger)&&(this.popoverElement.innerHTML="",n.length>0?this.#Ji(n):this.#Yi(),this.#Fi())}#Ji(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#Yi(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=Fg("li",{innerHTML:this.#Xi});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#Xi(){return this.getAttribute("empty-results")||"Nothing found"}#Ri=e=>{"Escape"===e.key?(this.#Ti(),this.#J.focus(),e.stopPropagation()):","===e.key&&(e.preventDefault(),e.stopPropagation(),this.#Qi(),this.#Wn.update((()=>{const e=zi();vi(e)&&e.insertText(",")})))};#$i(){const e=this.#eo+1;e<this.#zi.length&&this.#Hi(this.#zi[e])}#Bi(){const e=this.#eo-1;e>=0&&this.#Hi(this.#zi[e])}get#eo(){return this.#zi.findIndex((e=>e.hasAttribute("aria-selected")))}get#to(){return this.#zi[this.#eo]}#Pi(e){return e.preventDefault(),e.stopPropagation(),this.#Qi(),!0}#Qi(){this.#no(),this.#Ti(),this.#J.focus()}#no(){const e=this.source.promptItemFor(this.#to);if(!e)return;const t=Array.from(e.querySelectorAll("template[type='editor']")),n=`${this.trigger}${this.#Zi.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#ro(t,n):this.#io(t,n,e.getAttribute("sgid"))}#ro(e,t){this.#Wn.update((()=>{const n=e.flatMap((e=>this.#oo(e)));this.#Zi.replaceTextBackUntil(t,n)}))}#oo(e){return bd(this.#Wn,Rg(`${e.innerHTML}`))}#io(e,t,n=null){this.#Wn.update((()=>{const r=this.#so(e,n).flatMap((e=>[e,this.#lo()])).slice(0,-1);this.#Zi.replaceTextBackUntil(t,r)}))}#so(e,t=null){return e.map((e=>this.#ao(e.innerHTML,e.getAttribute("content-type")||this.#co,e.getAttribute("sgid")||t)))}#lo(){return hi(" ")}get#co(){return`application/vnd.${Xa.global.get("attachmentContentTypeNamespace")}.${this.name}`}#ao(e,t,n){return new kf({sgid:n,contentType:t,innerHtml:e})}get#Zi(){return this.#J.contents}get#Ui(){return this.#J.editorContentElement}async#Ai(){const e=Fg("ul",{role:"listbox",id:Mg("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",nc()),e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#uo),this.#J.appendChild(e),e}#uo=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#Hi(t),this.#Qi())};#m(){this.disconnectedCallback(),this.connectedCallback()}}class Ab extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.#do(),this.#ho(),this.#go()}disconnectedCallback(){this.dispose()}dispose(){this.unregisterUpdateListener?.(),this.unregisterUpdateListener=null}#do(){this.languagePickerElement=this.#po()??this.#fo(),this.append(this.languagePickerElement)}#po(){return this.querySelector("select")}#fo(){const e=Fg("select",{className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#mo)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e.addEventListener("change",(()=>{this.#yo(this.languagePickerElement.value)})),e.setAttribute("nonce",nc()),e}get#mo(){const e={...Kh};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])}#yo(e){this.editor.update((()=>{const t=this.#bo();t&&t.setLanguage(e)}))}#go(){this.unregisterUpdateListener=this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#bo();e?this.#_o(e):this.#ho()}))}))}#bo(){const e=zi();if(!vi(e))return null;const t=e.anchor.getNode(),n=t.getParent();return Th(t)?t:Th(n)?n:null}#_o(e){const t=e.getLanguage();this.#xo(t),this.#Co(),this.#So(e)}#xo(e){if(this.languagePickerElement&&e){const t=Wh(e);this.languagePickerElement.value=t}}#So(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`}#Co(){this.hidden=!1}#ho(){this.hidden=!0}}class Lb extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.querySelector(".lexxy-node-delete")||this.#vo()}disconnectedCallback(){this.editor=null,this.editorElement=null}#vo(){const e=Fg("div",{className:"lexxy-floating-controls__group"});this.deleteButton=Fg("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.#wo(),this.deleteButton.addEventListener("click",this.handleDeleteClick),e.appendChild(this.deleteButton),this.appendChild(e)}#wo(){this.editor.update((()=>{const e=_s(this);e?.remove()}))}}class Ob{constructor(e){this.editor=e.editor,this.contents=e.contents,this.selection=e.selection,this.currentTableNodeKey=null,this.currentCellKey=null,this.#ko()}destroy(){this.currentTableNodeKey=null,this.currentCellKey=null,this.#Eo()}get currentCell(){return this.currentCellKey?this.editor.getEditorState().read((()=>{const e=ms(this.currentCellKey);return e instanceof Wg?e:null})):null}get currentTableNode(){return this.currentTableNodeKey?this.editor.getEditorState().read((()=>{const e=ms(this.currentTableNodeKey);return e instanceof df?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=op(e);return sp(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 op(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=zi();if(!n||!this.selection.isTableCellSelected)return;const r=n.getNodes()[0];e=Qp(r),t=ef(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.#To(e,t):this.#No(e):this.#Ao()}#To(e,t=null){this.#Lo(),this.editor.dispatchCommand(this.#Oo(e)),this.#Fo(e,t)}#No(e){const t=e.childType;let n=null,r=null;"row"===t?(n=this.currentRowCells,r=Ug):"column"===t&&(n=this.currentColumnCells,r=Hg),n&&0!==n.length&&this.editor.update((()=>{const e=ip(n[0]);if(!e)return;const t=e.getHeaderStyles()^r;n.forEach((e=>{this.#Ro(e,t,r)}))}))}#Ao(){this.#Lo(),this.editor.dispatchCommand("deleteTable")}#Lo(){this.editor.update((()=>{const e=zi();if(!e)return;const t=e.getNodes()[0];Qp(t)?.selectEnd()}))}#Oo(e){const{action:t,childType:n,direction:r}=e;return`${t}Table${dm(n)}${"insert"==t?dm(r):""}`}#Ro(e,t,n){const r=ip(e);r?.setHeaderStyles(t,n)}async#Io(e,t){if(await am(),!this.currentTableNode)return;const n=this.tableRows;if(!n)return;const r=n[e];r&&this.editor.update((()=>{const e=ip(r.getChildAtIndex(t));e?.selectEnd()}))}#Fo(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.#Io(i,o)}#Po(){const e=this.tableRows;if(!e)return;const t=e.at(this.currentRowIndex+1);t&&this.editor.update((()=>{t.getChildAtIndex(this.currentColumnIndex)?.selectEnd()}))}#Mo(){const e=this.currentCell;e&&this.editor.update((()=>{e.selectPrevious()}))}#Do(){this.executeTableCommand({action:"insert",childType:"row",direction:"after"},0)}#Bo(){this.executeTableCommand({action:"delete",childType:"row"},-1)}#$o(){const e=this.currentTableNode;this.executeTableCommand({action:"delete",childType:"row"}),this.editor.update((()=>{const t=e?.getNextSibling();if(zo(t))t.selectStart();else{const e=$o();this.currentTableNode.insertAfter(e),e.selectStart()}}))}#zo(){if(!this.currentTableNode)return!1;const e=this.currentCell;return!!e&&""===e.getTextContent().trim()}#Ho(){if(!this.currentTableNode)return!1;const e=this.tableRows;return!!e&&e.length===this.currentRowIndex+1}#Ko(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&e.every((e=>""===e.getTextContent().trim()))}#Uo(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&0===e.indexOf(this.currentCell)}#ko(){this.unregisterBackspaceKeyHandler=this.editor.registerCommand(On,(e=>this.#Wo(e)),3),this.unregisterEnterKeyHandler=this.editor.registerCommand(An,(e=>this.#Vo(e)),3)}#Eo(){this.unregisterBackspaceKeyHandler?.(),this.unregisterEnterKeyHandler?.(),this.unregisterBackspaceKeyHandler=null,this.unregisterEnterKeyHandler=null}#Wo(e){return!!this.currentTableNode&&(this.#Ko()&&this.#Uo()?(e.preventDefault(),this.#Bo(),!0):!(!this.#zo()||this.#Uo())&&(e.preventDefault(),this.#Mo(),!0))}#Vo(e){return!(e.ctrlKey||e.metaKey||e.shiftKey||!this.currentTableNode)&&(!this.selection.isInsideList&&!this.selection.isInsideCodeBlock&&(e.preventDefault(),this.#Ho()&&this.#Ko()?this.#$o():this.#Ho()?this.#Do():this.#Po(),!0))}}var Fb={"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 Rb extends HTMLElement{connectedCallback(){this.tableController=new Ob(this.#J),this.classList.add("lexxy-floating-controls"),this.#ci(),this.#ho(),this.#qo(),this.#jo()}disconnectedCallback(){this.dispose()}dispose(){this.#Zo(),this.unregisterUpdateListener?.(),this.unregisterUpdateListener=null,this.removeEventListener("keydown",this.#Go),this.tableController?.destroy(),this.tableController=null}get#Wn(){return this.#J.editor}get#J(){return this.closest("lexxy-editor")}get#Jo(){return Array.from(this.querySelectorAll("button, details > summary"))}#ci(){this.innerHTML="",this.appendChild(this.#Yo()),this.appendChild(this.#Xo()),this.appendChild(this.#Qo()),this.addEventListener("keydown",this.#Go)}#es(e,t,n){const r=Fg("div",{className:`lexxy-floating-controls__group lexxy-table-control lexxy-table-control--${e}`}),i=this.#yi(`Add ${e}`,{action:"insert",childType:e,direction:"after"},"+"),o=this.#yi(`Remove ${e}`,{action:"delete",childType:e},"−"),s=Fg("details",{className:"lexxy-table-control__more-menu"});s.setAttribute("name","lexxy-dropdown"),s.tabIndex=-1;const l=Fg("summary",{},`_ ${e}s`);return t(l),s.appendChild(l),s.appendChild(n),r.appendChild(o),r.appendChild(s),r.appendChild(i),r}#Yo(){return this.#es("row",(e=>{this.rowCount=e}),this.#ts("row"))}#Xo(){return this.#es("column",(e=>{this.columnCount=e}),this.#ts("column"))}#ts(e){const t=Fg("div",{className:"lexxy-floating-controls__group lexxy-table-control__more-menu-details"}),n=this.#yi(`Add ${e} before`,{action:"insert",childType:e,direction:"before"}),r=this.#yi(`Add ${e} after`,{action:"insert",childType:e,direction:"after"}),i=this.#yi(`Toggle ${e} style`,{action:"toggle",childType:e}),o=this.#yi(`Remove ${e}`,{action:"delete",childType:e});return t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(o),t}#Qo(){const e=Fg("div",{className:"lexxy-table-control lexxy-floating-controls__group"}),t=this.#yi("Delete this table?",{action:"delete",childType:"table"});return t.classList.add("lexxy-table-control__button--delete-table"),e.appendChild(t),this.deleteContainer=e,e}#yi(e,t={},n=this.#ns(t)){const r=Fg("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.#rs(t))),r.addEventListener("mouseover",(()=>this.#is())),r.addEventListener("focus",(()=>this.#is())),r.addEventListener("mouseout",(()=>this.#is())),r}#jo(){this.unregisterKeyboardShortcuts=this.#Wn.registerCommand(Sn,this.#os,3)}#Zo(){this.unregisterKeyboardShortcuts?.(),this.unregisterKeyboardShortcuts=null}#os=e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F10"===e.key){const e=this.querySelector("button, [tabindex]:not([tabindex='-1'])");e?.focus()}};#Go=e=>{"Escape"===e.key?this.#ss():rc(this.#Jo,e)};#ss(){const e=this.tableController.currentCell;e&&(this.#Wn.update((()=>{e.select(),this.#Wn.focus()})),this.#ls())}async#is(){await am(),this.#as();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.#Wn.getElementByKey(e.getKey());n&&(n.classList.toggle(Og.tableCellHighlight,!0),Object.assign(n.dataset,t))}))}#qo(){this.unregisterUpdateListener=this.#Wn.registerUpdateListener((()=>{this.tableController.updateSelectedTable();this.tableController.currentTableNode?this.#Co():this.#ho()}))}#rs(e){this.tableController.executeTableCommand(e),this.#ls()}#Co(){this.#cs(),this.style.display="flex",this.#us(),this.#ds(),this.#is()}#ho(){this.style.display="none",this.#as()}#ls(){this.#cs(),this.#us(),this.#ds(),this.#is()}#ds(){this.querySelector("details[open]")?.removeAttribute("open")}#cs(){const e=this.tableController.currentTableNode;if(!e)return;const t=this.#Wn.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.#J.getBoundingClientRect(),i=n.top-r.top,o=(n.left+n.right)/2-r.left;this.style.top=`${i}px`,this.style.left=`${o}px`}#us(){const e=this.tableController.currentTableNode;if(!e)return;const t=hf(this.#Wn,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"}`}#hs(){const e=this.tableController.currentCell;if(!e)return;const t=this.#Wn.getElementByKey(e.getKey());t&&t.classList.add(Og.tableCellFocus)}#as(){this.#J.querySelectorAll(`.${Og.tableCellFocus}`)?.forEach((e=>{e.classList.remove(Og.tableCellFocus)})),this.#J.querySelectorAll(`.${Og.tableCellHighlight}`)?.forEach((e=>{e.classList.remove(Og.tableCellHighlight),e.removeAttribute("data-action"),e.removeAttribute("data-child-type"),e.removeAttribute("data-direction")})),this.#hs()}#ns(e){const{action:t,childType:n}=e,r=[t,n,"insert"==t?e.direction:null].filter(Boolean).join("-");return Fb[r]}}function Ib(){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;const i=function(e){const t=[],n=e.querySelector("code")||e;let r=0;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent.length;else if(e.nodeType===Node.ELEMENT_NODE){if("BR"===e.tagName)return void(r+=1);const n="MARK"===e.tagName,o=r;for(const t of e.childNodes)i(t);if(n){const n=function(e){const t=[];e.style?.color&&t.push(`color: ${e.style.color};`);e.style?.backgroundColor&&t.push(`background-color: ${e.style.backgroundColor};`);return t.length>0?t.join(" "):null}(e);n&&t.push({start:o,end:r,style:n})}}}for(const e of n.childNodes)i(e);return t}(e);n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const s=o.highlight(n,r,t),l=Fg("code",{"data-language":t,innerHTML:s});i.length>0&&function(e,t){for(const{start:n,end:r,style:i}of t)Pb(e,n,r,i)}(l,i);e.replaceWith(l)}(e)}))}function Pb(e,t,n,r){const i=function(e){const t=[];let n=0;const r=document.createTreeWalker(e,4);let i;for(;i=r.nextNode();){const e=i.textContent.length;t.push({node:i,start:n,end:n+e}),n+=e}return t}(e);for(let e=i.length-1;e>=0;e--){const{node:o,start:s,end:l}=i[e],a=Math.max(t,s),c=Math.min(n,l);if(a>=c)continue;const u=a-s,d=c-s,h=o.textContent,g=o.parentNode,p=document.createElement("mark");p.setAttribute("style",r),p.textContent=h.slice(u,d),d<h.length&&g.insertBefore(document.createTextNode(h.slice(d)),o.nextSibling),g.insertBefore(p,o.nextSibling),u>0?o.textContent=h.slice(0,u):g.removeChild(o)}}const Mb=Xa.configure;setTimeout((function(){const e={"lexxy-toolbar":Nc,"lexxy-editor":fb,"lexxy-link-dropdown":bb,"lexxy-highlight-dropdown":Sb,"lexxy-prompt":Nb,"lexxy-code-language-picker":Ab,"lexxy-node-delete-button":Lb,"lexxy-table-tools":Rb};Object.entries(e).forEach((([e,t])=>{customElements.define(e,t)}))}),0);export{gm as $createActionTextAttachmentNode,xm as $createActionTextAttachmentUploadNode,pm as $isActionTextAttachmentNode,hm as ActionTextAttachmentNode,bm as ActionTextAttachmentUploadNode,kf as CustomActionTextAttachmentNode,zf as Extension,Bg as HorizontalDividerNode,Mb as configure,Ib as highlightAll,Ib 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=I(Array.prototype.forEach),_=I(Array.prototype.lastIndexOf),x=I(Array.prototype.pop),C=I(Array.prototype.push),S=I(Array.prototype.splice),w=I(String.prototype.toLowerCase),v=I(String.prototype.toString),k=I(String.prototype.match),E=I(String.prototype.replace),T=I(String.prototype.indexOf),N=I(String.prototype.trim),A=I(Object.prototype.hasOwnProperty),L=I(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 I(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 R(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 I(n.get);if("function"==typeof n.value)return I(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,I=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=R({},[...B,...z,...$,...K,...W]);let Ee=null;const Te=R({},[...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,Ie=!0,Re=!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=R({},["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=R({},["audio","video","img","source","image","track"]);let Qe=null;const et=R({},["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=R({},[tt,nt,rt],v);let at=R({},["mi","mo","mn","ms","mtext"]),ct=R({},["annotation-xml"]);const ut=R({},["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")?R({},e.ALLOWED_TAGS,gt):ke,Ee=A(e,"ALLOWED_ATTR")?R({},e.ALLOWED_ATTR,gt):Te,st=A(e,"ALLOWED_NAMESPACES")?R({},e.ALLOWED_NAMESPACES,v):lt,Qe=A(e,"ADD_URI_SAFE_ATTR")?R(M(et),e.ADD_URI_SAFE_ATTR,gt):et,Ye=A(e,"ADD_DATA_URI_TAGS")?R(M(Xe),e.ADD_DATA_URI_TAGS,gt):Xe,Ge=A(e,"FORBID_CONTENTS")?R({},e.FORBID_CONTENTS,gt):Je,Ae=A(e,"FORBID_TAGS")?R({},e.FORBID_TAGS,gt):M({}),Le=A(e,"FORBID_ATTR")?R({},e.FORBID_ATTR,gt):M({}),Ze=!!A(e,"USE_PROFILES")&&e.USE_PROFILES,Fe=!1!==e.ALLOW_ARIA_ATTR,Ie=!1!==e.ALLOW_DATA_ATTR,Re=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&&(Ie=!1),Ke&&(He=!0),Ze&&(ve=R({},W),Ee=[],!0===Ze.html&&(R(ve,B),R(Ee,V)),!0===Ze.svg&&(R(ve,z),R(Ee,j),R(Ee,Z)),!0===Ze.svgFilters&&(R(ve,$),R(Ee,j),R(Ee,Z)),!0===Ze.mathMl&&(R(ve,K),R(Ee,q),R(Ee,Z))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Oe.tagCheck=e.ADD_TAGS:(ve===ke&&(ve=M(ve)),R(ve,e.ADD_TAGS,gt))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Oe.attributeCheck=e.ADD_ATTR:(Ee===Te&&(Ee=M(Ee)),R(Ee,e.ADD_ATTR,gt))),e.ADD_URI_SAFE_ATTR&&R(Qe,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ge===Je&&(Ge=M(Ge)),R(Ge,e.FORBID_CONTENTS,gt)),je&&(ve["#text"]=!0),Be&&R(ve,["html","head","body"]),ve.table&&(R(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=R({},[...z,...$,...H]),_t=R({},[...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=I(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(Ie&&!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(Re&&!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,Ie=5,Re=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",[Re]:"end",[Fe]:"justify",[Ae]:"left",[Oe]:"right",[Ie]:"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&&(ko(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!==_s(e,n)}function et(e,t,n){const r=ul(el(n));let i=null,o=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,o=r.focusOffset);const s=e.nodeValue;null!==s&&Fs(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 ls(t)&&n.isAttached()}function nt(e,t,n,r){for(let i=e;i&&!kl(i);i=Zs(i)){const e=_s(i,t);if(void 0!==e){const t=ys(e,n);if(t)return No(t)||!gl(i)?void 0:[i,t]}else if(i===r)return[r,vs(n)]}}function rt(e,t,n){Je=!0;const r=performance.now()-Ye>100;try{Co(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)&&ls(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=bs(r),o=r.parentNode;if(null!=o&&r!==a&&null===i&&!Qe(r,o,e)){if(be){const e=(gl(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&&ks(i),be&&Vs(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&&el(e).addEventListener("textInput",Xe,!0)}(e),e._observer=new MutationObserver(((t,n)=>{rt(e,t,n)}))}let st=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;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),this.resetOnCopyNode=t.resetOnCopyNode||!1}};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(oo(),"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}=Tl(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)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}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:Go(_l(),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=ao()._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(!ko(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let vt,kt,Et,Tt,Nt,At,Lt,Ot,Ft,It,Rt="",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),ko(n)){const e=Jt(n,Lt);$t(e,0,e.length-1,null)}void 0!==n&&Ks(It,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(Lo(e))return null;const n=e.getParentOrThrow();return Lo(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"):No(n)&&r.setAttribute("data-lexical-decorator","true"),ko(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(No(n)){const t=n.decorate(kt,vt);null!==t&&Xt(e,t),r.contentEditable="false"}Rt+=t}return null!==t&&t.insertChild(r),Ks(It,Et,Tt,n,"created"),r}function qt(e,t,n,r,i){const o=Rt;Rt="";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()):ko(t)&&s<r&&!t.isInline()&&(Rt+=Me)}i.element.__lexicalTextContent=Rt,Rt=o+Rt}function Zt(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return Gr(e)?"line-break":No(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=qs(kt,e);if(n===r&&!i){let e;if(ko(n)){const t=o.__lexicalTextContent;"string"==typeof t?e=t:(e=n.getTextContent(),o.__lexicalTextContent=e)}else e=n.getTextContent();return Rt+=e,o}if(n!==r&&i&&Ks(It,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(ko(n)){ko(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=Rt,i=e.__size,o=t.__size;Rt="";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=qs(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()):ko(i)&&h<=l&&!i.isInline()&&(Rt+=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=Rt,Rt=r+Rt}(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),Lo(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),Rt+=t}if((Dt||r.__dir!==n.__dir)&&(Vt(o,r),Lo(r)&&!Dt))for(const e of r.getChildren())ko(e)&&Vt(qs(kt,e.getKey()),e)}else{const t=r.getTextContent();if(No(r)){const t=r.decorate(kt,vt);null!==t&&Xt(e,t)}Rt+=t}if(!Bt&&Lo(r)&&r.__cachedText!==Rt){const e=r.getWritable();e.__cachedText=Rt,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=Cs(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"),In=nn("KEY_DELETE_COMMAND"),Rn=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()||js(t,Sn,e)}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;pl(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Co(t,(()=>{Xo(n)||(ar=!0)}))}],["compositionstart",function(e,t){js(t,cn,e)}],["compositionend",function(e,t){be?ur=!0:Ce||!xe&&!ke?js(t,un,e):(dr=!0,hr=e.data)}],["input",function(e,t){e.stopPropagation(),Co(t,(()=>{t.dispatchCommand(an,e)}),{event:e}),ir=null}],["click",function(e,t){Co(t,(()=>{const n=$i(),r=ul(el(t)),i=Hi();if(r)if(wi(n)){const t=n.anchor,o=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!Lo(o)&&1===ws().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=Nl(o,(e=>ko(e)&&!e.isInline()));ko(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(gl(n)||ls(n))&&ks(zi(i,r,t,e))}js(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&&Vs(t)||"insertCompositionText"!==n&&js(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=ao(),c=ul(el(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||Ts(n))&&o.offset!==s.offset&&!l.isComposing()||ss(l)||l.isDirty()&&g>1||(i||!_e)&&null!==h&&!l.isComposing()&&u!==cs(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=os(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(gi(t)||ko(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,l)}function mr(e,t){return ls(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)||Co(t,(()=>{if(!n)return void ks(null);if(!es(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(),ks(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=el(t).event,o=i?i.timeStamp:performance.now(),[s,a,c,u,d]=pr,h=ws(),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){ko(r)||ge(259);const e=n.getNode();e.isEmpty()?function(e,t){br(e,t.getTextFormat(),t.getTextStyle())}(l,e):br(l,l.format,"")}}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}}js(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=ao(),i=$i();if("deleteContentBackward"===t){if(null===i){const e=Hi();if(!wi(e))return!0;ks(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(fs(null),tr=0,setTimeout((()=>{Co(r,(()=>{fs(null)}))}),30),wi(i)){const e=i.anchor.getNode();e.markDirty(),gi(e)||ge(142),_r(i,e)}}else{fs(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=!No(Ws(i.anchor,!0))),!a){js(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&&Os(!1,r,ir),i.dirty&&null===ir||!i.isCollapsed()||Lo(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(),js(r,hn,!1);else if(s===Me)e.preventDefault(),js(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(),js(r,pn,s)):ir=s;return rr=e.timeStamp,!0}switch(e.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":js(r,pn,e);break;case"insertFromComposition":fs(null),js(r,pn,e);break;case"insertLineBreak":fs(null),js(r,hn,!1);break;case"insertParagraph":fs(null),cr&&!Ce?(cr=!1,js(r,hn,!1)):js(r,gn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":js(r,fn,e);break;case"deleteByComposition":(function(e,t){return e!==t||ko(e)||ko(t)||!os(e)||!os(t)})(c,u)&&js(r,mn,e);break;case"deleteByDrag":case"deleteByCut":js(r,mn,e);break;case"deleteContent":js(r,dn,!1);break;case"deleteWordBackward":js(r,yn,!0);break;case"deleteWordForward":js(r,yn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":js(r,bn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":js(r,bn,!1);break;case"formatStrikeThrough":js(r,_n,"strikethrough");break;case"formatBold":js(r,_n,"bold");break;case"formatItalic":js(r,_n,"italic");break;case"formatUnderline":js(r,_n,"underline");break;case"historyUndo":js(r,xn,void 0);break;case"historyRedo":js(r,Cn,void 0)}return!0}function Sr(e){if(gl(e.target)&&Xo(e.target))return!0;const t=ao(),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=ul(el(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)===Ls(o.anchorNode)||js(t,pn,r);const c=r.length;be&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),ve&&t.isComposing()&&(tr=0,fs(null))}else Os(!1,t,null!==r?r:void 0),ur&&(kr(t,r||void 0),ur=!1);return function(){oo();it(ao())}(),!0}function wr(e){const t=ao(),n=$i();if(wi(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();fs(r.key),Ys(Wr),(e.timeStamp<tr+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||gi(i)&&i.getStyle()!==n.style)&&js(t,pn,De)}return!0}function vr(e){return kr(ao(),e.data),Ys(Vr),!0}function kr(e,t){const n=e._compositionKey;if(fs(null),null!==n&&null!=t){if(""===t){const t=ys(n),r=cs(e.getElementByKey(n));if(null!==r&&null!==r.nodeValue&&gi(t)){const n=ul(el(e));let i=null,o=null;null!==n&&n.anchorNode===r&&(i=n.anchorOffset,o=n.focusOffset),Fs(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 js(e,An,null)}}}Os(!0,e,t)}function Er(e){const t=ao();if(null==e.key)return!0;if(dr){if(Bs(e))return Co(t,(()=>{kr(t,hr)})),dr=!1,hr="",!0;dr=!1,hr=""}if(function(e){return Ps(e,"ArrowRight",{shiftKey:"any"})}(e))js(t,wn,e);else if(function(e){return Ps(e,"ArrowRight",Ms)}(e))js(t,vn,e);else if(function(e){return Ps(e,"ArrowLeft",{shiftKey:"any"})}(e))js(t,kn,e);else if(function(e){return Ps(e,"ArrowLeft",Ms)}(e))js(t,En,e);else if(function(e){return Ps(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))js(t,Tn,e);else if(function(e){return Ps(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))js(t,Nn,e);else if(function(e){return Ps(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))cr=!0,js(t,An,e);else if(function(e){return" "===e.key}(e))js(t,Ln,e);else if(function(e){return ye&&Ps(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),cr=!0,js(t,hn,!0);else if(function(e){return Ps(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))cr=!1,js(t,An,e);else if(function(e){return Ps(e,"Backspace",{shiftKey:"any"})||ye&&Ps(e,"h",{ctrlKey:!0})}(e))Bs(e)?js(t,On,e):(e.preventDefault(),js(t,dn,!0));else if(function(e){return"Escape"===e.key}(e))js(t,Fn,e);else if(function(e){return Ps(e,"Delete",{})||ye&&Ps(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),js(t,dn,!1)):js(t,In,e);else if(function(e){return Ps(e,"Backspace",Ds)}(e))e.preventDefault(),js(t,yn,!0);else if(function(e){return Ps(e,"Delete",Ds)}(e))e.preventDefault(),js(t,yn,!1);else if(function(e){return ye&&Ps(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),js(t,bn,!0);else if(function(e){return ye&&(Ps(e,"Delete",{metaKey:!0})||Ps(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),js(t,bn,!1);else if(function(e){return Ps(e,"b",Ms)}(e))e.preventDefault(),js(t,_n,"bold");else if(function(e){return Ps(e,"u",Ms)}(e))e.preventDefault(),js(t,_n,"underline");else if(function(e){return Ps(e,"i",Ms)}(e))e.preventDefault(),js(t,_n,"italic");else if(function(e){return Ps(e,"Tab",{shiftKey:"any"})}(e))js(t,Rn,e);else if(function(e){return Ps(e,"z",Ms)}(e))e.preventDefault(),js(t,xn,void 0);else if(function(e){return ye?Ps(e,"z",{metaKey:!0,shiftKey:!0}):Ps(e,"y",{ctrlKey:!0})||Ps(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),js(t,Cn,void 0);else{const n=t._editorState._selection;null===n||wi(n)?zs(e)&&(e.preventDefault(),js(t,Vn,e)):function(e){return Ps(e,"c",Ms)}(e)?(e.preventDefault(),js(t,Un,e)):function(e){return Ps(e,"x",Ms)}(e)?(e.preventDefault(),js(t,Wn,e)):zs(e)&&(e.preventDefault(),js(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=Qs(e);return t?t.getSelection():null}(e.target);if(null===t)return;const n=ns(t.anchorNode);if(null===n)return;ar&&(ar=!1,Co(n,(()=>{const r=Hi(),i=t.anchorNode;(gl(i)||ls(i))&&ks(zi(r,t,n,e))})));const r=Ns(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=rs(e);ts(i)?(function(e){if(null!==e._parentEditor){const t=Ns(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 Ir(e,t,n){oo();const r=e.__key,i=e.getParent();if(null===i)return;const o=function(e){const t=$i();if(!wi(t)||!ko(e))return t;const{anchor:n,focus:r}=t,i=n.getNode(),o=r.getNode();return Xs(i,e)&&n.set(e.__key,0,"element"),Xs(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();gs(e),Ki(o,i,t,-1)}else gs(e);n||rl(i)||i.canBeEmpty()||!i.isEmpty()||Ir(i,t),t&&o&&Lo(i)&&i.isEmpty()&&i.selectEnd()}const Rr=Symbol.for("ephemeral");function Pr(e){return e[Rr]||!1}class Mr{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=Tl(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))}resetOnCopyNodeFrom(e){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}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}),hs(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=ys(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(No(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:ys(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(rl(t))return ko(e)||e===this&&No(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:ys(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:ys(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=ko(this)?this:this.getParent(),n=ko(e)?e:e.getParent(),r=t&&n?oa(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=oa(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===na(t):("same"!==t.type&&"ancestor"!==t.type&&ge(279),!1)))}isParentOf(e){const t=oa(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=ko(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=ao()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){if(Pr(this))return this;const e=ys(this.__key);return null===e&&ge(113),e}getWritable(){if(Pr(this))return this;oo();const e=lo(),t=ao(),n=e._nodeMap,r=this.__key,i=this.getLatest(),o=t._cloneNotNeeded,s=$i();if(null!==s&&s.setCachedNodes(null),o.has(r))return ps(i),i;const l=wl(i);return o.add(r),ps(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){Ir(this,!0,e)}replace(e,t){oo();let n=$i();null!==n&&(n=n.clone()),sl(this,e);const r=this.getLatest(),i=this.__key,o=e.__key,s=e.getWritable(),l=this.getParentOrThrow().getWritable(),a=l.__size;gs(s);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(Ir(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&&(ko(this)&&ko(s)||ge(139),this.getChildren().forEach((e=>{s.append(e)}))),wi(n)){ks(n);const e=n.anchor,t=n.focus;e.key===i&&Ci(e,s),t.key===i&&Ci(t,s)}return ms()===i&&fs(o),s}insertAfter(e,t=!0){oo(),sl(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(gs(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){oo(),sl(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;gs(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 Bo()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){oo();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(ko(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){oo();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(ko(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&&yl(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&&yl(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 ol(new jr)}function Gr(e){return e instanceof jr}function Jr(e){return ls(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=Hs(i,"base");void 0!==s&&o.add(...s),s=Hs(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=Hs(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===ms()}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 us(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 gl(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=us(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){oo();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=ms();e!==i.anchor.key&&e!==i.focus.key||fs(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){oo();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=ms(),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&&fs(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&&ps(t),null!==n&&ps(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;ms()===r&&fs(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(!gl(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,gl(n)){const e=n.style.display;if(""===e&&!ml(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(ls(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 ol(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=Hs(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 ol(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:ta(fa(sa(this,"next")),fa(sa(e,"next")))<0}getNode(){const e=ys(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,io()||(ms()===o&&fs(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(!ko(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(ko(t)){const n=t.getLastDescendant();ko(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=ys(e);null!==t&&n.push(t)}return io()||(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=Ul(e[0],"next");aa(Ql(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(zl(n)){const{origin:e}=n;0===t.length?i.add(e):(o.add(e),t.push(e))}else{const{origin:e}=n;ko(e)&&o.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Bl(e.focus)&&ko(e.focus.origin)&&null===e.focus.getNodeAtCaret())for(let n=ql(e.focus.origin,"previous");zl(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=Zl(n))i.delete(n.origin),t.pop();for(;t.length>1;){const e=t[t.length-1];if(!ko(e)||o.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=fa(e.anchor),r=fa(e.anchor.getFlipped()),i=e=>Dl(e)?e.origin:e.getNodeAtCaret(),o=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(o)}return t}(ba(ua(this),"next"));return io()||(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(ko(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!No(d)&&!Gr(d)||d===n&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=ao(),n=t.getEditorState()._selection,r=Ri(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=us(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),zo(o))o.splice(0,0,[s]);else{const e=Lo(i)?Bo().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&&la(s,fa(sa(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&&(ss(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(gi(t)&&t.canInsertTextBefore()&&!ss(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&&(ss(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(gi(t)&&!ss(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()||ko(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),Ii(this.anchor,this.focus),void this.insertText(e)}if(1===u){if(os(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=ko(d)?d:d.getParentOrThrow();let r=ko(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)&&!os(p)&&a!==p.getTextContentSize()){if(p.isSegmented()){const e=hi(p.getTextContent());p.replace(e),p=e}Lo(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)||ko(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(os(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;ca(this,pa(ua(this))),e&&$i()!==this&&ks(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void fs(null);const n=this.getNodes(),r=[];for(const e of n)gi(e)&&r.push(e);const i=t=>{n.forEach((n=>{if(ko(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},o=r.length;if(0===o)return this.toggleFormat(e),fs(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(ss(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||ss(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const b=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||ss(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=Nl(t,bl),r=e[e.length-1];if(ko(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const t=Gi(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(ko(e)||No(e))&&!e.isInline()))){ko(n)||ge(211,t.constructor.name,t.getType());const i=Gi(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=Bo();let n=null;for(let r=0;r<e.length;r++){const i=e[r],o=Gr(i);if(o||No(i)&&i.isInline()||ko(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=ko(n)&&n.isEmpty()?null:this.insertParagraph(),a=s[s.length-1];let c=s[0];var u;ko(u=c)&&bl(u)&&!u.isEmpty()&&ko(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(ko(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=Nl(o,bl);l&&ko(d)&&(l.canMergeWhenEmpty()||bl(a))&&(d.append(...l.getChildren()),l.remove()),ko(n)&&n.isEmpty()&&n.remove(),o.selectEnd();const h=ko(n)?n.getLastChild():null;Gr(h)&&d!==n&&h.remove()}insertParagraph(){if("root"===this.anchor.key){const e=Bo();return ws().splice(this.anchor.offset,0,[e]),e.select(),e}const e=Gi(this),t=Nl(this.anchor.getNode(),bl);ko(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(Yi(this,e,t,n))return;const r="move"===e,i=ao(),o=ul(el(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,a=this.focus.getNode();if(null===l||null===s||!ko(a)||a.isInline()||a.canBeEmpty()||cl(s,i,l),this.dirty){let e=qs(i,this.anchor.key),t=qs(i,this.focus.key);"text"===this.anchor.type&&(e=cs(e)),"text"===this.focus.type&&(t=cs(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=Lo(n)?n:nl(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];Xs(t,i)?r.push(t):s=!0}if(s&&r.length>0)if(t){const e=r[0];ko(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];ko(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&&Yi(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&ko(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(ko(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=Yl(sa(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(zl(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(ko(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=fa(t);ca(this,Ql(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(Bl(t)){if(ko(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(No(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&ko(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=Bi();e.add(t.origin.getKey()),ks(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return ca(this,Ql(!t.origin.isEmpty()&&n.isEmpty()?da(Ul(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!(Ts(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()&&Lo(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.isCollapsed()?this.deleteCharacter(e):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(ko(n)){if(n.collapseAtStart(e))return!0;if(rl(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(gl(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=Es(u),gi(i))o=Vl(i,s?"next":"previous");else{let l=Es(e);if(null===l)return null;if(ko(l)){const a=r.getElementByKey(l.getKey());null===a&&ge(214);const c=l.getDOMSlot(a);[l,o]=c.resolveChildIndex(l,a,e,t),ko(l)||ge(215),s&&o>=l.getChildrenSize()&&(o=Math.max(0,l.getChildrenSize()-1));let u=l.getChildAtIndex(o);if(ko(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=ko(u)?u:u.getParentOrThrow()),o=0}gi(u)?(i=u,l=null,o=Vl(u,s?"next":"previous")):u!==l&&s&&!d&&(ko(l)||ge(216),o=Math.min(l.getChildrenSize(),o+1))}else{const n=l.getIndexWithinParent();o=0===t&&No(l)&&Es(e)===l?n:n+1,l=l.getParentOrThrow()}if(ko(l))return _i(l.__key,o,"element")}}else i=Es(e);return gi(i)?_i(i.__key,Vl(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&&ko(o)&&o.isInline()){const t=o.getPreviousSibling();gi(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else ko(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&&ko(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&ko(o)&&o.isInline()&&!o.canInsertTextAfter()){const t=o.getNextSibling();gi(t)&&e.set(t.__key,0,"text")}}}function Ii(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 Ri(e,t,n,r,i,o){if(null===e||null===n||!es(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=Es(e),r=Es(n);if(No(t)&&No(r))return null}return Ii(s,l),[s,l]}function Pi(e){return ko(e)&&!e.isInline()}function Mi(e,t,n,r,i,o){const s=lo(),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)&&!es(n,c,u))return e.clone();const g=Ri(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()):ko(e)&&(m=e.getTextFormat(),y=e.getTextStyle())}}return new vi(p,f,m,y)}function $i(){return lo()._selection}function Hi(){return ao()._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(!ko(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(ko(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(ko(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"):ko(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,gi(i)?l="text":ko(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=qs(e,t.getKey());if(ko(t)){const e=t.getDOMSlot(r);return[e.element,n+e.getFirstChildOffset()]}return[r,n]}function Zi(e){let t=$i()||Hi();null===t&&(t=ws().selectEnd()),t.insertNodes(e)}function Gi(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(;!bl(i);){const e=i;if([i,o]=Ji(i,o),e.is(i))break}return o}function Ji(e,t){const n=e.getParent();if(!n){const e=Bo();return ws().append(e),e.select(),[ws(),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(!ko(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 Yi(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=sa(e.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===t;let a=o,c="decorators-and-blocks"===i;if(!ma(a)){for(const e of a){c=!1;const{origin:t}=e;if(!No(t)||t.isIsolated()||(a=e,!s||!t.isInline()))break}if(c)for(const e of Yl(o).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(zl(e))e.origin.isInline()||(a=e);else{if(ko(e.origin))continue;No(e.origin)&&!e.origin.isInline()&&(a=e)}break}}if(a===o)return!1;if(l&&!s&&No(a.origin)&&a.origin.isKeyboardSelectable()){const e=Bi();return e.add(a.origin.getKey()),ks(e),!0}return a=fa(a),l&&la(e.anchor,a),la(e.focus,a),c||!s}let Xi=null,Qi=null,eo=!1,to=!1,no=0;const ro={characterData:!0,childList:!0,subtree:!0};function io(){return eo||null!==Xi&&Xi._readOnly}function oo(){eo&&ge(13)}function so(){no>99&&ge(14)}function lo(){return null===Xi&&ge(195,co()),Xi}function ao(){return null===Qi&&ge(196,co()),Qi}function co(){let e=0;const t=new Set,n=Vo.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=rs(r);if(ts(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 uo(e,t,n){const r=t.__type,i=Go(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 ho(e,t){return void 0!==e&&e.__key!==t&&e.isAttached()}function go(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 po(e){return fo(e,ao()._nodes)}function fo(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(ko(o)&&Array.isArray(s))for(let e=0;e<s.length;e++){const n=fo(s[e],t);o.append(n)}return o}function mo(e,t,n){const r=Xi,i=eo,o=Qi;Xi=t,eo=!0,Qi=e;try{return n()}finally{Xi=r,eo=i,Qi=o}}function yo(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=Xi,u=eo,d=Qi,h=e._updating,g=e._observer;let p=null;if(e._pendingEditorState=null,e._editorState=n,!i&&a&&null!==g){Qi=e,Xi=n,eo=!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){Rt="",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 It=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,It=void 0,s}(o,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),to)throw t;return $o(e,null,r,n),ot(e),e._dirtyType=2,to=!0,yo(e,o),void(to=!1)}finally{g.observe(r,ro),e._updating=h,Xi=c,eo=u,Qi=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:ul(el(e));if(e._editable&&null!==x&&(a||null===l||l.dirty||!l.is(s))&&null!==r&&!b.has(Kr)){Qi=e,Xi=n;try{if(null!==g&&g.disconnect(),a||null===l||l.dirty){const t=e._blockCursorElement;null!==t&&cl(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($r)&&u!==o||null!==u&&Qo(u))return;if(!wi(t))return void(null!==e&&es(n,s,l)&&r.removeAllRanges());const d=t.anchor,h=t.focus,g=d.getNode(),p=h.getNode(),[f,m]=qi(n,g,d.offset),[y,b]=qi(n,p,h.offset),_=t.format,x=t.style,C=t.isCollapsed();let S=f,w=y,v=!1;var k,E,T,N,A;if("text"===d.type?(S=cs(f),v=g.getFormat()!==_||g.getStyle()!==x):wi(e)&&"text"===e.anchor.type&&(v=!0),"text"===h.type&&(w=cs(y)),null!==S&&null!==w&&(C&&(null===e||v||wi(e)&&(e.format!==_||e.style!==x))&&(k=_,E=x,T=m,N=d.key,A=performance.now(),pr=[k,E,T,N,A]),a!==m||c!==b||s!==S||l!==w||"Range"===r.type&&C||(null!==u&&o.contains(u)||i.has(Ur)||o.focus({preventScroll:!0}),"element"===d.type))){if(ji(r,S,m,w,b),!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?S.childNodes[m]||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=Gs(n),i=Qs(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=el(e).innerHeight;const t=i.getComputedStyle(r.documentElement),n=parseFloat(t.scrollPaddingTop),o=parseFloat(t.scrollPaddingBottom);isFinite(n)&&(l+=n),isFinite(o)&&(a-=o)}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=Zs(c)}}(n,t,o)}}lr=!0}}(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())al(o.getChildAtIndex(s-1))&&(l=!0);else{const t=o.getChildAtIndex(s);if(null!==t&&al(t)){const n=t.getPreviousSibling();(null===n||al(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=ka(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&&cl(r,e,t)}(e,r,l)}finally{null!==g&&g.observe(r,ro),Qi=d,Xi=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,bo("decorator",e,!0,C)),function(e,t,n){const r=Ss(t),i=Ss(n);r!==i&&bo("textcontent",e,!0,i)}(e,t||o,n),bo("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;xo(e,t,r)}}}(e)}function bo(e,t,n,...r){const i=t._updating;t._updating=n;try{const n=t._listeners[e],i=Array.from(n);for(const[e,t]of i){t&&t();const i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function _o(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),go(e,i.tag)),null==o?xo(e,n,i):n()}}return r}function xo(e,t,n){const r=e._updateTags;let i,o=!1,s=!1;void 0!==n&&(i=n.onUpdate,go(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=Oo(a||l),c=!0),a._flushSync=s;const u=Xi,d=eo,h=Qi,g=e._updating;Xi=a,eo=!1,e._updating=!0,Qi=e;const p=e._headless||null===e.getRootElement();qo(null);try{c&&(p?null!==l._selection&&(a._selection=l._selection.clone()):a._selection=function(e,t){const n=e.getEditorState()._selection,r=ul(el(e));return wi(n)||null==n?zi(n,r,e,t):n.clone()}(e,n&&n.event||null));const r=e._compositionKey;t(),o=_o(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=ms(),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&&ho(r,o)&&uo(t,r,s),n.add(e)}if(l=t._dirtyLeaves,a=l.size,a>0){no++;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&&ho(a,o)&&uo(t,a,s)}l=t._dirtyLeaves,a=l.size,c=t._dirtyElements,u=c.size,no++}t._dirtyLeaves=n,t._dirtyElements=r}(a,e),_o(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()||(ko(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 yo(e)}finally{Xi=u,eo=d,Qi=h,e._updating=g,no=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,yo(e)):c&&Yo((()=>{yo(e)})):(a._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Co(e,t,n){Qi===e&&void 0===n?t():xo(e,t,n)}class So{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new So(this.element,e,this.after)}withAfter(e){return new So(this.element,this.before,e)}withElement(e){return this.element===e?this:new So(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=wo(t,n);i.push(r);const o=wo(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 wo(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 vo 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=ao()._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),ko(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;ko(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;ko(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 ko(e)&&e.getLastDescendant()||e||null}const r=t[e];return ko(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:ys(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&ge(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:ys(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(),ko(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(),ko(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 us(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){oo();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)||ko(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)||ko(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;gs(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--,gs(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;Eo(r,t,n)&&Wi(r,r.getNode(),this,c,a),Eo(i,t,n)&&Wi(i,i.getNode(),this,c,a),0!==u||this.canBeEmpty()||rl(this)||this.remove()}}return i}getDOMSlot(e){return new So(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(gl(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||rl(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 ko(e){return e instanceof vo}function Eo(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 To extends Mr{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function No(e){return e instanceof To}class Ao extends vo{__cachedText;static getType(){return"root"}static clone(){return new Ao}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){ge(51)}getTextContent(){const e=this.__cachedText;return!io()&&0!==ao()._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)ko(e)||No(e)||ge(282);return super.splice(e,t,n)}static importJSON(e){return ws().updateFromJSON(e)}collapseAtStart(){return!0}}function Lo(e){return e instanceof Ao}function Oo(e){return new Ro(new Map(e._nodeMap))}function Fo(){return new Ro(new Map([["root",new Ao]]))}function Io(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&ge(130,n.name),ko(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 Ro{_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 mo(t&&t.editor||null,this,e)}clone(e){const t=new Ro(this._nodeMap,void 0===e?this._selection:e);return t._readOnly=!0,t}toJSON(){return mo(null,this,(()=>({root:Io(ws())})))}}class Po extends vo{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Mo extends vo{static getType(){return"paragraph"}static clone(e){return new Mo(e.__key)}createDOM(e){const t=document.createElement("p"),n=Hs(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Do,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(gl(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return Bo().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=Bo();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 Do(e){const t=Bo();if(e.style&&(t.setFormat(e.style.textAlign),vl(e,t)),""===t.getFormatType()){const n=e.getAttribute("align");n&&n&&n in We&&t.setFormat(n)}return{node:t}}function Bo(){return ol(new Mo)}function zo(e){return e instanceof Mo}function $o(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Fo(),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 Ho(e){const t=new Set,n=new Set;let r=e;for(;r;){const{ownNodeConfig:e}=Tl(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 Ko(e){const t=e||{},n=Qi,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,o=t.disableEvents||!1,s=Fo(),l=t.namespace||(null!==i?i._config.namespace:As()),a=t.editorState,c=[Ao,ri,jr,fi,Mo,Po,...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}Tl(t);const i=t.getType(),o=Ho(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 Vo(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}function Uo(e,t){const n=e.get(t);e.delete(t),n&&n()}function Wo(e,t,n){return e.set(t,n),Uo.bind(null,e,t)}class Vo{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 Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},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=As(),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){return Wo(this._listeners.update,e)}registerEditableListener(e){return Wo(this._listeners.editable,e)}registerDecoratorListener(e){return Wo(this._listeners.decorator,e)}registerTextContentListener(e){return Wo(this._listeners.textcontent,e)}registerRootListener(e){const t=this._listeners.root;return Na(Wo(t,e,e(this._rootElement,null)||void 0),(()=>function(e,t,n){const r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement])))}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=Sl(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=Sl(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=ys(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 js(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=Hs(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,$o(this,t,e,r),null!==t&&(this._config.disableEvents||Fr(t),null!=n&&t.classList.remove(...n)),null!==e){const t=Qs(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),yo(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&&js(t,Wn,e);case"copy":return js(t,Un,e);case"paste":return n&&js(t,fn,e);case"dragstart":return n&&js(t,$n,e);case"dragover":return n&&js(t,Hn,e);case"dragend":return n&&js(t,Kn,e);case"focus":return n&&js(t,Jn,e);case"blur":return n&&js(t,Yn,e);case"drop":return n&&js(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),yo(this);bo("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=Oo(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),yo(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=o&&i.add(o),this._updating||yo(this)}parseEditorState(e,t){return function(e,t,n){const r=Fo(),i=Xi,o=eo,s=Qi,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,Xi=r,eo=!1,Qi=t,qo(null);try{const i=t._nodes;fo(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,Xi=i,eo=o,Qi=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return yo(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):xo(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Co(this,(()=>{const r=$i(),i=ws();null!==r?r.dirty||ks(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),Ys("focus"),function(e){oo(),ao()._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=ul(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,bo("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Vo.version="0.42.0+prod.esm";let jo=null;function qo(e){jo=e}let Zo=1;function Go(e,t){const n=Jo(e,t);return void 0===n&&ge(30,t),n}function Jo(e,t){return e._nodes.get(t)}const Yo="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function Xo(e){return No(xs(e))}function Qo(e){const t=document.activeElement;if(!gl(t))return!1;const n=t.nodeName;return No(xs(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==rs(t))}function es(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!Qo(t)&&ns(t)===e}catch(e){return!1}}function ts(e){return e instanceof Vo}function ns(e){let t=e;for(;null!=t;){const e=rs(t);if(ts(e))return e;t=Zs(t)}return null}function rs(e){return e?e.__lexicalEditor:null}function is(e){return $e.test(e)?"rtl":He.test(e)?"ltr":null}function os(e){return yi(e)||e.isToken()}function ss(e){return os(e)||e.isSegmented()}function ls(e){return pl(e)&&3===e.nodeType}function as(e){return pl(e)&&9===e.nodeType}function cs(e){let t=e;for(;null!=t;){if(ls(t))return t;t=t.firstChild}return null}function us(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 ds(e){return gi(e)||Gr(e)||No(e)}function hs(e,t){const n=function(){const e=jo;return jo=null,e}();if(null!=(t=t||n&&n.__key))return void(e.__key=t);oo(),so();const r=ao(),i=lo(),o=""+Zo++;i._nodeMap.set(o,e),ko(e)?r._dirtyElements.set(o,!0):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,e.__key=o}function gs(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 ps(e){so(),Pr(e)&&ge(323,e.__key,e.__type);const t=e.getLatest(),n=t.__parent,r=lo(),i=ao(),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,ko(e)?s.set(l,!0):i._dirtyLeaves.add(l)}function fs(e){oo();const t=ao(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=ys(n);null!==e&&e.getWritable()}if(null!==e){const t=ys(e);null!==t&&t.getWritable()}}}function ms(){return io()?null:ao()._compositionKey}function ys(e,t){const n=(t||lo())._nodeMap.get(e);return void 0===n?null:n}function bs(e,t){const n=_s(e,ao());return void 0!==n?ys(n,t):null}function _s(e,t){return e[`__lexicalKey_${t._key}`]}function xs(e,t){let n=e;for(;null!=n;){const e=bs(n,t);if(null!==e)return e;n=Zs(n)}return null}function Cs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Ss(e){return e.read((()=>ws().getTextContent()))}function ws(){return vs(lo())}function vs(e){return e._nodeMap.get("root")}function ks(e){oo();const t=lo();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Es(e){const t=ao(),n=function(e,t){let n=e;for(;null!=n;){const e=_s(n,t);if(void 0!==e)return e;n=Zs(n)}return null}(e,t);return null===n?e===t.getRootElement()?ys("root"):null:ys(n)}function Ts(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Ns(e){const t=[];for(let n=e;null!==n;n=n._updating?null:n._parentEditor)t.push(n);return t}function As(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ls(e){return ls(e)?e.nodeValue:null}function Os(e,t,n){const r=ul(el(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let t=Ls(i);const r=xs(i);if(null!==t&&gi(r)){if((t===Pe||t===De)&&n){const e=n.length;t=n,o=e,s=e}null!==t&&Fs(r,t,o,s,e)}}}function Fs(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(fs(null),xe||Ce||ke)o.remove();else{const e=ao();setTimeout((()=>{e.update((()=>{o.isAttached()&&o.remove()}))}),20)}return}const t=o.getParent(),i=Hi(),a=o.getTextContentSize(),c=ms(),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 Is(o,l,d);if(d.setTextNodeRange(o,n,o,r),o.isSegmented()){const e=hi(o.getTextContent());o.replace(e),o=e}Is(o,l,d)}}}function Is(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=Vl(e,i.offset,"clamp"))}}}function Rs(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function Ps(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 Ms={ctrlKey:!ye,metaKey:ye},Ds={altKey:ye,ctrlKey:!ye};function Bs(e){return"Backspace"===e.key}function zs(e){return Ps(e,"a",Ms)}function $s(e){const t=ws();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 ks(St(e)),e}}function Hs(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=ka(i);return n[t]=e,e}return i}function Ks(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 Us(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 Ws(e,t){const n=e.offset;if("element"===e.type)return Us(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?Us(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function Vs(e){const t=el(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function js(e,t,n){return function(e,t,n){const r=Ns(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(Co(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 qs(e,t){const n=e._keyToDOMMap.get(t);return void 0===n&&ge(75,t),n}function Zs(e){const t=e.assignedSlot||e.parentElement;return fl(t)?t.host:t}function Gs(e){return as(e)?e:gl(e)?e.ownerDocument:null}function Js(e){return ao()._updateTags.has(e)}function Ys(e){oo(),ao()._updateTags.add(e)}function Xs(e,t){let n=e.getParent();for(;null!==n;){if(n.is(t))return!0;n=n.getParent()}return!1}function Qs(e){const t=Gs(e);return t?t.defaultView:null}function el(e){const t=e._window;return null===t&&ge(78),t}function tl(e){return ko(e)&&e.isInline()||No(e)&&e.isInline()}function nl(e){let t=e.getParentOrThrow();for(;null!==t;){if(rl(t))return t;t=t.getParentOrThrow()}return t}function rl(e){return Lo(e)||ko(e)&&e.isShadowRoot()}function il(e,t=!1){const n=e.constructor.clone(e);return hs(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function ol(e){const t=ao(),n=e.getType(),r=Jo(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 sl(e,t){!Lo(e.getParent())||ko(t)||No(t)||ge(99)}function ll(e){const t=ys(e);return null===t&&ge(63,e),t}function al(e){return(No(e)||ko(e)&&!e.canBeEmpty())&&!e.isInline()}function cl(e,t,n){n.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=e.parentElement;null!==r&&r.removeChild(e)}function ul(e){return fe?(e||window).getSelection():null}function dl(e,t){let n=e.getChildAtIndex(t);null==n&&(n=e),rl(e)&&ge(102);const r=e=>{const t=e.getParentOrThrow(),i=rl(t),o=e!==n||i?il(e):e;if(i)return ko(e)&&ko(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]}function hl(e){return gl(e)&&"A"===e.tagName}function gl(e){return pl(e)&&1===e.nodeType}function pl(e){return"object"==typeof e&&null!==e&&"nodeType"in e&&"number"==typeof e.nodeType}function fl(e){return pl(e)&&11===e.nodeType}function ml(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 yl(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 bl(e){if(No(e)&&!e.isInline())return!0;if(!ko(e)||rl(e))return!1;const t=e.getFirstChild(),n=null===t||Gr(t)||gi(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function _l(){return ao()}const xl=new WeakMap,Cl=new Map;function Sl(e){if(!e._readOnly&&e.isEmpty())return Cl;e._readOnly||ge(192);let t=xl.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),xl.set(e,t)),t}function wl(e){const t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function vl(e,t){const n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function kl(e){return!0===e.__lexicalUnmanaged}function El(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Mr[t]}function Tl(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{Vo.version&&(n=JSON.parse(Vo.version))}catch(e){}ge(290,e.name,t,n)}return e===To||e===vo||e===Mr}(e),r=!n&&El(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&&(El(e,"getType")||(e.getType=()=>o),El(e,"clone")||(e.clone=t=>(qo(t),new e)),El(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!El(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:o}}const Nl=(e,t)=>{let n=e;for(;null!=n&&!Lo(n);){if(t(n))return n;n=n.getParent()}return null},Al={next:"previous",previous:"next"};class Ll{origin;constructor(e){this.origin=e}[Symbol.iterator](){return ea({hasNext:Bl,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Ul(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Ul(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=Ul(e,this.direction)}for(const e of s.values())e.remove();return this}}class Ol extends Ll{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ql(e,this.direction)}getParentCaret(e="root"){return Ul(Rl(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Il(this.direction);return Ul(this.getNodeAtCaret(),e)||ql(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Ol&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Fl={root:Lo,shadowRoot:rl};function Il(e){return Al[e]}function Rl(e,t="root"){return Fl[t](e)?null:e}class Pl extends Ll{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Ul(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return ko(this.origin)?ql(this.origin,this.direction):null}getParentCaret(e="root"){return Ul(Rl(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Il(this.direction);return Ul(this.getNodeAtCaret(),e)||ql(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Pl&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Pl||e instanceof Ml)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Ml extends Ll{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Wl(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Ul(Rl(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Wl(this.origin,Il(this.direction),this.offset)}isSamePointCaret(e){return e instanceof Ml&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Pl||e instanceof Ml)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Ul(this.origin,this.direction)}}function Dl(e){return e instanceof Ml}function Bl(e){return e instanceof Pl}function zl(e){return e instanceof Ol}const $l={next:class extends Ml{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ml{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Hl={next:class extends Pl{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Pl{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Kl={next:class extends Ol{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Ol{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Ul(e,t){return e?new Hl[t](e):null}function Wl(e,t,n){return e?new $l[t](e,Vl(e,n)):null}function Vl(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 jl(e,t){return new Jl(e,t)}function ql(e,t){return ko(e)?new Kl[t](e):null}function Zl(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class Gl{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 Gl(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Dl(t)?function(e,t){const{direction:n,origin:r}=e;return jl(e,Vl(r,"focus"===t?Il(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[jl(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Dl(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Dl(n),i=t=>t.isSameNodeCaret(n)?null:Zl(t)||t.getParentCaret(e);return ea({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 Wl(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}}function Yl(e){return Ql(e,Ul(ws(),e.direction))}function Xl(e){return Ql(e,e)}function Ql(e,t){return e.direction!==t.direction&&ge(265),new Gl(e,t,e.direction)}function ea(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 ta(e,t){const n=oa(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 na(n)}}function na(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 ra(e,t){return t.is(e)}function ia(e){return ko(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function oa(e,t){if(e.is(t))return{commonAncestor:e,type:"same"};const n=new Map;for(let[t,r]=ia(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=ia(t);r;i=r,r=r.getParent()){const o=n.get(r);if(void 0!==o)return null===o?(ra(e,r)||ge(276),{commonAncestor:r,type:"ancestor"}):null===i?(ra(t,r)||ge(277),{commonAncestor:r,type:"descendant"}):((ko(o)||ra(e,o))&&(ko(i)||ra(t,i))&&r.is(o.getParent())&&r.is(i.getParent())||ge(278),{a:o,b:i,commonAncestor:r,type:"branch"})}return null}function sa(e,t){const{type:n,key:r,offset:i}=e,o=ll(e.key);return"text"===n?(gi(o)||ge(266,o.getType(),r),Wl(o,t,i)):(ko(o)||ge(267,o.getType(),r),_a(o,e.offset,t))}function la(e,t){const{origin:n,direction:r}=t,i="next"===r;Dl(t)?e.set(n.getKey(),t.offset,"text"):Bl(t)?gi(n)?e.set(n.getKey(),Vl(n,r),"text"):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),"element"):(zl(t)&&ko(n)||ge(268),e.set(n.getKey(),i?0:n.getChildrenSize(),"element"))}function aa(e){const t=$i(),n=wi(t)?t:Di();return ca(n,e),ks(n),n}function ca(e,t){la(e.anchor,t.anchor),la(e.focus,t.focus)}function ua(e){const{anchor:t,focus:n}=e,r=sa(t,"next"),i=sa(n,"next"),o=ta(r,i)<=0?"next":"previous";return Ql(ya(r,o),ya(i,o))}function da(e){const{direction:t,origin:n}=e,r=Ul(n,Il(t)).getNodeAtCaret();return r?Ul(r,t):ql(n.getParentOrThrow(),t)}function ha(e,t="root"){const n=[e];for(let r=zl(e)?e.getParentCaret(t):e.getSiblingCaret();null!==r;r=r.getParentCaret(t))n.push(da(r));return n}function ga(e){return!!e&&e.origin.isAttached()}function pa(e,t="removeEmptySlices"){if(e.isCollapsed())return e;const n="root",r="next";let i=t;const o=ba(e,r),s=ha(o.anchor,n),l=ha(o.focus.getFlipped(),n),a=new Set,c=[];for(const e of o.iterNodeCarets(n))if(zl(e))a.add(e.origin.getKey());else if(Bl(e)){const{origin:t}=e;ko(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=da(Ul(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=Wl(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(ga(e)){u=fa(e);break}for(const e of l)if(ga(e)){d=fa(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(rl(i))return;!n&&t(i)&&(n=i)}return n},u=c(o,bl),d=u&&c(s,(e=>n.has(e.getKey())&&bl(e)));return u&&d?[u,d]:null}(u,d,a);if(h){const[e,t]=h;ql(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(ga);if(g)return Xl(ya(fa(g),e.direction));ge(269,JSON.stringify(s.map((e=>e.origin.__key))))}function fa(e){const t=function(e){let t=e;for(;zl(t);){const e=Zl(t);if(!zl(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(gi(t.origin))return Dl(t)?t:Wl(t.origin,n,n);const r=t.getAdjacentCaret();return Bl(r)&&gi(r.origin)?Wl(r.origin,n,Il(n)):t}function ma(e){return Dl(e)&&e.offset!==Vl(e.origin,e.direction)}function ya(e,t){return e.direction===t?e:e.getFlipped()}function ba(e,t){return e.direction===t?e:Ql(ya(e.focus,t),ya(e.anchor,t))}function _a(e,t,n){let r=ql(e,"next");for(let e=0;e<t;e++){const e=r.getAdjacentCaret();if(null===e)break;r=e}return ya(r,n)}function xa(e,t="root"){let n=0,r=e,i=Zl(r);for(;null===i;){if(n--,i=r.getParentCaret(t),!i)return null;r=i,i=Zl(r)}return i&&[i,n]}function Ca(e){const{origin:t,offset:n,direction:r}=e;if(n===Vl(t,r))return e.getSiblingCaret();if(n===Vl(t,Il(r)))return da(e.getSiblingCaret());const[i]=t.splitText(n);return gi(i)||ge(281),ya(Ul(i,"next"),r)}function Sa(e,t){return!0}function wa(e,{$copyElementNode:t=il,$splitTextPointCaretNext:n=Ca,rootMode:r="shadowRoot",$shouldSplit:i=Sa}={}){if(Dl(e))return n(e);const o=e.getParentCaret(r);if(o){const{origin:n}=o;if(zl(e)&&(!n.canBeEmpty()||!i(n,"first")))return da(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 va(e,t){if(!t||e===t)return e;for(const n in t)if(e[n]!==t[n])return{...e,...t};return e}function ka(...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 Ea(e,...t){const n=ka(...t);n.length>0&&e.classList.add(...n)}function Ta(e,...t){const n=ka(...t);n.length>0&&e.classList.remove(...n)}function Na(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Aa(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 La=new Map;function Oa(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 Fa(e){let t=La.get(e);return void 0===t&&(t=Oa(e),La.set(e,t)),t}function Ia(e){let t="";for(const n in e)n&&(t+=`${n}: ${e[n]};`);return t}function Ra(e){const t=_l().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function Pa(e){return Ra(Lo(e)?e:e.getParentOrThrow())}function Ma(e){const t=Pa(e);return null!==t&&"rtl"===t.direction}function Da(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!ss(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=wl(e))[Rr]=!0,t;var t}(t)),t.__text=g)}}return t}function Ba(e){const t=e.getStyle(),n=Oa(t);La.set(t,n)}function za(e,t){(wi(e)?e.isCollapsed():gi(e)||ko(e))||Aa(280);const n=Fa(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=Ia(r);wi(e)||gi(e)?e.setStyle(i):e.setTextStyle(i),La.set(i,r)}function $a(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 ua(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&&(ss(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&&Ha(t)}function Ha(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)}}function Ka(e,t){const n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function Ua(e,t,n=Ka){if(null===e)return;const r=e.getStartEndPoints(),i=new Map;let o=null;if(r){const[e,t]=r;o=Di(),o.anchor.set(e.key,e.offset,e.type),o.focus.set(t.key,t.offset,t.type);const n=Nl(e.getNode(),bl),s=Nl(t.getNode(),bl);ko(n)&&i.set(n.getKey(),n),ko(s)&&i.set(s.getKey(),s)}for(const t of e.getNodes())if(ko(t)&&bl(t))i.set(t.getKey(),t);else if(null===r){const e=Nl(t,bl);ko(e)&&i.set(e.getKey(),e)}for(const[e,r]of i){const i=t();n(r,i),r.replace(i,!0),o&&(e===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,o.anchor.type),e===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,o.focus.type))}o&&e.is($i())&&ks(o)}function Wa(e){const t=Va(e);return null!==t&&"vertical-rl"===t.writingMode}function Va(e){const t=e.anchor.getNode();return ko(t)?Ra(t):Pa(t)}function ja(e,t){let n=Wa(e)?!t:t;qa(e)&&(n=!n);const r=sa(e.focus,n?"previous":"next");if(ma(r))return!1;for(const e of Yl(r)){if(zl(e))return!e.origin.isInline();if(!ko(e.origin)){if(No(e.origin))return!0;break}}return!1}function qa(e){const t=Va(e);return null!==t&&"rtl"===t.direction}function Za(e,t,n){const r=qa(e);let i;i=Wa(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}function Ga(e,t,n){const r=Fa(e.getStyle());return null!==r&&r[t]||n}function Ja(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=Fa(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=Ga(o,t,n);if(null===r)r=e;else if(r!==e){r="";break}}}return null===r?n:r}const Ya=["class","contenteditable","href","src","style","title"],Xa=["color","background-color"];function Qa(){const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content}function ec(e,t,n,r){e.addEventListener(t,n,r);const i=new WeakRef(e),o=new WeakRef(n);return function(){const e=o.deref();e&&i.deref()?.removeEventListener(t,e,r)}}he.addHook("uponSanitizeAttribute",(function(e,t){if("style"===t.attrName&&t.attrValue){const e={...Fa(t.attrValue)},n={};for(const t in e)Xa.includes(t)&&(n[t]=e[t]);Object.keys(n).length?t.attrValue=Ia(n):t.keepAttr=!1}})),he.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));class tc{#e=[];track(...e){this.#e.push(...e)}dispose(){for(;this.#e.length;){this.#e.pop()()}}}function nc(e,t){const n=document.activeElement;if(e.includes(n)){new rc(e,t.key).selectNext(n)&&t.preventDefault()}}class rc{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(ic)}#l(e=this.elements){return e.findLast(ic)}#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){ic(e)&&(e.tabIndex=0,e.focus())}#n(e){e.forEach((e=>e.tabIndex=-1))}}function ic(e){return e&&!e.disabled&&e.checkVisibility()}var oc='<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>',sc='<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>',lc='<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>',ac='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 14C14.5523 14 15 14.4477 15 15C15 15.5523 14.5523 16 14 16H4C3.44772 16 3 15.5523 3 15C3 14.4477 3.44772 14 4 14H14Z"/>\n <path d="M12.625 1.59375C13.25 1.59375 13.625 1.97656 13.625 2.64062V9.02344C13.625 11.4844 11.8516 13.1875 8.99219 13.1875C6.14062 13.1875 4.35938 11.4844 4.35938 9.02344V2.64062C4.35938 1.97656 4.74219 1.59375 5.36719 1.59375C6 1.59375 6.375 1.97656 6.375 2.64062V8.84375C6.375 10.3828 7.32031 11.4297 8.99219 11.4297C10.6641 11.4297 11.6172 10.3828 11.6172 8.84375V2.64062C11.6172 1.97656 11.9922 1.59375 12.625 1.59375Z"/>\n </svg>',cc='<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>',uc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M8.12207 4.30078C8.84668 4.30078 9.25684 4.74512 9.25684 5.51758V12.5518C9.25677 13.3241 8.84662 13.7686 8.12207 13.7686C7.39752 13.7686 6.9942 13.3309 6.99414 12.5518V9.87207H3.56934V12.5518C3.56927 13.3241 3.15912 13.7686 2.43457 13.7686C1.71002 13.7686 1.3067 13.3309 1.30664 12.5518V5.51758C1.30664 4.73828 1.70996 4.30078 2.43457 4.30078C3.15918 4.30078 3.56934 4.74512 3.56934 5.51758V8.07422H6.99414V5.51758C6.99414 4.73828 7.39746 4.30078 8.12207 4.30078ZM13.6445 4.19824C15.5244 4.19824 16.8984 5.34668 16.8984 6.91211C16.8984 7.8759 16.4335 8.7237 15.292 9.84473L13.3438 11.8135V11.9092H16.1875C16.8232 11.9092 17.2197 12.251 17.2197 12.8115C17.2196 13.3651 16.83 13.7002 16.1875 13.7002H11.5117C10.8487 13.7002 10.4112 13.3241 10.4111 12.75C10.4111 12.3399 10.6368 11.9843 11.3203 11.3145L13.6855 8.88086C14.4169 8.13583 14.7245 7.64349 14.7246 7.12402C14.7246 6.4541 14.2393 6.00293 13.5215 6.00293C12.9404 6.00293 12.5166 6.29688 12.2158 6.90527C11.9151 7.37002 11.6552 7.54785 11.2588 7.54785C10.7188 7.54785 10.3429 7.17861 10.3428 6.65918C10.3428 5.3877 11.7783 4.19824 13.6445 4.19824Z"/>\n </svg>',dc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M13.5967 4.19824C15.5928 4.19824 16.9873 5.23047 16.9873 6.7002C16.9872 7.705 16.2421 8.60059 15.2988 8.7168V8.86719C16.4199 8.94923 17.2607 9.89942 17.2607 11.0889C17.2606 12.7362 15.7362 13.9053 13.583 13.9053C11.6827 13.9053 10.1925 12.873 10.1924 11.7041C10.1924 11.1846 10.5547 10.8154 11.0537 10.8154C11.3818 10.8154 11.6553 10.9727 11.9629 11.3555C12.3799 11.9159 12.92 12.2031 13.583 12.2031C14.4853 12.2031 15.0731 11.7313 15.0732 11C15.0732 10.2754 14.4785 9.7832 13.5898 9.7832H13.0361C12.5645 9.7832 12.2159 9.4208 12.2158 8.92188C12.2158 8.44336 12.5576 8.07422 13.0361 8.07422H13.5693C14.3075 8.07422 14.8544 7.60928 14.8545 6.97363C14.8545 6.33789 14.3213 5.90039 13.5557 5.90039C12.9678 5.90039 12.5029 6.16016 12.0859 6.71387C11.8399 7.03508 11.5527 7.17871 11.1973 7.17871C10.671 7.17871 10.295 6.82314 10.2949 6.31738C10.2949 5.18945 11.751 4.19824 13.5967 4.19824ZM8.0332 4.30078C8.75781 4.30078 9.16797 4.74512 9.16797 5.51758V12.5518C9.1679 13.3241 8.75776 13.7686 8.0332 13.7686C7.30865 13.7686 6.90534 13.3309 6.90527 12.5518V9.87207H3.48047V12.5518C3.4804 13.3241 3.07026 13.7686 2.3457 13.7686C1.62115 13.7686 1.21784 13.3309 1.21777 12.5518V5.51758C1.21777 4.73828 1.62109 4.30078 2.3457 4.30078C3.07031 4.30078 3.48047 4.74512 3.48047 5.51758V8.07422H6.90527V5.51758C6.90527 4.73828 7.30859 4.30078 8.0332 4.30078Z"/>\n </svg>',hc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14.6357 4.22559C15.7432 4.22559 16.4336 4.80664 16.4336 5.73633V10.3164H16.7275C17.2881 10.3164 17.6436 10.6787 17.6436 11.2256C17.6435 11.7655 17.3017 12.1006 16.7275 12.1006H16.4336V12.6611C16.4335 13.3515 16.0234 13.7891 15.374 13.7891C14.7247 13.7891 14.3282 13.3583 14.3281 12.6611V12.1006H11.04C10.2335 12.1006 9.76863 11.6766 9.76855 10.918C9.76855 10.5762 9.85064 10.3026 10.1104 9.74219C10.7666 8.42289 11.5733 7.0146 12.5713 5.54492C13.2549 4.56738 13.7812 4.22559 14.6357 4.22559ZM7.88965 4.30078C8.61426 4.30078 9.02441 4.74512 9.02441 5.51758V12.5518C9.02435 13.3241 8.6142 13.7686 7.88965 13.7686C7.1651 13.7686 6.76178 13.3309 6.76172 12.5518V9.87207H3.33691V12.5518C3.33685 13.3241 2.9267 13.7686 2.20215 13.7686C1.4776 13.7686 1.07428 13.3309 1.07422 12.5518V5.51758C1.07422 4.73828 1.47754 4.30078 2.20215 4.30078C2.92676 4.30078 3.33691 4.74512 3.33691 5.51758V8.07422H6.76172V5.51758C6.76172 4.73828 7.16504 4.30078 7.88965 4.30078ZM14.2188 6.07812C13.6035 7.02841 12.2158 9.48929 11.7988 10.2686V10.3164H14.3281V6.07812H14.2188Z"/>\n </svg>',gc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M9 12C9.55228 12 10 12.4477 10 13C10 13.5523 9.55228 14 9 14H3C2.44772 14 2 13.5523 2 13C2 12.4477 2.44772 12 3 12H9ZM15 8C15.5523 8 16 8.44772 16 9C16 9.55228 15.5523 10 15 10H3C2.44772 10 2 9.55228 2 9C2 8.44772 2.44772 8 3 8H15ZM15 4C15.5523 4 16 4.44772 16 5C16 5.55228 15.5523 6 15 6H3C2.44772 6 2 5.55228 2 5C2 4.44772 2.44772 4 3 4H15Z"/>\n </svg>',pc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M10.0607 2.07533C10.8417 1.29432 12.1078 1.2943 12.8888 2.07533L16.424 5.61049C17.205 6.39154 17.205 7.65854 16.424 8.43959L9.44937 15.4142C9.07435 15.7891 8.5656 16.0001 8.03531 16.0001H5.0148C4.55074 16.0001 4.10309 15.8385 3.74722 15.547L3.60074 15.4142L1.57534 13.3888C0.79431 12.6078 0.794336 11.3417 1.57534 10.5607L10.0607 2.07533ZM2.98941 11.9747L5.0148 14.0001H8.03531L9.71792 12.3165L6.18179 8.78139L2.98941 11.9747Z"/>\n </svg>',fc='<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>',mc='<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>',yc='<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>',bc='<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>',_c='<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>',xc='<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>',Cc='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 2C15.6569 2 17 3.34315 17 5V13C17 14.6569 15.6569 16 14 16H4C2.34315 16 1 14.6569 1 13V5C1 3.34315 2.34315 2 4 2H14ZM3.06348 13.3496C3.2053 13.7294 3.57078 14 4 14H13.5859L11 11.4141L9.70703 12.707C9.31651 13.0976 8.68349 13.0976 8.29297 12.707C7.90244 12.3165 7.90244 11.6835 8.29297 11.293L8.58594 11L7 9.41406L3.06348 13.3496ZM4 4C3.44772 4 3 4.44772 3 5V10.5859L6.29297 7.29297L6.36914 7.22461C6.76191 6.90427 7.34092 6.92686 7.70703 7.29297L10 9.58594L10.293 9.29297L10.3691 9.22461C10.7619 8.90427 11.3409 8.92686 11.707 9.29297L15 12.5859V5C15 4.44772 14.5523 4 14 4H4ZM12.5 5C13.3284 5 14 5.67157 14 6.5C14 7.32843 13.3284 8 12.5 8C11.6716 8 11 7.32843 11 6.5C11 5.67157 11.6716 5 12.5 5Z"/>\n </svg>',Sc='<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>',wc='<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>',vc='<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>',kc='<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>',Ec='<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>',Tc='<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 Nc extends HTMLElement{static observedAttributes=["connected"];#e=new tc;constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar",this.#c()}connectedCallback(){requestAnimationFrame((()=>this.#u())),this.setAttribute("role","toolbar"),this.#d()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),this.editorElement=null,this.editor=null,this.selection=null,this.#c()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#h()))}configure(e){if("object"==typeof e&&null!==e)for(const[t,n]of Object.entries(e))this.setAttribute(`data-${t}`,n)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.#g(),this.#p(),this.#f(),this.#m(),this.#y(),this.#b(),this.#u(),this.#_(),this.resolveEditorPromise(e),this.toggleAttribute("connected",!0)}async getEditorElement(){return this.editorElement||await this.editorPromise}#h(){this.disconnectedCallback(),this.connectedCallback()}async#c(){this.editorPromise=new Promise((e=>{this.resolveEditorPromise=e})),this.editorElement=await this.editorPromise}#d(){const e=new ResizeObserver((()=>this.#u()));e.observe(this),this.#e.track((()=>e.disconnect()))}#g(){this.#e.track(ec(this,"click",this.#x))}#x=e=>{this.#C(e,"[data-command]",this.#S.bind(this))};#C(e,t,n){const r=e.target.closest(t);r&&n(e,r)}#S(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()}#p(){this.#e.track(ec(this.editorElement,"keydown",this.#w))}#w=e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#v(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))};#v(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("+")}#_(){this.#e.track(ec(this.editorElement,"lexxy:focus",this.#k),ec(this.editorElement,"lexxy:blur",this.#E),ec(this,"keydown",this.#T))}#k=()=>{this.#N[0].tabIndex=0};#E=()=>{this.#f(),this.#A()};#T=e=>{nc(this.#N,e)};#f(){this.#N.forEach((e=>{e.tabIndex=-1}))}#y(){this.#e.track(this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#L(),this.#A()}))})))}#b(){this.#e.track(this.editor.registerUpdateListener((()=>{this.#O()})))}#O(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#F("undo",0===e.undoStack.length),this.#F("redo",0===e.redoStack.length))}))}#L(){const e=$i();if(!wi(e))return;if(!e.anchor.getNode().getParent())return;const{isBold:t,isItalic:n,isStrikethrough:r,isUnderline:i,isHighlight:o,isInLink:s,isInQuote:l,isInHeading:a,headingTag:c,isInCode:u,isInList:d,listType:h,isInTable:g}=this.selection.getFormat();this.#I("bold",t),this.#I("italic",n),this.#I("format",a||r||i),this.#I("paragraph",!a),this.#I("heading-large","h2"===c),this.#I("heading-medium","h3"===c),this.#I("heading-small","h4"===c),this.#I("strikethrough",r),this.#I("underline",i),this.#I("lists",d),this.#I("unordered-list",d&&"bullet"===h),this.#I("ordered-list",d&&"number"===h),this.#I("highlight",o),this.#I("link",s),this.#I("quote",l),this.#I("code",u),this.#I("table",g),this.#O()}#I(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#F(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#R(){return this.scrollWidth-this.#P.clientWidth>this.clientWidth+1}#u=()=>{this.#M(),this.#D(),this.#P.style.display=this.#B.children.length?"block":"none",this.#P.setAttribute("nonce",Qa());const e=this.#B.children.length>0;this.toggleAttribute("overflowing",e),this.#B.toggleAttribute("disabled",!e)};#D(){const e=this.#z.reverse();let t=!1;for(const n of e){if(!this.#R()){t&&this.#B.prepend(n);break}this.#B.prepend(n),t=!0}}#M(){const e=Array.from(this.#B.children);e.sort(((e,t)=>this.#$(t)-this.#$(e))),e.forEach((e=>{const t=this.querySelector(`[data-position="${this.#$(e)+1}"]`)??this.#P;this.insertBefore(e,t)}))}#$(e){return parseInt(e.dataset.position??"999")}#m(){this.#H.forEach(((e,t)=>{void 0===e.dataset.position&&(e.dataset.position=t)}))}#A(){this.#K.forEach((e=>{e.open=!1}))}get#K(){return this.querySelectorAll("details")}get#P(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#B(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}get#z(){return Array.from(this.querySelectorAll(":scope > button:not([data-prevent-overflow='true'])"))}get#N(){return Array.from(this.querySelectorAll(":scope button, :scope > details > summary"))}get#H(){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="image" data-command="uploadImage" data-prevent-overflow="true" title="Add images and video">\n ${Cc}\n </button>\n\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="file" data-command="uploadFile" title="Upload files">\n ${Sc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="bold" data-command="bold" title="Bold">\n ${oc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="italic" data-command="italic" title="Italic">\n ${sc}\n </button>\n\n <details class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--chevron" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="format" title="Text formatting">\n ${cc}\n </summary>\n <div class="lexxy-editor__toolbar-dropdown-list">\n <button type="button" name="paragraph" data-command="setFormatParagraph" title="Paragraph">\n ${gc} <span>Normal</span>\n </button>\n <button type="button" name="heading-large" data-command="setFormatHeadingLarge" title="Large heading">\n ${uc} <span>Large Heading</span>\n </button>\n <button type="button" name="heading-medium" data-command="setFormatHeadingMedium" title="Medium heading">\n ${dc} <span>Medium Heading</span>\n </button>\n <button class="lexxy-editor__toolbar-group-end" type="button" name="heading-small" data-command="setFormatHeadingSmall" title="Small heading">\n ${hc} <span>Small Heading</span>\n </button>\n <div class="lexxy-editor__toolbar-separator" role="separator"></div>\n <button type="button" name="strikethrough" data-command="strikethrough" title="Strikethrough">\n ${lc} <span>Strikethrough</span>\n </button>\n <button type="button" name="underline" data-command="underline" title="Underline">\n ${ac} <span>Underline</span>\n </button>\n <div class="lexxy-editor__toolbar-separator" role="separator"></div>\n <button type="button" name="clear-formatting" data-command="clearFormatting" title="Clear formatting">\n ${pc} <span>Clear formatting</span>\n </button>\n </div>\n </details>\n\n <details class="lexxy-editor__toolbar-dropdown lexxy-editor__toolbar-dropdown--chevron" name="lexxy-dropdown">\n <summary class="lexxy-editor__toolbar-button" name="highlight" title="Color highlight">\n ${fc}\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 lexxy-editor__toolbar-group-end" name="link" title="Link" data-hotkey="cmd+k ctrl+k">\n ${mc}\n </summary>\n <lexxy-link-dropdown class="lexxy-editor__toolbar-dropdown-content">\n <input type="url" placeholder="Enter a URL…" class="input">\n <div class="lexxy-editor__toolbar-dropdown-actions">\n <button type="button" 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 </lexxy-link-dropdown>\n </details>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="quote" data-command="insertQuoteBlock" title="Quote">\n ${yc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="code" data-command="insertCodeBlock" title="Code">\n ${bc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="unordered-list" data-command="insertUnorderedList" title="Bullet list">\n ${_c}\n </button>\n <button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="ordered-list" data-command="insertOrderedList" title="Numbered list">\n ${xc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">\n ${wc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="divider" data-command="insertHorizontalDivider" title="Insert a divider">\n ${vc}\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 ${kc}\n </button>\n\n <button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo">\n ${Ec}\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">${Tc}</summary>\n <div class="lexxy-editor__toolbar-dropdown-content lexxy-editor__toolbar-overflow-menu" aria-label="More toolbar buttons"></div>\n </details>\n `}}function Ac(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 Lc="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Oc=Lc&&"documentMode"in document?document.documentMode:null;function Fc(e,t){return Array.from(function(e){return function(e,t){const n=ws(),r=t||n,i=ko(r)?ql(r,e):Ul(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=xa(Ul(e,t));return n&&n[0]}(r,e);let l=o;return ea({hasNext:e=>null!==e,initial:i,map:e=>({depth:l,node:e.origin}),step:e=>{if(e.isSameNodeCaret(s))return null;zl(e)&&l++;const t=xa(e);return!t||t[0].isSameNodeCaret(s)?null:(l+=t[1],t[0])}})}("next",e)}(e))}function Ic(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function Rc(e){const t=Nl(e,(e=>ko(e)&&!e.isInline()));return ko(t)||Ac(4,e.__key),t}function Pc(e){const t=$i()||Hi();let n;if(wi(t))n=sa(t.focus,"next");else{if(null!=t){const e=t.getNodes(),r=e[e.length-1];r&&(n=Ul(r,"next"))}n=n||ql(ws(),"previous").getFlipped().insert(Bo())}const r=function(e,t,n){let r=ya(t,"next");for(let e=r;e;e=wa(e,n))r=e;return Dl(r)&&Ac(283),r.insert(e.isInline()?Bo().append(e):e),ya(Ul(e.getLatest(),"next"),t.direction)}(e,n),i=Zl(r);return aa(Xl(zl(i)?fa(i):r)),e.getLatest()}function Mc(e,t){const n=t();return e.replace(n),n.append(e),n}function Dc(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Bc(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=Nl(i,(e=>ko(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 zc(e,t){ql(e,"next").insert(t)}function $c(e,t){return Hc(e,t,null)}function Hc(e,t,n){let r=!1;for(const i of Wc(e))t(i)?null!==n&&n(i):(r=!0,ko(i)&&Hc(i,t,n||(e=>i.insertAfter(e))),i.remove());return r}function Kc(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(ko(e))for(const t of Wc(e))r.push(t);return n}function Uc(e){return Vc(ql(e,"next"))}function Wc(e){return Vc(ql(e,"previous"))}function Vc(e){return ea({hasNext:Bl,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}Lc&&"InputEvent"in window&&!Oc&&new window.InputEvent("input");const jc=Symbol.for("preact-signals");function qc(){if(Yc>1)return void Yc--;let e,t=!1;for(;void 0!==Gc;){let n=Gc;for(Gc=void 0,Xc++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&ru(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(Xc=0,Yc--,t)throw e}let Zc,Gc;function Jc(e){const t=Zc;Zc=void 0;try{return e()}finally{Zc=t}}let Yc=0,Xc=0,Qc=0;function eu(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 tu(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 nu(e,t){return new tu(e,t)}function ru(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 iu(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 ou(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 su(e,t){tu.call(this,void 0),this.x=e,this.s=void 0,this.g=Qc-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 lu(e){const t=e.u;if(e.u=void 0,"function"==typeof t){Yc++;const n=Zc;Zc=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,au(e),t}finally{Zc=n,qc()}}}function au(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,lu(e)}function cu(e){if(Zc!==this)throw new Error("Out-of-order effect");ou(this),Zc=e,this.f&=-2,8&this.f&&au(this),qc()}function uu(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 du(e,t){const n=new uu(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function hu(e,t={}){const n={};for(const r in e){const i=t[r],o=nu(void 0===i?e[r]:i);n[r]=o}return n}function gu(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}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 fu(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]=fu(n[e],r[e]);return e}return t}tu.prototype.brand=jc,tu.prototype.h=function(){return!0},tu.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:Jc((()=>{var e;null==(e=this.W)||e.call(this)})))},tu.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&&Jc((()=>{var e;null==(e=this.Z)||e.call(this)})))}},tu.prototype.subscribe=function(e){return du((()=>{const t=this.value,n=Zc;Zc=void 0;try{e(t)}finally{Zc=n}}),{name:"sub"})},tu.prototype.valueOf=function(){return this.value},tu.prototype.toString=function(){return this.value+""},tu.prototype.toJSON=function(){return this.value},tu.prototype.peek=function(){const e=Zc;Zc=void 0;try{return this.value}finally{Zc=e}},Object.defineProperty(tu.prototype,"value",{get(){const e=eu(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Xc>100)throw new Error("Cycle detected");this.v=e,this.i++,Qc++,Yc++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{qc()}}}}),su.prototype=new tu,su.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===Qc)return!0;if(this.g=Qc,this.f|=1,this.i>0&&!ru(this))return this.f&=-2,!0;const e=Zc;try{iu(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,ou(this),this.f&=-2,!0},su.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)}tu.prototype.S.call(this,e)},su.prototype.U=function(e){if(void 0!==this.t&&(tu.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)}},su.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(su.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=eu(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),uu.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()}},uu.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,lu(this),iu(this),Yc++;const e=Zc;return Zc=this,cu.bind(this,e)},uu.prototype.N=function(){2&this.f||(this.f|=2,this.o=Gc,Gc=this)},uu.prototype.d=function(){this.f|=8,1&this.f||au(this)},uu.prototype.dispose=function(){this.d()},lt("format",{parse:e=>"number"==typeof e?e:0});function mu(e){return 0===e.id}function yu(e){return 2===e.id}const bu=new Set;let _u=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):va;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;yu(t)||pu(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&&pu(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&&pu(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&&pu(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&&pu(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&&pu(311),this._signal}getInitResult(){void 0===this.extension.init&&pu(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||pu(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)||pu(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&&pu(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&pu(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||pu(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||bu}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)||pu(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const xu={tag:Br};function Cu(){const e=ws();e.isEmpty()&&e.append(Bo())}const Su={config:{setOptions:xu,updateOptions:xu},init:({$initialEditorState:e=Cu})=>({$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 Ro}(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:[Ao,ri,jr,fi,Mo]},wu=Symbol.for("@lexical/extension/LexicalBuilder");function vu(){}function ku(e){throw e}function Eu(e){return Array.isArray(e)?e:[e]}const Tu="0.42.0+prod.esm";let Nu=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=Tu,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(t){const n=[Eu(Su)];for(const e of t)n.push(Eu(e));return new e(n)}static maybeFromEditor(t){const n=t[wu];return n&&(n.PACKAGE_VERSION!==Tu&&pu(292,n.PACKAGE_VERSION,Tu),n instanceof e||pu(293)),n}static fromEditor(t){const n=e.maybeFromEditor(t);return void 0===n&&pu(294),n}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(Ko({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[wu]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=vu;function t(){try{e()}finally{e=vu}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Na(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&&pu(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&&pu(296);const t=Eu(e),[n]=t;"string"!=typeof n.name&&pu(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&pu(298,n.name),!r){r=new _u(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&pu(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&pu(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=Eu(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(yu(i))return;const o=n.extension.name;var s;mu(i)||pu(300,o,r||"[unknown]"),mu(s=i)||pu(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)||pu(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())mu(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&&pu(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 Na(...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 gu(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&pu(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&&fu(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=ku),e}};function Au(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 Lu(e){let t=1,n=e.getParent();for(;null!=n;){if(qu(n)){const e=n.getParent();if(ed(e)){t++,n=e.getParent();continue}Au(40)}return t}return t}function Ou(e){let t=e.getParent();ed(t)||Au(40);let n=t;for(;null!==n;)n=n.getParent(),ed(n)&&(t=n);return t}function Fu(e){let t=[];const n=e.getChildren().filter(qu);for(let e=0;e<n.length;e++){const r=n[e],i=r.getFirstChild();ed(i)?t=t.concat(Fu(i)):t.push(r)}return t}function Iu(e){return qu(e)&&ed(e.getFirstChild())}function Ru(e){return ju().append(e)}function Pu(e,t){return qu(e)&&(0===t.length||1===t.length&&e.is(t[0])&&0===e.getChildrenSize())}function Mu(e){const t=$i();if(null!==t){let n=t.getNodes();if(wi(t)){const r=t.getStartEndPoints();null===r&&Au(143);const[i]=r,o=i.getNode(),s=o.getParent();if(rl(o)){const e=o.getFirstChild();if(e)n=e.selectStart().getNodes();else{const e=Bo();o.append(e),n=e.select().getNodes()}}else if(Pu(o,n)){const t=Qu(e);if(rl(s)){o.replace(t);const e=ju();ko(o)&&(e.setFormat(o.getFormatType()),e.setIndent(o.getIndent())),t.append(e)}else if(qu(o)){const e=o.getParentOrThrow();Du(t,e.getChildren()),e.replace(t)}return}}const r=new Set;for(let t=0;t<n.length;t++){const i=n[t];if(ko(i)&&i.isEmpty()&&!qu(i)&&!r.has(i.getKey())){Bu(i,e);continue}let o=ds(i)?i.getParent():qu(i)&&i.isEmpty()?i:null;for(;null!=o;){const t=o.getKey();if(ed(o)){if(!r.has(t)){const n=Qu(e);Du(n,o.getChildren()),o.replace(n),r.add(t)}break}{const n=o.getParent();if(rl(n)&&!r.has(t)){r.add(t),Bu(o,e);break}o=n}}}}}function Du(e,t){e.splice(e.getChildrenSize(),0,t)}function Bu(e,t){if(ed(e))return e;const n=e.getPreviousSibling(),r=e.getNextSibling(),i=ju();let o;if(Du(i,e.getChildren()),ed(n)&&t===n.getListType())n.append(i),ed(r)&&t===r.getListType()&&(Du(n,r.getChildren()),r.remove()),o=n;else if(ed(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),o=r;else{const n=Qu(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 zu(e,t){const n=e.getLastChild(),r=t.getFirstChild();n&&r&&Iu(n)&&Iu(r)&&(zu(n.getFirstChild(),r.getFirstChild()),r.remove());const i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function $u(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())qu(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),ed(r.getFirstChild())||n++)}function Hu(e){const t=new Set;if(Iu(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(Iu(r)&&Iu(i)){const n=i.getFirstChild();if(ed(n)){n.append(e);const i=r.getFirstChild();ed(i)&&(Du(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(Iu(r)){const t=r.getFirstChild();if(ed(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(Iu(i)){const t=i.getFirstChild();ed(t)&&t.append(e)}else if(ed(n)){const t=il(e),o=il(n);t.append(o),o.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Ku(e){if(Iu(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(ed(n?n.getParent():void 0)&&qu(n)&&ed(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=il(e),i=il(t);r.append(i),e.getPreviousSiblings().forEach((e=>i.append(e)));const o=il(e),s=il(t);o.append(s),Du(s,e.getNextSiblings()),n.insertBefore(r),n.insertAfter(o),n.replace(e)}}}let Uu=class extends vo{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(null==e.__checked)return;const t=e.getParent();ed(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)},extends:vo,importDOM:{li:()=>({conversion:Wu,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();!ed(r)||"check"!==r.getListType()||ed(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(...ka(s)),o){const e=n.getParent(),t=ed(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=ka(l);n.getChildren().some((e=>ed(e)))?r.push(...e):i.push(...e)}i.length>0&&Ta(e,...i),r.length>0&&Ea(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=Fa(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in Fa(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(ko(n)&&this.canMergeWith(n)){const e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(qu(e))return super.replace(e);this.setIndent(0);const n=this.getParentOrThrow();if(!ed(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{const t=il(n);let r=this.getNextSibling();for(;r;){const e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}return t&&(ko(e)||Au(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(ed(n)||Au(39),qu(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=il(n);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&&Iu(t)&&Iu(n)&&(zu(t.getFirstChild(),n.getFirstChild()),n.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){const n=il(this);return this.insertAfter(n,t),n}collapseAtStart(e){const t=Bo();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=qu(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 ed(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(;qu(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&Au(117),(e=Math.floor(e))>=0||Au(199);let t=this.getIndent();for(;t!==e;)t<e?(Hu(this),t++):(Ku(this),t--);return this}canInsertAfter(e){return qu(e)}canReplaceWith(e){return qu(e)}canMergeWith(e){return qu(e)||zo(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 Qu("bullet")}canMergeWhenEmpty(){return!0}};function Wu(e){if(e.classList.contains("task-list-item"))for(const t of e.children)if("INPUT"===t.tagName)return Vu(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 Vu(t.children[0]);const t=e.getAttribute("aria-checked");return{node:ju("true"===t||"false"!==t&&void 0)}}function Vu(e){return"checkbox"!==e.getAttribute("type")?{node:null}:{node:ju(e.hasAttribute("checked"))}}function ju(e){return ol(new Uu(void 0,e))}function qu(e){return e instanceof Uu}let Zu=class extends vo{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{!function(e){const t=e.getNextSibling();ed(t)&&e.getListType()===t.getListType()&&zu(e,t)}(e),$u(e)},extends:vo,importDOM:{ol:()=>({conversion:Yu,priority:0}),ul:()=>({conversion:Yu,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=Xu[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,Gu(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(Gu(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 gl(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){const r=n.find(qu)??this.getChildren().find(qu),i=r?()=>il(r):ju;let o=n;for(let e=0;e<n.length;e++){const t=n[e];qu(t)||(o===n&&(o=[...n]),o[e]=i().append(!ko(t)||ed(t)||t.isInline()?t:hi(t.getTextContent())))}return super.splice(e,t,o)}extractWithChild(e){return qu(e)}};function Gu(e,t,n){const r=[],i=[],o=t.list;if(void 0!==o){const e=o[`${n.__tag}Depth`]||[],t=Lu(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(...ka(l));for(let t=0;t<e.length;t++)t!==s&&i.push(n.__tag+t)}if(void 0!==c){const e=ka(c);t>1?r.push(...e):i.push(...e)}}i.length>0&&Ta(e,...i),r.length>0&&Ea(e,...r)}function Ju(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(qu(r)){t.push(r);const e=r.getChildren();e.length>1&&e.forEach((e=>{ed(e)&&t.push(Ru(e))}))}else t.push(Ru(r))}return t}function Yu(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=Qu("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(gl(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?Qu("check"):Qu("bullet")),{after:Ju,node:n}}const Xu={ol:"number",ul:"bullet"};function Qu(e="number",t=1){return ol(new Zu(e,t))}function ed(e){return e instanceof Zu}const td=nn("UPDATE_LIST_START_COMMAND"),nd=nn("INSERT_UNORDERED_LIST_COMMAND"),rd=nn("INSERT_ORDERED_LIST_COMMAND"),id=nn("REMOVE_LIST_COMMAND");function od(e,t){return Na(e.registerCommand(rd,(()=>(Mu("number"),!0)),1),e.registerCommand(td,(e=>{const{listNodeKey:t,newStart:n}=e,r=ys(t);return!!ed(r)&&("number"===r.getListType()&&(r.setStart(n),$u(r)),!0)}),1),e.registerCommand(nd,(()=>(Mu("bullet"),!0)),1),e.registerCommand(id,(()=>(function(){const e=$i();if(wi(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Pu(r,n))t.add(Ou(r));else for(let e=0;e<n.length;e++){const r=n[e];if(ds(r)){const e=Ic(r,Uu);null!=e&&t.add(Ou(e))}}for(const n of t){let t=n;const r=Fu(n);for(const n of r){const r=Bo().setTextStyle(e.style).setTextFormat(e.format);Du(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&la(e.anchor,fa(ql(r,"next"))),n.__key===e.focus.key&&la(e.focus,fa(ql(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(qu(n)&&0===n.getChildrenSize())r=n;else if(gi(n)){const e=n.getParent();qu(e)&&e.getChildren().every((e=>gi(e)&&""===e.getTextContent().trim()))&&(r=e)}if(null===r)return!1;const i=Ou(r),o=r.getParent();ed(o)||Au(40);const s=o.getParent();let l;if(rl(s))l=Bo(),i.insertAfter(l);else{if(!qu(s))return!1;l=il(s),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=il(o).setStart(t);if(qu(l)){const e=il(l);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||!qu(e)&&!ed(e))break;t=e}t.remove()}(r),!0}(!1)),1),e.registerNodeTransform(Uu,(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(qu(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}const sd=new Set(["http:","https:","mailto:","sms:","tel:"]);let ld=class e extends vo{__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}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),Ea(t,e.theme.link),t}updateLinkDOM(e,t,n){if(hl(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:ad,priority:1})}}static importJSON(e){return cd().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=yd(e);try{const t=new URL(yd(e));if(!sd.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=il(this);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://")}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function ad(e){let t=null;if(hl(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=cd(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function cd(e="",t){return ol(new ld(e,t))}function ud(e){return e instanceof ld}let dd=class e extends ld{__isUnlinked;constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__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)}shouldMergeAdjacentLink(e){return!1}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 hd().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=hd(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function hd(e="",t){return ol(new dd(e,t))}function gd(e){return e instanceof dd}function pd(e,t){if("element"===e.type){const n=e.getNode();return ko(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 fd(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=Nl(e,(e=>!gd(e)&&ud(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=Nl(e,(e=>!gd(e)&&ud(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==o&&t.setRel(o);else{const t=cd(n,{rel:o,target:r});e.insertBefore(t),t.append(e)}}}))}if(s.isCollapsed()&&null===n)for(const e of s.getNodes()){const t=Nl(e,(e=>!gd(e)&&ud(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=Nl(t,(e=>!gd(e)&&ud(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())||ko(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=il(e);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=Nl(e,ud);if(null!==t)return c(t)}!function(e){const t=$i();if(!wi(t))return e();const n=St(t),r=n.isBackward(),i=pd(n.anchor,r?-1:0),o=pd(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")}ks(St(t))}}}((()=>{let e=null;for(const t of l){if(!t.isAttached())continue;const s=Nl(t,ud);if(s){c(s);continue}if(ko(t)){if(!t.isInline())continue;if(ud(t)){if(!(gd(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();ud(l)&&l.is(e)?l.append(t):(e=cd(n,{rel:o,target:r,title:i}),t.insertAfter(e),e.append(t))}}))}const md=/^\+?[0-9\s()-]{5,}$/;function yd(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:md.test(e)?`tel:${e}`:`https://${e}`}function bd(e,t){const n=as(t)?t.body.childNodes:t.childNodes;let r=[];const i=[];for(const t of n)if(!Cd.has(t.nodeName)){const n=Sd(t,e,i,!1);null!==n&&(r=r.concat(n))}return function(e){for(const t of e)t.getNextSibling()instanceof Po&&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 _d(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=ws().getChildren();for(let i=0;i<r.length;i++)xd(e,r[i],n,t);return n.innerHTML}function xd(e,t,n,r=null){let i=null===r||t.isSelected(r);const o=ko(t)&&t.excludeFromCopy("html");let s=t;null!==r&&gi(t)&&(s=Da(r,t,"clone"));const l=ko(s)?s.getChildren():[],a=Jo(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=xd(e,o,h,r);!i&&ko(t)&&s&&t.extractWithChild(o,r,"html")&&(i=!0)}if(i&&!o){if((gl(u)||fl(u))&&u.append(h),n.append(u),d){const e=d.call(s,u);e&&(fl(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(h);return i}const Cd=new Set(["STYLE","SCRIPT"]);function Sd(e,t,n,r,i=new Map,o){let s=[];if(Cd.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||!rl(l))&&(null!=l&&Pi(l)||r);for(let e=0;e<d.length;e++)h.push(...Sd(d[e],t,n,g,new Map(i),l));return null!=u&&(h=u(h)),yl(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 Po;return n.push(e),e}:Bo)),null==l?h.length>0?s=s.concat(h):yl(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(ml(e.nextSibling)&&ml(e.previousSibling))}(e)&&(s=s.concat(Zr())):ko(l)&&l.append(...h),s}function wd(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 vd(e,t=$i()){return null==t&&wd(166),wi(t)&&t.isCollapsed()||0===t.getNodes().length?"":_d(e,t)}function kd(e,t){const n=e.getData("text/plain")||e.getData("text/uri-list");null!=n&&t.insertRawText(n)}function Ed(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 Td(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=po(e[n]);gi(r)&&Ba(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 Td(n,bd(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 Td(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=sa(e.anchor,"previous");if(n)if(Dl(n))t=n.origin;else{const e=Ql(n,ql(ws(),"next").getFlipped());for(const n of e){if(gi(n.origin)){t=n.origin;break}if(ko(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 Nd(e,t,n,r=[]){let i=null===t||n.isSelected(t);const o=ko(n)&&n.excludeFromCopy("html");let s=n;null!==t&&gi(s)&&(s=Da(t,s,"clone"));const l=ko(s)?s.getChildren():[],a=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&wd(58,n.name),ko(e)){const e=t.children;Array.isArray(e)||wd(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=Nd(e,t,o,a.children);!i&&ko(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 Ad=null;async function Ld(e,t,n){if(null!==Ad)return!1;if(null!==t)return new Promise(((r,i)=>{e.update((()=>{r(Od(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,o=i.document,s=ul(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=>(Dc(r,ClipboardEvent)&&(s(),null!==Ad&&(i.clearTimeout(Ad),Ad=null),t(Od(e,r,n))),!0)),4);Ad=i.setTimeout((()=>{s(),Ad=null,t(!1)}),50),o.execCommand("copy"),l.remove()}))}function Od(e,t,n){if(void 0===n){const t=ul(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&&!es(e,i,o))return!1;n=Id(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of Fd)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 Fd=[["text/html",vd],["application/x-lexical-editor",function(e,t=$i()){return null==t&&wd(166),wi(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=ws().getChildren();for(let i=0;i<r.length;i++)Nd(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function Id(e=$i()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=_l();for(const[r,i]of Fd){const o=i(n,e);null!==o&&(t[r]=o)}}return t}const Rd={build:(e,t,n)=>hu(t),config:{disabled:"undefined"==typeof window},name:"@lexical/dragon",register:(e,t,n)=>du((()=>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)))},Pd="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Md=Pd&&"documentMode"in document?document.documentMode:null,Dd=Pd&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Bd=!(!Pd||!("InputEvent"in window)||Md)&&"getTargetRanges"in new window.InputEvent("input"),zd=Pd&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),$d=Pd&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Hd=Pd&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Kd=Pd&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Dd&&!Hd;function Ud(e,t){t.update((()=>{if(null!==e){const n=Dc(e,KeyboardEvent)?null:e.clipboardData,r=$i();if(null!==r&&!r.isCollapsed()&&null!=n){e.preventDefault();const i=vd(t);null!==i&&n.setData("text/html",i),n.setData("text/plain",r.getTextContent())}}}))}function Wd(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 Vd="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,jd=Vd&&"documentMode"in document?document.documentMode:null,qd=Vd&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Zd=!(!Vd||!("InputEvent"in window)||jd)&&"getTargetRanges"in new window.InputEvent("input"),Gd=Vd&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Jd=Vd&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Yd=Vd&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xd=Vd&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&qd&&!Yd,Qd=nn("DRAG_DROP_PASTE_FILE");let eh=class e extends vo{static getType(){return"quote"}static clone(t){return new e(t.__key)}createDOM(e){const t=document.createElement("blockquote");return Ea(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:sh,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(gl(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 th().updateFromJSON(e)}insertNewAfter(e,t){const n=Bo(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=Bo();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function th(){return ol(new eh)}function nh(e){return e instanceof eh}let rh=class e extends vo{__tag;static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e="h1",t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){const t=this.getWritable();return t.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){Ea(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:oh,priority:0}),h2:e=>({conversion:oh,priority:0}),h3:e=>({conversion:oh,priority:0}),h4:e=>({conversion:oh,priority:0}),h5:e=>({conversion:oh,priority:0}),h6:e=>({conversion:oh,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&ih(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>ih(e)?{conversion:e=>({node:lh("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(gl(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 lh(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?Bo():lh(this.getTag()),o=this.getDirection();if(i.setDirection(o),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=Bo();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?Bo():lh(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function ih(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function oh(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=lh(t),null!==e.style&&(vl(e,n),n.setFormat(e.style.textAlign))),{node:n}}function sh(e){const t=th();return null!==e.style&&(t.setFormat(e.style.textAlign),vl(e,t)),{node:t}}function lh(e="h1"){return ol(new rh(e))}function ah(e){return e instanceof rh}function ch(e){let t=null;if(Dc(e,DragEvent)?t=e.dataTransfer:Dc(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 uh(e){return No(xs(e))}function dh(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function hh(e){return Na(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)Ed(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=Nl(t,(e=>ko(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)),Zi([e]),!0}),0),e.registerCommand(Mn,(()=>Bc((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(Dn,(()=>Bc((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=Ws(t.focus,!0);if(!e.shiftKey&&No(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===ws().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Ws(t.focus,!1);if(!e.shiftKey&&No(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(),Ma(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!wi(t))return!1;if(ja(t,!0)){const n=e.shiftKey;return e.preventDefault(),Za(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(),Ma(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!wi(t))return!1;const n=e.shiftKey;return!!ja(t,!1)&&(e.preventDefault(),Za(t,n,!1),!0)}),0),e.registerCommand(On,(t=>{if(uh(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(Lo(n))return!1;const r=Rc(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(Dn,void 0);if(Jd&&"ko-KR"===navigator.language)return!1}else if(!ki(n))return!1;return t.preventDefault(),e.dispatchCommand(dn,!0)}),0),e.registerCommand(In,(t=>{if(uh(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(dh(n),null!==t){if((Jd||Gd||Xd)&&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]=ch(t);if(n.length>0){const r=Wd(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,o=xs(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")}ks(St(e))}e.dispatchCommand(Qd,n)}return t.preventDefault(),!0}return!!wi($i())}),0),e.registerCommand($n,(e=>{const[t]=ch(e),n=$i();return!(t&&!wi(n))}),0),e.registerCommand(Hn,(e=>{const[t]=ch(e),n=$i();if(t&&!wi(n))return!1;const r=Wd(e.clientX,e.clientY);if(null!==r){No(xs(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Vn,(()=>($s(),!0)),0),e.registerCommand(Un,(t=>(Ld(e,Dc(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Wn,(t=>(async function(e,t){await Ld(t,Dc(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]=ch(t);return n.length>0&&!r?(e.dispatchCommand(Qd,n),!0):(!pl(t.target)||!Qo(t.target))&&(null!==$i()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=$i(),r=Dc(e,InputEvent)||Dc(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Ed(r,n,t)}),{tag:zr})}(t,e),!0))}),0),e.registerCommand(Ln,(e=>{const t=$i();return wi(t)&&dh(t),!1}),0),e.registerCommand(Rn,(e=>{const t=$i();return wi(t)&&dh(t),!1}),0))}const gh={conflictsWith:["@lexical/plain-text"],dependencies:[Rd],name:"@lexical/rich-text",nodes:()=>[rh,eh],register:hh};function ph(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 fh(e,t){let n=e;for(let r=Ul(e,t);r&&(Rh(r.origin)||yi(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function mh(e){return fh(e,"previous")}function yh(e){return fh(e,"next")}function bh(e,t){for(const n of e.childNodes){if(gl(n)&&n.tagName===t)return!0;bh(n,t)}return!1}const _h="data-language",xh="data-highlight-language",Ch="data-theme";let Sh=class e extends vo{__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");Ea(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(_h,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(xh,n));const r=this.getTheme();r&&t.setAttribute(Ch,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(_h,r):i&&t.removeAttribute(_h);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute(xh,r):t.removeAttribute(xh):o&&r&&t.setAttribute(xh,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(Ch,s):l&&t.removeAttribute(Ch);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");Ea(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(_h,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(xh,n));const r=this.getTheme();r&&t.setAttribute(Ch,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)||bh(e,"BR"))?{conversion:kh,priority:1}:null,div:()=>({conversion:Eh,priority:1}),pre:()=>({conversion:kh,priority:0}),table:e=>Lh(e)?{conversion:Th,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&Lh(n)?{conversion:Nh,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&Lh(t)?{conversion:Nh,priority:3}:null}}}static importJSON(e){return wh().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=Bo();return this.insertAfter(e,t),e}const{anchor:i,focus:o}=e,s=(i.isBefore(o)?i:o).getNode();if(gi(s)){let e=mh(s);const t=[];for(;;)if(yi(e))t.push(mi()),e=e.getNextSibling();else{if(!Rh(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(Ih(" ".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(vh(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=Bo();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 wh(e,t){return function(e){const t=_l();return oo(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(Sh).setLanguage(e).setTheme(t)}function vh(e){return e instanceof Sh}function kh(e){return{node:wh(e.getAttribute(_h))}}function Eh(e){const t=e,n=Ah(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(Ah(t))return!0;t=t.parentElement}return!1}(t)?{node:n?wh():null}:{node:null}}function Th(){return{node:wh()}}function Nh(){return{node:null}}function Ah(e){return null!==e.style.fontFamily.match("monospace")}function Lh(e){return e.classList.contains("js-file-line-container")}let Oh=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)}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}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 Ea(t,Fh(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=Fh(n.theme,e.__highlightType),o=Fh(n.theme,this.__highlightType);return i!==o&&(i&&Ta(t,i),o&&Ea(t,o)),r}static importJSON(e){return Ih().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 wh()}};function Fh(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Ih(e="",t){return ol(new Oh(e,t))}function Rh(e){return e instanceof Oh}var Ph;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:/[;[\]()`,.]/},(Ph=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:Ph},boolean:Ph.boolean,variable:Ph.variable};var Mh;Mh||(Mh=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://,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 Dh;Dh||(Dh=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 Bh;Bh||(Bh=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 zh;zh||(zh=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 $h;function Hh(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.`)}$h||($h=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(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 Kh=globalThis.Prism||window.Prism,Uh={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function Wh(e){return"string"==typeof e?e:Array.isArray(e)?e.map(Wh).join(""):Wh(e.content)}function Vh(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent();let i=Kh.tokenize(r,Kh.languages[n?"diff":t]);return n&&(i=function(e,t){const n=t,r=Kh.languages[n],i={tokens:e},o=Kh.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 Kh.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=Kh.tokenize(Wh(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])),jh(i)}function jh(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(Ih(i,t))}}else{const{content:e,alias:t}=r;"string"==typeof e?n.push(...jh([e],"prefix"===r.type&&"string"==typeof t?t:r.type)):Array.isArray(e)&&n.push(...jh(e,"unchanged"===r.type?void 0:r.type))}return n}const qh={$tokenize(e,t){return Vh(e,t||this.defaultLanguage)},defaultLanguage:"javascript",tokenize(e,t){return Kh.tokenize(e,Kh.languages[t||""]||Kh.languages[this.defaultLanguage])}};function Zh(e,t,n){const r=e.getParent();vh(r)?Yh(r,t,n):Rh(e)&&e.replace(hi(e.__text))}function Gh(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 Jh=new Set;function Yh(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&&Kh.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),Jh.has(i)||(Jh.add(i),t.update((()=>{!function(e,t){const n=ys(e);if(!vh(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=ys(r);if(!vh(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&&Xh(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++,!Xh(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:()=>{Jh.delete(i)},skipTransforms:!0}))}function Xh(e,t){return Rh(e)&&Rh(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||yi(e)&&yi(t)||Gr(e)&&Gr(t)}function Qh(e){if(!wi(e))return!1;const t=e.anchor.getNode(),n=vh(t)?t:t.getParent(),r=e.focus.getNode(),i=vh(r)?r:r.getParent();return vh(n)&&n.is(i)}function eg(e){const t=e.getNodes(),n=[];if(1===t.length&&vh(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];Rh(i)||yi(i)||Gr(i)||Hh(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 tg(e){const t=$i();if(!wi(t)||!Qh(t))return!1;const n=eg(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]),aa(ba(Ql(Wl(e,"next",0),fa(Ul(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=mh(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 ng(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(!Qh(n)||!Rh(l)&&!yi(l)||!Rh(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=mh(l),d=yh(a)):(u=mh(a),d=yh(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(!Rh(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=Rh(p)||yi(p)||Gr(p)?c?mh(p):yh(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 rg(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(!Qh(n)||!Rh(o)&&!yi(o)||!Rh(s)&&!yi(s))return!1;const a=s;if("rtl"===function(e){const t=mh(e),n=yh(e);let r=t;for(;null!==r;){if(Rh(r)){const e=is(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(ko(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(Rh(i)||yi(i)||Gr(i)||ph(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];Rh(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let l=null;if(t<e.getTextContentSize())Rh(e)&&(l=e.getTextContent()[t]);else{const t=e.getNextSibling();Rh(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(!Rh(n)||r===o){if(n=n.getNextSibling(),null===n||Gr(n))return null;Rh(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if(Rh(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=yh(e);return Gr(t)&&ph(168),t})(a).select();return t.preventDefault(),t.stopPropagation(),!0}const ig={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"},og=function(e){return Uh[e]||e},sg=function(e,t){if(!e.hasNodes([Sh,Oh]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=qh);const n=[];return!0!==e._headless&&n.push(e.registerMutationListener(Sh,(t=>{e.getEditorState().read((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=ys(n);null!==t&&Gh(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(Sh,(n=>Yh(n,e,t))),e.registerNodeTransform(ri,(n=>Zh(n,e,t))),e.registerNodeTransform(Oh,(n=>Zh(n,e,t))),e.registerCommand(Rn,(t=>{const n=function(e){const t=$i();if(!wi(t)||!Qh(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=eg(t);if(1!==s.length)return n;const l=s[0];let a,c;0===l.length&&Hh(285),t.isBackward()?(a=o,c=i):(a=i,c=o);const u=mh(l[0]),d=yh(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,(()=>!!Qh($i())&&(Zi([mi()]),!0)),1),e.registerCommand(Mn,(e=>tg(Mn)),1),e.registerCommand(Dn,(e=>tg(Dn)),1),e.registerCommand(Tn,(e=>{const t=$i();if(!wi(t)||!Qh(t))return!1;const n=ws().getFirstDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&ng(Tn,e)}),1),e.registerCommand(Nn,(e=>{const t=$i();if(!wi(t)||!Qh(t))return!1;const n=ws().getLastDescendant(),{anchor:r}=t,i=r.getNode();return(!n||!i||n.getKey()!==i.getKey())&&ng(Nn,e)}),1),e.registerCommand(En,(e=>rg(En,e)),1),e.registerCommand(vn,(e=>rg(vn,e)),1)),Na(...n)};function lg(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 ag=/[!-/:-@[-`{-~\s]/;function cg(e){return e.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,((e,t)=>String.fromCodePoint(Number(t))))}function ug(e){return gi(e)&&!e.hasFormat("code")}function dg(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 hg=lt("mdListMarker",{parse:e=>"string"==typeof e&&/^[-*+]$/.test(e)?e:"-",resetOnCopyNode:!0}),gg=lt("mdCodeFence",{parse:e=>"string"==typeof e&&/^`{3,}$/.test(e)?e:"```",resetOnCopyNode:!0}),pg=e=>(t,n,r,i)=>{const o=e(r);o.append(...n),t.replace(o),i||o.select(0,0)},fg=e=>(t,n,r,i)=>{const o=t.getPreviousSibling(),s=t.getNextSibling(),l=ju("check"===e?"x"===r[3]:void 0),a=r[0].trim()[0],c="bullet"!==e&&"check"!==e||a!==hg.parse(a)?void 0:a;if(ed(s)&&s.getListType()===e){c&&ct(s,hg,c);const e=s.getFirstChild();null!==e?e.insertBefore(l):s.append(l),t.remove()}else if(ed(o)&&o.getListType()===e)c&&ct(o,hg,c),o.append(l),t.remove();else{const n=Qu(e,"number"===e?Number(r[2]):void 0);c&&ct(n,hg,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)},mg=(e,t,n)=>{const r=[],i=e.getChildren();let o=0;for(const s of i)if(qu(s)){if(1===s.getChildrenSize()){const e=s.getFirstChild();if(ed(e)){r.push(mg(e,t,n+1));continue}}const i=" ".repeat(4*n),l=e.getListType(),a=at(e,hg),c="number"===l?`${e.getStart()+o}. `:"check"===l?`${a} [${s.getChecked()?"x":" "}] `:a+" ";r.push(i+c+t(s)),o++}return r.join("\n")},yg={dependencies:[rh],export:(e,t)=>{if(!ah(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:pg((e=>lh("h"+e[1].length))),type:"element"},bg={dependencies:[eh],export:(e,t)=>{if(!nh(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(nh(n))return n.splice(n.getChildrenSize(),0,[Zr(),...t]),void e.remove()}const i=th();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},_g={dependencies:[Sh],export:e=>{if(!vh(e))return null;const t=e.getTextContent();let n=at(e,gg);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]="",_g.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),_g.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),_g.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=wh(c),l=i[0]):(s=wh(c),l=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{for(s=wh(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,gg,a);const t=hi(l);s.append(t),e.append(s)}else t&&pg((e=>wh(e?e[2]:void 0)))(e,t,n,o)},type:"multiline-element"},xg={dependencies:[Zu,Uu],export:(e,t)=>ed(e)?mg(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:fg("bullet"),type:"element"},Cg={dependencies:[Zu,Uu],export:(e,t)=>ed(e)?mg(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:fg("number"),type:"element"},Sg={dependencies:[ld],export:(e,t,n)=>{if(!ud(e)||gd(e))return null;const r=t(e);let i=e.getTitle();return null!=i&&(i=i.replace(/([\\"])/g,"\\$1")),i?`[${r}](${e.getURL()} "${i}")`:`[${r}](${e.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{if(Nl(e,ud))return;const[,n,r,i]=t,o=cd(null!=r?cg(r):void 0,{title:null!=i?cg(i):void 0}),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"},wg=[...[yg,bg,xg,Cg],...[_g],...[{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"}],...[Sg]];function vg(e,t,n,r,i){if(!rl(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 kg(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(Eg(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function Eg(e,t,n,r,i){for(let o=0;o<i;o++)if(e[t+o]!==n[r+o])return!1;return!0}function Tg(e,t=wg){const n=function(e){const t=lg(e,(e=>e.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=lg(n.textFormat,(({tag:e})=>e[e.length-1])),i=lg(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)||dg(173,n.getType())}}const o=(e,t,o)=>{(function(e,t,n,r){if(!rl(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)||vg(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&&!Eg(r,l,n,0,s))continue;if(" "===r[l-1])continue;const a=r[i+1];if(!1===t.intraword&&a&&!ag.test(a))continue;const c=e;let u=c,d=kg(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=kg(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&&!ag.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();ks(_);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 Na(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(!ug(u))return;const e=u.getParent();null===e||vh(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)||!ug(i))return!1;const o=i.getParent();return null!==o&&!vh(o)&&(r===i.getTextContent().length&&!!vg(o,i,r,n.multilineElement,!0)&&(null!==e&&e.preventDefault(),!0))}),1))}function Ng(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 Ag(e){return(new DOMParser).parseFromString(e,"text/html")}function Lg(e){return e.startsWith("image/")&&!e.includes("svg")}function Og(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Fg(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function Ig(e=""){return Ag(e).body.textContent.trim()}class Rg extends To{static getType(){return"horizontal_divider"}static clone(e){return new Rg(e.__key)}static importJSON(e){return new Rg}static importDOM(){return{hr:e=>({conversion:()=>({node:new Rg}),priority:1})}}constructor(e){super(e)}createDOM(){const e=Ng("figure",{className:"horizontal-divider"}),t=Ng("hr");e.appendChild(t);const n=Ng("lexxy-node-delete-button");return e.appendChild(n),e}updateDOM(){return!0}getTextContent(){return"┄\n\n"}isInline(){return!1}exportDOM(){return{element:Ng("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Pg={dependencies:[Rg],export:e=>e instanceof Rg?"---":null,regExpStart:/^-{3,}\s?$/,replace:(e,t,n,r,i,o)=>{const s=new Rg;if(e.replace(s),!o){const e=Bo();s.insertAfter(e),e.select()}},type:"multiline-element"},Mg=/[^\w]/;function Dg(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();ks(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,n){let r=n(),i=0,o=r,s=0,l=null;return(a,c,u,d,h,g)=>{const p=n();if(g.has(Wr)&&(o=r,s=i,l=a),g.has(Dr))return i=0,r=p,2;g.has(Vr)&&l&&(r=o,i=s,a=l);const f=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||Lo(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}(a,c,d,h,e.isComposing()),m=(()=>{const n=null===u||u.editor===e,o=g.has("history-push");if(!o&&n&&g.has(Br))return 0;if(1===f)return 2;if(null===a)return 1;const s=c._selection;if(!(d.size>0||h.size>0))return null!==s?0:2;const l="number"==typeof t?t:t.peek();return!1===o&&0!==f&&f===i&&p<r+l&&n||1===d.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(d)[0],a,c)?0:1})();return r=p,i=f,m}}function zg(e){e.undoStack=[],e.redoStack=[],e.current=null}function $g(e,t,n,r=Date.now){const i=Bg(e,n,r);return Na(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,(()=>(zg(t),!1)),0),e.registerCommand(qn,(()=>(zg(t),e.dispatchCommand(Zn,!1),e.dispatchCommand(Gn,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:r,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=i(r,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}})))}function Hg(){return{current:null,redoStack:[],undoStack:[]}}Date.now;var Kg={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"}};const Ug=/^(\d+(?:\.\d+)?)px$/,Wg=3,Vg=2,jg=0,qg=1;let Zg=class e extends vo{__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,this.__colSpan=e.__colSpan,this.__headerState=e.__headerState,this.__width=e.__width}static importDOM(){return{td:e=>({conversion:Jg,priority:0}),th:e=>({conversion:Jg,priority:0})}}static importJSON(e){return Yg().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=jg,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),Gg(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),Ea(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(gl(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(),...Gg(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=Wg){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!==jg}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 Gg(e){return"middle"===e||"bottom"===e}function Jg(e){const t=e,n=e.nodeName.toLowerCase();let r;Ug.test(t.style.width)&&(r=parseFloat(t.style.width));let i=jg;if("th"===n){i="col"===t.getAttribute("scope")?Vg:qg}const o=Yg(i,t.colSpan,r);o.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;""!==s&&(o.__backgroundColor=s);const l=t.style.verticalAlign;Gg(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)tl(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=Bo().append(i),t.push(n))):(t.push(i),r(),n=null);return r(),0===t.length&&t.push(Bo()),t},node:o}}function Yg(e=jg,t=1,n){return ol(new Zg(e,t,n))}function Xg(e){return e instanceof Zg}const Qg=nn("INSERT_TABLE_COMMAND");function ep(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 tp=class e extends vo{__height;static getType(){return"tablerow"}static clone(t){return new e(t.__height,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__height=e.__height}static importDOM(){return{tr:e=>({conversion:np,priority:0})}}static importJSON(e){return rp().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`),Ea(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 np(e){const t=e;let n;return Ug.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>Kc(e,Xg),node:rp(n)}}function rp(e){return ol(new tp(e))}function ip(e){return e instanceof tp}const op="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,sp=op&&"documentMode"in document?document.documentMode:null,lp=op&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function ap(e){const t=Nl(e,(e=>Xg(e)));return Xg(t)?t:null}function cp(e){const t=Nl(e,(e=>ip(e)));if(ip(t))return t;throw new Error("Expected table cell to be inside of table row.")}function up(e){const t=Nl(e,(e=>Cf(e)));if(Cf(t))return t;throw new Error("Expected table cell to be inside of table.")}op&&"InputEvent"in window&&!sp&&new window.InputEvent("input");const dp=(e,t)=>e===Wg||e===t?t:jg;function hp(e=!0){const t=$i();wi(t)||Np(t)||ep(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=wp(n),[o,,s]=wp(r),[,l,a]=Cp(s,o,i),{startRow:c}=a,{startRow:u}=l;return e?gp(c+i.__rowSpan>u+o.__rowSpan?i:o,!0):gp(u<c?o:i,!1)}function gp(e,t=!0){const[,,n]=wp(e),[r,i]=Cp(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=rp();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=dp(t,Vg);a.append(Yg(n).append(Bo()))}else n.setRowSpan(n.__rowSpan+1)}const c=n.getChildAtIndex(t);ip(c)||ep(256),c.insertAfter(a),l=a}else{const e=s,t=r[e],i=rp();for(let n=0;n<o;n++){const{cell:r,startRow:o}=t[n];if(o===e){const e=t[n].cell.__headerState,r=dp(e,Vg);i.append(Yg(r).append(Bo()))}else r.setRowSpan(r.__rowSpan+1)}const a=n.getChildAtIndex(e);ip(a)||ep(257),a.insertBefore(i),l=i}return l}function pp(e=!0){const t=$i();wi(t)||Np(t)||ep(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[i]=wp(n),[o,,s]=wp(r),[,l,a]=Cp(s,o,i),{startColumn:c}=a,{startColumn:u}=l;return e?fp(c+i.__colSpan>u+o.__colSpan?i:o,!0):fp(u<c?o:i,!1)}function fp(e,t=!0,n=!0){const[,,r]=wp(e),[i,o]=Cp(r,e,e),s=i.length,{startColumn:l}=o,a=t?l+e.__colSpan-1:l-1,c=r.getFirstChild();ip(c)||ep(120);let u=null;function d(e=jg){const t=Yg(e).append(Bo());return null===u&&(u=t),t}let h=c;e:for(let e=0;e<s;e++){if(0!==e){const e=h.getNextSibling();ip(e)||ep(121),h=e}const t=i[e],n=t[a<0?0:a].cell.__headerState,r=dp(n,qg);if(a<0){yp(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&&mp(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 mp(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function yp(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function bp(e){if(0===e.length)return null;const t=up(e[0]),[n]=Sp(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),_p(i)||d.append(...i.getChildren()),i.remove())}return 0===d.getChildrenSize()&&d.append(Bo()),d}function _p(e){if(1!==e.getChildrenSize())return!1;const t=e.getFirstChildOrThrow();return!(!zo(t)||!t.isEmpty())}function xp(e){const[t,n,r]=wp(e),i=t.__colSpan,o=t.__rowSpan;if(1===i&&1===o)return;const[s,l]=Cp(r,t,t),{startColumn:a,startRow:c}=l,u=t.__headerState&Vg,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&qg,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(Yg(d[e]|g[0]).append(Bo()));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(),ip(e)||ep(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--)yp(e,Yg(d[n]|g[t]).append(Bo()));else for(let e=i-1;e>=0;e--)l.insertAfter(Yg(d[e]|g[t]).append(Bo()))}t.setRowSpan(1)}}function Cp(e,t,n){const[r,i,o]=Sp(e,t,n);return null===i&&ep(207),null===o&&ep(208),[r,i,o]}function Sp(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];ip(r)||ep(209);const a=s(e);for(let c=r.getFirstChild(),u=0;null!=c;c=c.getNextSibling()){for(Xg(c)||ep(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 wp(e){let t;if(e instanceof Zg)t=e;else if("__type"in e){const n=Nl(e,Xg);Xg(n)||ep(148),t=n}else{const n=Nl(e.getNode(),Xg);Xg(n)||ep(148),t=n}const n=t.getParent();ip(n)||ep(149);const r=n.getParent();return Cf(r)||ep(210),[t,n,r]}function vp(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 kp(e){const[t,,n]=wp(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 Ep(e){const[[t,n,r,i],[o,s,l,a]]=["anchor","focus"].map((t=>{const n=e[t].getNode(),r=Nl(n,Xg);Xg(r)||ep(238,t,n.getKey(),n.getType());const i=r.getParent();ip(i)||ep(239,t);const o=i.getParent();return Cf(o)||ep(240,t),[n,r,i,o]}));return i.is(a)||ep(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:i,focusCell:s,focusNode:o,focusRow:l,focusTable:a}}class Tp{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=ys(this.tableKey),t=ys(this.anchor.key),n=ys(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 Np(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 Tp(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(Xg).forEach((e=>{const n=e.getFirstChild();zo(n)&&(t|=n.getTextFormat())}));return 0!==(t&Ke[e])}insertNodes(e){const t=this.focus.getNode();ko(t)||ep(151),St(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Ep(this),n=kp(e);null===n&&ep(153);const r=kp(t);null===r&&ep(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}=Ep(this),i=r.getParents()[1];if(i!==t){if(t.isParentOf(r)){const e=i.getParent();null==e&&ep(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{const e=t.getParent();null==e&&ep(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}const[o,s,l]=Cp(t,n,r),{minColumn:a,maxColumn:c,minRow:u,maxRow:d}=vp(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();ip(r)||ep(160),r!==g&&(h.set(r.getKey(),r),g=r),h.has(n.getKey())||Lp(n,(e=>{h.set(e.getKey(),e)}))}const p=Array.from(h.values());return io()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter((e=>Xg(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 Np(e){return e instanceof Tp}function Ap(e,t,n){e.getKey(),t.getKey(),n.getKey();const r=$i(),i=Np(r)?r.clone():function(){const e=_i("root",0,"element"),t=_i("root",0,"element");return new Tp("root",e,t)}();return i.set(e.getKey(),t.getKey(),n.getKey()),i}function Lp(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)&&ko(r)&&n.push(r.getChildren())}}function Op(e,t=_l()){const n=ys(e);Cf(n)||ep(231,e);const r=Mp(n,t.getElementByKey(e));return null===r&&ep(232,e),{tableElement:r,tableNode:n}}class Fp{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return null!==e&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){const{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}}class Ip{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;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.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return Op(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=qp(n,r)}),{editor:this.editor})}));this.editor.getEditorState().read((()=>{const{tableNode:t,tableElement:n}=this.$lookup();this.table=qp(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(e=!0){const t=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:n,tableElement:r}=this.$lookup();Zp(t,qp(n,r),null),e&&null!==$i()&&(ks(null),t.dispatchCommand(rn,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();Ta(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();Ea(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(null!==e){e.tableKey!==this.tableNodeKey&&ep(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Zp(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(null!==this.anchorCell&&null!==this.focusCell){const e=ul(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=hf(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=Ap(r,t,e),ks(this.tableSelection),n.dispatchCommand(rn,void 0),Zp(n,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?ys(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return null===e&&ep(234),e}$getFocusTableCell(){return this.focusCellNodeKey?ys(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return null===e&&ep(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=hf(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=Ap(t,n,n),this.anchorCellNodeKey=e}}$formatCells(e){const t=$i();Np(t)||ep(236);const n=Di(),r=n.anchor,i=n.focus,o=t.getNodes().filter(Xg);o.length>0||ep(237);const s=o[0].getFirstChild(),l=zo(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)})),ks(t),this.editor.dispatchCommand(rn,void 0)}$clearText(){const{editor:e}=this,t=ys(this.tableNodeKey);if(!Cf(t))throw new Error("Expected TableNode.");const n=$i();Np(n)||ep(253);const r=n.getNodes().filter(Xg),i=t.getFirstChild(),o=t.getLastChild();if(r.length>0&&null!==i&&null!==o&&ip(i)&&ip(o)&&r[0]===i.getFirstChild()&&r[r.length-1]===o.getLastChild()){t.selectPrevious();const n=t.getParent();return t.remove(),void(Lo(n)&&n.isEmpty()&&e.dispatchCommand(gn,void 0))}r.forEach((e=>{if(ko(e)){const t=Bo(),n=hi();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),Zp(e,this.table,null),ks(null),e.dispatchCommand(rn,void 0)}}const Rp="__lexicalTableSelection";function Pp(e){return gl(e)&&"TABLE"===e.nodeName}function Mp(e,t){if(!t)return t;const n=Pp(t)?t:e.getDOMSlot(t).element;return"TABLE"!==n.nodeName&&ep(245,t.nodeName),n}function Dp(e){return e._window}function Bp(e,t){for(let n=t,r=null;null!==n;n=n.getParent()){if(e.is(n))return r;Xg(n)&&(r=n)}return null}const zp=[[Nn,"down"],[Tn,"up"],[kn,"backward"],[wn,"forward"]],$p=[yn,bn,dn],Hp=[On,In];function Kp(e,t){const n=$i(),r=Hi(),i=e.getAndClearNextFocus();if(null!==i){const{tableKey:t,focusCell:r}=i,o=e.observers.get(t);o||ep(335,t);const[s]=o;if(Np(n)&&n.tableKey===s.tableNodeKey)return(r.x!==s.focusX||r.y!==s.focusY)&&(s.$setFocusCellForSelection(r),!0);if(null!==s.anchorCell&&null!==s.anchorCellNodeKey&&r.elem!==s.anchorCell.elem&&null!==s.tableSelection)return s.$setFocusCellForSelection(r,!0),!0}const o=e.getAndClearShouldCheckSelectionForTable();if(o&&wi(r)&&wi(n)&&n.isCollapsed()){const e=ll(o),t=n.anchor.getNode(),r=e.getFirstChild(),i=of(t);if(null!==i&&ip(r)){const t=r.getFirstChild();if(Xg(t)&&e.is(Nl(i,(n=>n.is(e)||n.is(t)))))return t.selectStart(),!0}}Np(n)&&function(e,t){const n=Dp(e),r=Hi();if(!t.is(r))return;const i=ll(t.tableKey),o=ul(n);if(o&&o.anchorNode&&o.focusNode){const n=xs(o.focusNode),r=n&&!i.isParentOf(n),s=xs(o.anchorNode),l=s&&i.isParentOf(s);if(r&&l&&o.rangeCount>0){const n=function(e,t){return zi(null,e,t,null)}(o,e);n&&(n.anchor.set(i.getKey(),t.isBackward()?i.getChildrenSize():0,"element"),o.removeAllRanges(),ks(n))}}}(t,n),wi(n)&&function(e,t){const n=Hi(),{anchor:r,focus:i}=e,o=r.getNode(),s=i.getNode(),l=of(o),a=of(s),c=l?sf(l):null,u=a?sf(a):null,d=e.isBackward(),h=l&&a&&c&&u&&c.is(u),g=u&&(!c||c.isParentOf(u)),p=c&&(!u||u.isParentOf(c));if(g){const t=e.clone(),[n]=Cp(u,a,a),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.focus.set(d?r.getKey():i.getKey(),d?0:i.getChildrenSize(),"element"),ks(t)}else if(p){const t=e.clone(),[n]=Cp(c,l,l),r=n[0][0].cell,i=n[n.length-1].at(-1).cell;t.anchor.set(d?i.getKey():r.getKey(),d?i.getChildrenSize():0,"element"),ks(t)}else if(h){const r=t.observers.get(c.getKey());r||ep(335,c.getKey());const[i]=r;if(l.is(a)||(i.$setAnchorCellForSelection(df(i,l)),i.$setFocusCellForSelection(df(i,a),!0)),"touch"===i.pointerType&&i.isSelecting&&e.isCollapsed()&&wi(n)&&n.isCollapsed()){const e=of(n.anchor.getNode());e&&!e.is(a)&&(i.$setAnchorCellForSelection(df(i,e)),i.$setFocusCellForSelection(df(i,a),!0),i.pointerType=null)}}}(n,e);const s=e.observers.entries().map((([e,[t]])=>({tableNode:ll(e),tableObserver:t}))).toArray();for(const{tableNode:e,tableObserver:n}of s)Up(t,e,n);return!1}function Up(e,t,n){const r=$i(),i=Hi();r&&!r.is(i)&&(Np(r)||Np(i))&&n.tableSelection&&!n.tableSelection.is(i)&&(Np(r)&&r.tableKey===n.tableNodeKey?n.$updateTableTableSelection(r):!Np(r)&&Np(i)&&i.tableKey===n.tableNodeKey&&n.$updateTableTableSelection(null)),n.hasHijackedSelectionStyles&&!t.isSelected()?function(e,t){t.$enableHighlightStyle(),Gp(t.table,(t=>{const n=t.elem;t.highlighted=!1,rf(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(e,n):!n.hasHijackedSelectionStyles&&t.isSelected()&&function(e,t){t.$disableHighlightStyle(),Gp(t.table,(t=>{t.highlighted=!0,nf(e,t)}))}(e,n)}function Wp(e){return e[Rp]||null}function Vp(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 jp(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 qp(e,t){const n=[],r={columns:0,domRows:n,rows:0};let i=Mp(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 Zp(e,t,n){const r=new Set(n?n.getNodes():[]);Gp(t,((t,n)=>{const i=t.elem;r.has(n)?(t.highlighted=!0,nf(e,t)):(t.highlighted=!1,rf(e,t),i.getAttribute("style")||i.removeAttribute("style"))}))}function Gp(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=xs(i.elem);null!==o&&t(i,o,{x:n,y:e})}}}const Jp=(e,t,n,r,i)=>{const o="forward"===i;switch(i){case"backward":case"forward":return n!==(o?e.table.columns-1:0)?tf(t.getCellNodeFromCordsOrThrow(n+(o?1:-1),r,e.table),o):r!==(o?e.table.rows-1:0)?tf(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?tf(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1):t.selectPrevious(),!0;case"down":return r!==e.table.rows-1?tf(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0):t.selectNext(),!0;default:return!1}};function Yp(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 Xp([e,t]){return["minColumn"===e?"maxColumn":"minColumn","minRow"===t?"maxRow":"minRow"]}function Qp(e,t,[n,r]){const i=t[r],o=e[i];void 0===o&&ep(250,r,String(i));const s=t[n],l=o[s];return void 0===l&&ep(250,n,String(s)),l}function ef(e,t){if(wi(e)||Np(e)){const n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function tf(e,t){t?e.selectStart():e.selectEnd()}function nf(e,t){const n=t.elem,r=e._config.theme;Xg(xs(n))||ep(131),Ea(n,r.tableCellSelected)}function rf(e,t){const n=t.elem;Xg(xs(n))||ep(131);Ta(n,e._config.theme.tableCellSelected)}function of(e){const t=Nl(e,Xg);return Xg(t)?t:null}function sf(e){const t=Nl(e,Cf);return Cf(t)?t:null}function lf(e,t,n,r,i,o){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 s=$i();if(!ef(s,r)){if(wi(s)){if("backward"===n){if(s.focus.offset>0)return!1;const e=function(e){for(let t=e,n=e;null!==n;t=n,n=n.getParent())if(ko(n)){if(n!==t&&n.getFirstChild()!==t)return null;if(!n.isInline())return n}return null}(s.focus.getNode());if(!e)return!1;const n=e.getPreviousSibling();return!!Cf(n)&&(af(t),t.shiftKey?s.focus.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent(),"element"):n.selectEnd(),!0)}if(t.shiftKey&&("up"===n||"down"===n)){const e=s.focus.getNode();if(!s.isCollapsed()&&("up"===n&&!s.isBackward()||"down"===n&&s.isBackward())){let i=Nl(e,(e=>Cf(e)));if(Xg(i)&&(i=Nl(i,Cf)),i!==r)return!1;if(!i)return!1;const o="down"===n?i.getNextSibling():i.getPreviousSibling();if(!o)return!1;let l=0;"up"===n&&ko(o)&&(l=o.getChildrenSize());let a=o;if("up"===n&&ko(o)){a=o.getLastChild()||o,l=gi(a)?a.getTextContentSize():0}const c=s.clone();return c.focus.set(a.getKey(),l,gi(a)?"text":"element"),ks(c),af(t),!0}if(rl(e)){const e="up"===n?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(e&&null!==Bp(r,e)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=wp(e),[o]=wp(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=Nl(e,(e=>ko(e)&&!e.isInline()));if(Xg(r)&&(r=Nl(r,Cf)),!r)return!1;const o="down"===n?r.getNextSibling():r.getPreviousSibling();if(Cf(o)&&i.tableNodeKey===o.getKey()){const e=o.getFirstDescendant(),r=o.getLastDescendant();if(!e||!r)return!1;const[i]=wp(e),[l]=wp(r),a=s.clone();return a.focus.set(("up"===n?i:l).getKey(),"up"===n?0:l.getChildrenSize(),"element"),af(t),ks(a),!0}}}}return"down"===n&&mf(e)&&o.setShouldCheckSelectionForTable(r.getKey()),!1}if(wi(s)){if("backward"===n||"forward"===n)return function(e,t,n,r,i,o,s){const l=sa(n.focus,i?"previous":"next");if(ma(l))return!1;let a=l;for(const e of Yl(l).iterNodeCarets("shadowRoot")){if(!Bl(e)||!ko(e.origin))return!1;a=e}const c=a.getParentAtCaret();if(!Xg(c))return!1;const u=c,d=function(e){for(const t of Yl(e).iterNodeCarets("root")){const{origin:n}=t;if(Xg(n)){if(zl(t))return ql(n,e.direction)}else if(!ip(n))break}return null}(Ul(u,a.direction)),h=Nl(u,Cf);if(!h||!h.is(o))return!1;const g=e.getElementByKey(u.getKey()),p=Vp(g);if(!g||!p)return!1;const f=bf(e,h);if(s.table=f,d)if("extend"===r){const t=Vp(e.getElementByKey(d.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(t,!0)}else{const e=fa(d);la(n.anchor,e),la(n.focus,e)}else if("extend"===r)s.$setAnchorCellForSelection(p),s.$setFocusCellForSelection(p,!0);else{const e=function(e){const t=Zl(e);return zl(t)?fa(t):e}(Ul(h,l.direction));la(n.anchor,e),la(n.focus,e)}return af(t),!0}(e,t,s,t.shiftKey?"extend":"move","backward"===n,r,i);if(s.isCollapsed()){const{anchor:l,focus:a}=s,c=Nl(l.getNode(),Xg),u=Nl(a.getNode(),Xg);if(!Xg(c)||!c.is(u))return!1;const d=sf(c);if(d!==r&&null!=d){const r=Mp(d,e.getElementByKey(d.getKey()));if(null!=r)return i.table=qp(d,r),lf(e,t,n,d,i,o)}const h=e.getElementByKey(c.__key),g=e.getElementByKey(l.key);if(null==g||null==h)return!1;let p;if("element"===l.type)p=g.getBoundingClientRect();else{const t=ul(Dp(e));if(null===t||0===t.rangeCount)return!1;p=t.getRangeAt(0).getBoundingClientRect()}const f="up"===n?c.getFirstChild():c.getLastChild();if(null==f)return!1;const m=e.getElementByKey(f.__key);if(null==m)return!1;const y=m.getBoundingClientRect();if("up"===n?y.top>p.top-p.height:p.bottom+p.height>y.bottom){af(t);const e=r.getCordsFromCellNode(c,i.table);if(!t.shiftKey)return Jp(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(Np(s)){const{anchor:o,focus:l}=s,a=Nl(o.getNode(),Xg),c=Nl(l.getNode(),Xg),[u]=s.getNodes();Cf(u)||ep(251);const d=Mp(u,e.getElementByKey(u.getKey()));if(!Xg(a)||!Xg(c)||!Cf(u)||null==d)return!1;i.$updateTableTableSelection(s);const h=qp(u,d),g=r.getCordsFromCellNode(a,h),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,h);if(i.$setAnchorCellForSelection(p),af(t),t.shiftKey){const[e,t,o]=Cp(r,a,c);return function(e,t,n,r,i){const o=vp(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=Yp(e,t);return null===n&&ep(249,t.cell.getKey()),n}(o,n),[h,g]=Xp(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=vp(e,t,n),i=Yp(r,t);if(i)return[Qp(e,r,i),Qp(e,r,Xp(i))];const o=Yp(r,n);if(o)return[Qp(e,r,Xp(o)),Qp(e,r,o)];const s=["minColumn","minRow"];return[Qp(e,r,s),Qp(e,r,Xp(s))]}(t,n,y),x=df(e,b.cell),C=df(e,_.cell);return e.$setAnchorCellForSelection(x),e.$setFocusCellForSelection(C,!0),!0}(i,e,t,o,n)}return c.selectEnd(),!0}return!1}function af(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function cf(e,t,n){const r=Bo();"first"===e?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function uf(e,t,n){const r=n.getParent();if(!r)return;const i=ul(Dp(e));if(!i)return;const o=i.anchorNode,s=e.getElementByKey(r.getKey()),l=Mp(n,e.getElementByKey(n.getKey()));if(!o||!s||!l||!s.contains(o)||l.contains(o))return;const a=Nl(t.anchor.getNode(),(e=>Xg(e)));if(!a)return;const c=Nl(a,(e=>Cf(e)));if(!Cf(c)||!c.is(n))return;const[u,d]=Cp(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 df(e,t){const{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function hf(e,t,n){return Bp(e,xs(t,n))}function gf(e,t,n){const r=e.querySelector("colgroup");if(!r)return;const i=[];for(let e=0;e<t;e++){const t=document.createElement("col"),r=n&&n[e];r&&(t.style.width=`${r}px`),i.push(t)}r.replaceChildren(...i)}function pf(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)}Ta(e,...r),Ea(e,...i)}const ff=new WeakSet;function mf(e=_l()){return ff.has(e)}class yf extends vo{__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 yf(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:_f,priority:1})}}static importJSON(e){return xf().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=Pp(e)?e:e.querySelector("table");return Pp(t)||ep(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),Ea(n,e.theme.table),this.updateTableElement(null,n,e),mf(t)){const t=document.createElement("div"),r=e.theme.tableScrollableWrapper;return r?Ea(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?(Ea(e,n.theme.tableFrozenColumn),t.setAttribute("data-lexical-frozen-column","true")):(Ta(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?(Ea(e,n.theme.tableFrozenRow),t.setAttribute("data-lexical-frozen-row","true")):(Ta(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?(Ea(e,t.theme.tableRowStriping),e.setAttribute("data-lexical-row-striping","true")):(Ta(e,t.theme.tableRowStriping),e.removeAttribute("data-lexical-row-striping"))}(t,n,this.__rowStriping);const r=e?e.getColumnCount():0,i=e?e.__colWidths:void 0;this.getColumnCount()===r&&this.getColWidths()===i||gf(t,this.getColumnCount(),this.getColWidths()),pf(t,n,this.getFormatType())}updateDOM(e,t,n){const r=this.getDOMSlot(t).element;return t===r===mf()||(gl(i=t)&&"DIV"===i.nodeName&&this.updateTableWrapper(e,t,r,n),this.updateTableElement(e,r,n),!1);var i}scaleDOMColWidths(e,t){const n=this.getColWidths();n&&gf(this.getDOMSlot(e).element,this.getColumnCount(),n.map((e=>e*t)))}exportDOM(e){const t=super.exportDOM(e),{element:n}=t;return{after:n=>{if(t.after&&(n=t.after(n)),!Pp(n)&&gl(n)&&(n=n.querySelector("table")),!Pp(n))return null;pf(n,e._config,this.getFormatType());const[r]=Sp(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:!Pp(n)&&gl(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=hf(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=xs(r.elem);return Xg(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=>{Xg(e)&&(t+=e.getColSpan())})),t}}function bf(e,t){const n=e.getElementByKey(t.getKey());return null===n&&ep(230),qp(t,n)}function _f(e){const t=xf();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(!Ug.test(n)&&(n=t.getAttribute("width")||"",!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>Kc(e,ip),node:t}}function xf(){return ol(new yf)}function Cf(e){return e instanceof yf}function Sf(e){ip(e.getParent())?e.isEmpty()&&e.append(Bo()):e.remove()}function wf(e){Cf(e.getParent())?$c(e,Xg):e.remove()}function vf(e){$c(e,ip);const[t]=Sp(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;ip(i)||ep(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=Yg();e.append(Bo()),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 kf(e){if(e.detail<3||!pl(e.target))return!1;const t=xs(e.target);if(null===t)return!1;const n=Nl(t,(e=>ko(e)&&!e.isInline()));return null!==n&&(!!Xg(n.getParent())&&(n.select(0),!0))}function Ef(){const e=$i();if(!wi(e))return!1;const t=sf(e.anchor.getNode());if(null===t)return!1;const n=ws();if(!n.is(t.getParent())||1!==n.getChildrenSize())return!1;const[r]=Sp(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 ks(Ap(t,i.cell,s.cell)),!0}function Tf(e,t=!0){const n=new Fp,r=(r,i,o)=>{const s=Mp(r,o),l=function(e,t,n,r,i){const o=n.getRootElement(),s=Dp(n);null!==o&&null!==s||ep(246);const l=new Ip(n,e.getKey()),a=Mp(e,t);!function(e,t){null!==Wp(e)&&ep(205),e[Rp]=t}(a,l),l.listenersToRemove.add((()=>function(e,t){Wp(e)===t&&delete e[Rp]}(a,l)));const c=e=>{e.detail>=3&&pl(e.target)&&null!==Vp(e.target)&&e.preventDefault()};a.addEventListener("mousedown",c,l.listenerOptions),l.listenersToRemove.add((()=>{a.removeEventListener("mousedown",c)}));for(const[t,r]of zp)l.listenersToRemove.add(n.registerCommand(t,(t=>lf(n,t,r,e,l,i)),3));l.listenersToRemove.add(n.registerCommand(Fn,(t=>{const n=$i();if(Np(n)){const r=Bp(e,n.focus.getNode());if(null!==r)return af(t),r.selectEnd(),!0}return!1}),3));const u=t=>()=>{const n=$i();if(!ef(n,e))return!1;if(Np(n))return l.$clearText(),!0;if(wi(n)){if(!Xg(Bp(e,n.anchor.getNode())))return!1;const r=n.anchor.getNode(),i=n.focus.getNode(),o=e.isParentOf(r),s=e.isParentOf(i);if(o&&!s||s&&!o)return l.$clearText(),!0;const a=Nl(n.anchor.getNode(),(e=>ko(e))),c=a&&Nl(a,(e=>ko(e)&&Xg(e.getParent())));if(!ko(c)||!ko(a))return!1;if(t===bn&&null===c.getPreviousSibling())return!0}return!1};for(const e of $p)l.listenersToRemove.add(n.registerCommand(e,u(e),3));const d=t=>{const n=$i();if(!Np(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!!ef(n,e)&&!!Np(n)&&(t&&(t.preventDefault(),t.stopPropagation()),l.$clearText(),!0)};for(const e of Hp)l.listenersToRemove.add(n.registerCommand(e,d,3));return l.listenersToRemove.add(n.registerCommand(Wn,(e=>{const t=$i();if(t){if(!Np(t)&&!wi(t))return!1;Ld(n,Dc(e,ClipboardEvent)?e:null,Id(t));const r=d(e);return wi(t)?(t.removeText(),!0):r}return!1}),3)),l.listenersToRemove.add(n.registerCommand(_n,(t=>{const n=$i();if(!ef(n,e))return!1;if(Np(n))return l.$formatCells(t),!0;if(wi(n)){const e=Nl(n.anchor.getNode(),(e=>Xg(e)));if(!Xg(e))return!1}return!1}),3)),l.listenersToRemove.add(n.registerCommand(zn,(t=>{const n=$i();if(!Np(n)||!ef(n,e))return!1;const r=n.anchor.getNode(),i=n.focus.getNode();if(!Xg(r)||!Xg(i))return!1;if(function(e,t){if(Np(e)){const n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){const[e]=Cp(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]=Cp(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];ko(n)&&!n.isInline()&&n.setFormat(t)}}return!0}),3)),l.listenersToRemove.add(n.registerCommand(pn,(t=>{const r=$i();if(!ef(r,e))return!1;if(Np(r))return l.$clearHighlight(),!1;if(wi(r)){const i=Nl(r.anchor.getNode(),(e=>Xg(e)));if(!Xg(i))return!1;if("string"==typeof t){const i=uf(n,r,e);if(i)return cf(i,e,[hi(t)]),!0}}return!1}),3)),r&&l.listenersToRemove.add(n.registerCommand(Rn,(t=>{const n=$i();if(!wi(n)||!n.isCollapsed()||!ef(n,e))return!1;const r=of(n.anchor.getNode());return!(null===r||!e.is(sf(r))||(af(t),function(e,t){const n="next"===t?"getNextSibling":"getPreviousSibling",r="next"===t?"getFirstChild":"getLastChild",i=e[n]();if(ko(i))return i.selectEnd();const o=Nl(e,ip);null===o&&ep(247);for(let e=o[n]();ip(e);e=e[n]()){const t=e[r]();if(ko(t))return t.selectEnd()}const s=Nl(o,Cf);null===s&&ep(248),"next"===t?s.selectNext():s.selectPrevious()}(r,t.shiftKey?"previous":"next"),0))}),3)),l.listenersToRemove.add(n.registerCommand(Jn,(t=>e.isSelected()),3)),l.listenersToRemove.add(n.registerCommand(gn,(()=>{const t=$i();if(!wi(t)||!t.isCollapsed()||!ef(t,e))return!1;const r=uf(n,t,e);return!!r&&(cf(r,e),!0)}),3)),l}(r,s,e,t,n);n.observers.set(i,[l,s])};return Na(function(e,t){const n=e.getRootElement(),r=e._window;if(!n||!r)return()=>{};const i=r=>{const i=r.target;if(0!==r.button||!pl(i)||!n.contains(i))return;const o=function(e){const t=Vp(e);if(null===t)return null;let n=t.elem;for(;null!=n;){if("TABLE"===n.nodeName&&Rp in n&&n[Rp])return{cellElement:t,tableElement:n,tableObserver:n[Rp]};n=n.parentNode}return null}(i);e.update((()=>{if(Np($i())){for(const[e]of t.observers.values())e.$clearHighlight(!1);ks(null),e.dispatchCommand(rn,void 0)}if(!o)return;const{tableObserver:n,tableElement:i,cellElement:s}=o;!function(e,t,n,r,i,o){const s=e._window;if(!s)return;i.pointerType=t.pointerType;const l=ll(i.tableNodeKey),a=Hi();if(lp&&t.shiftKey&&ef(a,l)&&(wi(a)||Np(a))){const e=a.anchor.getNode(),r=Bp(l,a.anchor.getNode());r?(i.$setAnchorCellForSelection(df(i,r)),i.$setFocusCellForSelection(n),af(t)):(l.isBefore(e)?l.selectStart():l.selectEnd()).anchor.set(a.anchor.key,a.anchor.offset,a.anchor.type)}else"touch"!==t.pointerType&&i.$setAnchorCellForSelection(n);(t=>{if(i.isSelecting)return;i.isSelecting=!0,null!==t&&null===i.anchorCell&&e.update((()=>{i.$setAnchorCellForSelection(t)}));const n=()=>{i.isSelecting=!1,s.removeEventListener("pointerup",n),s.removeEventListener("pointermove",l)},l=t=>{if(!(e=>!(1&~e.buttons))(t)&&i.isSelecting)return i.isSelecting=!1,s.removeEventListener("pointerup",n),void s.removeEventListener("pointermove",l);if(!pl(t.target))return;let a=null;const c=!(lp||r.contains(t.target));if(c)a=jp(r,t.target);else for(const e of document.elementsFromPoint(t.clientX,t.clientY))if(a=jp(r,e),a)break;if(a){const t=a;null===i.anchorCell&&e.update((()=>{i.$setAnchorCellForSelection(t)})),null!==i.focusCell&&a.elem===i.focusCell.elem||(o.setNextFocus({focusCell:a,override:c,tableKey:i.tableNodeKey}),e.dispatchCommand(rn,void 0))}};s.addEventListener("pointerup",n,i.listenerOptions),s.addEventListener("pointermove",l,i.listenerOptions)})(n)}(e,r,s,i,n,t)}))};return r.addEventListener("pointerdown",i),()=>{r.removeEventListener("pointerdown",i)}}(e,n),e.registerCommand(rn,(()=>Kp(n,e)),3),e.registerMutationListener(yf,(t=>{e.getEditorState().read((()=>{for(const[e,i]of t){const t=n.observers.get(e);if("created"===i||"updated"===i){const{tableNode:i,tableElement:o}=Op(e);void 0===t?r(i,e,o):o!==t[1]&&(t[0].removeListeners(),n.observers.delete(e),r(i,e,o))}else"destroyed"===i&&void 0!==t&&(t[0].removeListeners(),n.observers.delete(e))}}),{editor:e})}),{skipInitialization:!1}),(()=>{for(const[,[e]]of n.observers)e.removeListeners()}))}function Nf(e,t){e.hasNodes([yf])||ep(255);const{hasNestedTables:n=nu(!1)}={};return Na(e.registerCommand(Qg,(e=>function({rows:e,columns:t,includeHeaders:n},r){const i=$i()||Hi();if(!i||!wi(i))return!1;if(!r&&sf(i.anchor.getNode()))return!1;const o=function(e,t,n=!0){const r=xf();for(let i=0;i<e;i++){const e=rp();for(let r=0;r<t;r++){let t=jg;"object"==typeof n?(0===i&&n.rows&&(t|=qg),0===r&&n.columns&&(t|=Vg)):n&&(0===i&&(t|=qg),0===r&&(t|=Vg));const o=Yg(t),s=Bo();s.append(hi()),o.append(s),e.append(o)}r.append(e)}return r}(Number(e),Number(t),n);Pc(o);const s=o.getFirstDescendant();return gi(s)&&s.select(),!0}(e,n.peek())),0),e.registerCommand(on,((t,r)=>e===r&&function(e,t){const{nodes:n,selection:r}=e;if(!n.some((e=>Cf(e)||Fc(e).some((e=>Cf(e.node))))))return!1;const i=Np(r),o=wi(r);return!!(o&&null!==Nl(r.anchor.getNode(),(e=>Xg(e)))&&null!==Nl(r.focus.getNode(),(e=>Xg(e)))||i)&&(1===n.length&&Cf(n[0])?function(e,t){const n=t.getStartEndPoints(),r=Np(t);if(null===n)return!1;const[i,o]=n,[s,l,a]=wp(i),c=Nl(o.getNode(),(e=>Xg(e)));if(!(Xg(s)&&Xg(c)&&ip(l)&&Cf(a)))return!1;const[u,d,h]=Cp(a,s,c),[g]=Sp(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=vp(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||(xp(n.cell),w.add(n.cell.getKey()),x=!0)}let[v]=Sp(a.getWritable(),null,null);const k=b-p+m;for(let e=0;e<k;e++)gp(v[p-1][0].cell);const E=_-f+y;for(let e=0;e<E;e++)fp(v[0][f-1].cell,!0,!1);[v]=Sp(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)}bp(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)?(Bo().append(e),s.append(e)):s.append(e)})),a.forEach((e=>e.remove()))}if(r&&x){const[e]=Sp(a.getWritable(),null,null);e[d.startRow][d.startColumn].cell.selectEnd()}return!0}(n[0],r):!(o&&t.peek()&&!function(e){return!(!Np(e)||e.focus.getNode().is(e.anchor.getNode()))||!(!wi(e)||!Xg(e.anchor.getNode())||e.anchor.getNode().is(e.focus.getNode()))}(r)))}(t,n)),0),e.registerCommand(Vn,Ef,1),e.registerCommand(sn,kf,0),e.registerNodeTransform(yf,vf),e.registerNodeTransform(tp,wf),e.registerNodeTransform(Zg,Sf))}function Af(e,t){const n={...e,...t};for(const[r,i]of Object.entries(t))Lf(e[r],i)&&(n[r]=Af(e[r],i));return n}function Lf(...e){return e.every((e=>e&&e.constructor==Object))}class Of{#U={};constructor(...e){this.merge(...e)}merge(...e){return this.#U=e.reduce(Af,this.#U)}get(e){return e.split(".").reduce(((e,t)=>e[t]),this.#U)}}function Ff(e,t){return[...Array(1+t-e).keys()].map((t=>t+e))}const If=new Of({attachmentTagName:"action-text-attachment",attachmentContentTypeNamespace:"actiontext",authenticatedUploads:!1,extensions:[]}),Rf=new Of({default:{attachments:!0,markdown:!0,multiLine:!0,richText:!0,toolbar:{upload:"both"},highlight:{buttons:{color:Ff(1,9).map((e=>`var(--highlight-${e})`)),"background-color":Ff(1,9).map((e=>`var(--highlight-bg-${e})`))},permit:{color:[],"background-color":[]}}}});var Pf={global:If,presets:Rf,configure({global:e,...t}){e&&If.merge(e),Rf.merge(t)}};function Mf(e,t){return he.sanitize(e,function(e){const t={};for(const n of e)"string"==typeof n?t[n]||=[]:(t[n.tag]||=[],t[n.tag].push(...n.attributes));return{ALLOWED_TAGS:Object.keys(t),ALLOWED_ATTR:Ya,ADD_ATTR:(e,n)=>t[n]?.includes(e),ADD_URI_SAFE_ATTR:["caption","filename"],SAFE_FOR_XML:!1}}(t))}function Df(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 Bf extends To{static getType(){return"custom_action_text_attachment"}static clone(e){return new Bf({...e},e.__key)}static importJSON(e){return new Bf({...e})}static importDOM(){return{[this.TAG_NAME]:e=>e.getAttribute("content")?{conversion:e=>{const t=[],n=e.previousSibling;n&&n.nodeType===Node.TEXT_NODE&&/\s$/.test(n.textContent)&&t.push(hi(" "));const r=function(e){try{return JSON.parse(e)}catch{return e}}(e.getAttribute("content"));t.push(new Bf({sgid:e.getAttribute("sgid"),innerHtml:r,plainText:e.textContent.trim()||Ig(r),contentType:e.getAttribute("content-type")}));const i=e.nextSibling;return i&&i.nodeType===Node.TEXT_NODE&&/^\s/.test(i.textContent)&&t.push(hi(" ")),{node:t}},priority:2}:null}}static get TAG_NAME(){return Pf.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,contentType:n,innerHtml:r,plainText:i},o){super(o);const s=Pf.global.get("attachmentContentTypeNamespace");this.tagName=e||Bf.TAG_NAME,this.sgid=t,this.contentType=n||`application/vnd.${s}.unknown`,this.innerHtml=r,this.plainText=i??Ig(r)}createDOM(){const e=Ng(this.tagName,{"content-type":this.contentType,"data-lexxy-decorator":!0});e.insertAdjacentHTML("beforeend",function(e){return he.sanitize(e)}(this.innerHtml));const t=Ng("lexxy-node-delete-button");return e.appendChild(t),e}updateDOM(){return!1}getTextContent(){return"\ufeff"}getReadableTextContent(){return this.plainText||`[${this.contentType}]`}isInline(){return!0}exportDOM(){return{element:Ng(this.tagName,{sgid:this.sgid,content: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,plainText:this.plainText}}decorate(){return null}}const zf=[Br,Hr];function $f(e){if(gi(e))return Mc(e,Bo);if(e.isParentRequired()){const t=e.createRequiredParent();return Mc(e,t)}return e}function Hf(e){const t=Ic(e,Zu);return t?.getListType()??null}function Kf(e,t=null){return null===t?Kf(e,!0)||Kf(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 ko(t)||Aa(177),e.offset===t.getChildrenSize()}(e)}function Uf(e,...t){return Wf(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 Wf(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 Vf(e){const t=e.anchor.getNode(),n=ko(t)?t:t.getParentOrThrow(),r=n.getChildren();if(0===r.length)return!0;const i=r[r.length-1];if(t===n.getLatest()&&e.anchor.offset===r.length)return!0;if(t===i)return!0;const o=r.findLastIndex((e=>Gr(e)));if(-1===o)return!0;return r.indexOf(t)>o}function jf(e){if(""!==e.getTextContent().trim())return!1;const t=e.getChildren?.();return!t||0===t.length||t.every((e=>!!Gr(e)||jf(e)))}function qf(e){for(const t of Wc(e)){if(!jf(t))break;t.remove()}}function Zf(e,t,n,r){return gi(e)&&" "===e.getTextContent()&&n===r-1&&t instanceof Bf}function Gf(e){return!!wi(e)&&(e.isCollapsed()?Jf(e.style):e.hasFormat("highlight"))}function Jf(e){const t="string"==typeof e?Fa(e):e;return!(!t.color&&!t["background-color"])}class Yf{constructor(e,t=[]){this._property=e,this._allowedValues=t,this._canonicalValues=this.#W}applyCanonicalization(e){const t={...Fa(e)};return t[this._property]=this.getCanonicalAllowedValue(t[this._property]),t[this._property]||delete t[this._property],Ia(t)}getCanonicalAllowedValue(e){return this._canonicalValues[e]||=this.#V(e)}get#W(){return this._allowedValues.reduce(((e,t)=>({...e,[t]:t})),{})}#V(e){let t=this.#j.indexOf(e);return t||=this.#j.indexOf(Xf(this._property,e)),-1===t?null:this._allowedValues[t]}get#j(){return this._computedAllowedValues||=this._allowedValues.map((e=>Xf(this._property,e)))}}function Xf(e,t){const n=`${e}: ${t};`,r=document.body.appendChild(Ng("span",{style:"display: none;"+n})),i=window.getComputedStyle(r).getPropertyValue(e);return r.remove(),i}class Qf{#q;constructor(e){this.#q=e}get editorElement(){return this.#q}get editorConfig(){return this.#q.config}get enabled(){return!0}get lexicalExtension(){return null}get allowedElements(){return[]}initializeToolbar(e){}}const em=nn(),tm=nn(),nm={color:null,"background-color":null},rm=lt("hasPastedStyles",{parse:e=>e||!1}),im=new WeakMap;class om extends Qf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return[{dependencies:[gh],name:"lexxy/highlight",config:{color:{buttons:[],permit:[]},"background-color":{buttons:[],permit:[]}},html:{import:{mark:lm}},register(e,t){const n=function(e){return[new Yf("color",[...e.buttons.color,...e.permit.color]),new Yf("background-color",[...e.buttons["background-color"],...e.permit["background-color"]])]}(t);return function(e){if(!e._htmlConversions)return;let t=e._htmlConversions.get("pre");t||(t=[],e._htmlConversions.set("pre",t));t.push(function(e){return function(t){const n=function(e){const t=[],n=e.querySelector("code")||e;let r=0;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent.length;else if(e.nodeType===Node.ELEMENT_NODE){if("BR"===e.tagName)return void(r+=1);const n="MARK"===e.tagName,o=r;for(const t of e.childNodes)i(t);if(n){const n=function(e){const t={};e.style?.color&&(t.color=e.style.color);e.style?.backgroundColor&&(t["background-color"]=e.style.backgroundColor);const n=Ia(t);return n.length>0?n:null}(e);n&&t.push({start:o,end:r,style:n})}}}for(const e of n.childNodes)i(e);return t}(t);return 0===n.length?null:{conversion:t=>{const r=wh(t.getAttribute("data-language"));return am(e).set(r.getKey(),n),{node:r}},priority:2}}}(e))}(e),Na(e.registerCommand(em,(t=>hm(e,t)),2),e.registerCommand(tm,(()=>hm(e,nm)),2),e.registerNodeTransform(ri,ym),e.registerNodeTransform(Oh,bm),e.registerNodeTransform(ri,(e=>function(e,t=[]){if(function(e){return at(e,rm)}(e)){_m(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))),e.registerMutationListener(Sh,(t=>{!function(e,t){const n=am(e),r=[];for(const[e,i]of t)"destroyed"!==i&&n.has(e)&&r.push(e);if(0===r.length)return;e.update((()=>{for(const e of r){const t=n.get(e);if(n.delete(e),!t)continue;const r=ys(e);r&&vh(r)&&cm(r,t)}}),{skipTransforms:!0,discrete:!0})}(e,t)}),{skipInitialization:!0}))}},this.editorConfig.get("highlight")]}}function sm(e,t){const n={color:t.style?.color,"background-color":t.style?.backgroundColor};Js(zr)&&_m(e);const r=Ia(n);if(r.length)return e.setStyle(e.getStyle()+r)}function lm(){return{conversion:Uf("mark",sm),priority:1}}function am(e){let t=im.get(e);return t||(t=new Map,im.set(e,t)),t}function cm(e,t){if(0!==t.length)for(const{start:n,end:r,style:i}of t){const t=um(e);for(const{node:e,start:o,end:s}of t){if(!Rh(e))continue;const t=Math.max(n,o),l=Math.min(r,s);if(t>=l)continue;const a=t-o,c=l-o,u=s-o;if(0===a&&c===u)e.setStyle(i),fm(e,!0);else{const t=e.getTextContent(),n=e.getHighlightType(),r=[];a>0&&r.push(Ih(t.slice(0,a),n));const o=Ih(t.slice(a,c),n);o.setStyle(i),fm(o,!0),r.push(o),c<u&&r.push(Ih(t.slice(c),n));for(const t of r)e.insertBefore(t);e.remove()}}}}function um(e){const t=[];let n=0;for(const r of e.getChildren())if(Rh(r)||gi(r)){const e=r.getTextContent();t.push({node:r,start:n,end:n+e.length}),n+=e.length}else n+=1;return t}function dm(e){const t=[],n=um(e);for(const{node:e,start:r,end:i}of n){const n=e.getStyle();n&&Jf(n)&&t.push({start:r,end:i,style:n})}return t}function hm(e,t){const n=$i();if(!wi(n))return;const r={};for(const e in t){const i=Ja(n,e);r[e]=mm(i,t[e])}!function(e){const t=e.getNodes();return t.some((e=>Rh(e)||gi(e)?vh(e.getParent()):vh(e)))}(n)?function(e,t){if(wi(e)&&e.isCollapsed()){za(e,t);const n=e.anchor.getNode();ko(n)&&n.isEmpty()&&za(n,t)}$a((e=>{za(e,t)}));const n=e.getNodes();if(n.length>0){const e=new Set;for(const r of n){if(!ko(r)||!r.canBeEmpty()||0!==r.getChildrenSize())continue;const n=r.getKey();e.has(n)||(e.add(n),za(r,t))}}}(n,r):function(e,t,n){const r=t.getNodes().filter((e=>(Rh(e)||gi(e))&&vh(e.getParent()))).map((e=>({key:e.getKey(),startOffset:gm(e,t)[0],endOffset:gm(e,t)[1],textSize:e.getTextContentSize()})));e.update((()=>{const t=new Set;for(const{key:e,startOffset:i,endOffset:o,textSize:s}of r){const r=ys(e);if(!r)continue;const l=r.getParent();if(vh(l)&&i!==o)if(t.add(l),0===i&&o===s)pm(r,n);else{pm(r.splitText(i,o)[0===i?0:1],n)}}for(const n of t){const t=dm(n);t.length>0&&am(e).set(n.getKey(),t)}}),{skipTransforms:!0,discrete:!0})}(e,n,r)}function gm(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 pm(e,t){const n={...Fa(e.getStyle())};for(const[e,r]of Object.entries(t))null===r?delete n[e]:n[e]=r;const r=Ia(n);e.setStyle(r);const i=Jf(r);i!==e.hasFormat("highlight")&&fm(e,i)}function fm(e,t){const n=e.getWritable();t?n.__format|=128:n.__format&=-129}function mm(e,t){return e===t?null:t}function ym(e){Jf(e.getStyle())!==e.hasFormat("highlight")&&e.toggleFormat("highlight")}function bm(e){if(!vh(e.getParent()))return;const t=Jf(e.getStyle());t!==e.hasFormat("highlight")&&fm(e,t)}function _m(e,t=!0){ct(e,rm,t)}const xm=["bold","italic","strikethrough","underline","link","unlink","toggleHighlight","removeHighlight","setFormatHeadingLarge","setFormatHeadingMedium","setFormatHeadingSmall","setFormatParagraph","clearFormatting","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","setCodeLanguage","insertHorizontalDivider","uploadImage","uploadFile","insertTable","undo","redo"];class Cm{#Z=null;#e=new tc;static configureFor(e){return new Cm(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#G(),this.#J(),this.#Y()}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")}dispatchUnderline(){this.editor.dispatchCommand(_n,"underline")}dispatchToggleHighlight(e){this.editor.dispatchCommand(em,e)}dispatchRemoveHighlight(){this.editor.dispatchCommand(tm)}dispatchLink(e){this.editor.update((()=>{const t=$i();if(wi(t))if(t.isCollapsed()){const n=hd(e),r=hi(e);n.append(r),t.insertNodes([n])}else fd(e)}))}dispatchUnlink(){this.editor.update((()=>{this.editorElement.adapter.unlinkFrozenNode?.()||fd(null)}))}dispatchInsertUnorderedList(){const e=$i();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===Hf(t)?this.contents.applyParagraphFormat():this.contents.applyUnorderedListFormat()}dispatchInsertOrderedList(){const e=$i();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===Hf(t)?this.contents.applyParagraphFormat():this.contents.applyOrderedListFormat()}dispatchInsertQuoteBlock(){this.contents.toggleBlockquote()}dispatchInsertCodeBlock(){this.selection.hasSelectedWordsInSingleLine?this.#X():this.contents.toggleCodeBlock()}#X(){const e=$i();if(wi(e)){if(!e.isCollapsed()){const t=e.getNodes().filter(gi);!t.every((e=>e.hasFormat("code")))&&this.#Q(e,t)}this.editor.dispatchCommand(_n,"code")}}#Q(e,t){const n=e.isBackward(),r=n?e.focus:e.anchor,i=n?e.anchor:e.focus;for(let e=0;e<t.length;e++){const n=t[e];if(0===n.getFormat())continue;const o=0===e,s=e===t.length-1,l=o&&"text"===r.type?r.offset:0,a=s&&"text"===i.type?i.offset:n.getTextContentSize();if(0===l&&a===n.getTextContentSize())n.setFormat(0);else{const e=n.splitText(l,a),t=0===l?e[0]:e[1];t.setFormat(0),o&&"text"===r.type&&r.set(t.getKey(),0,"text"),s&&"text"===i.type&&i.set(t.getKey(),a-l,"text")}}}dispatchSetCodeLanguage(e){this.editor.update((()=>{if(!this.selection.isInsideCodeBlock)return;const t=this.selection.nearestNodeOfType(Sh);t&&t.setLanguage(e)}))}dispatchInsertHorizontalDivider(){this.contents.insertAtCursorEnsuringLineBelow(new Rg),this.editor.focus()}dispatchSetFormatHeadingLarge(){this.contents.applyHeadingFormat("h2")}dispatchSetFormatHeadingMedium(){this.contents.applyHeadingFormat("h3")}dispatchSetFormatHeadingSmall(){this.contents.applyHeadingFormat("h4")}dispatchSetFormatParagraph(){this.contents.applyParagraphFormat()}dispatchClearFormatting(){this.contents.clearFormatting()}dispatchUploadImage(){this.#ee("image/*,video/*")}dispatchUploadFile(){this.#ee()}#ee(e=null){const t={type:"file",multiple:!0,style:"display: none;",onchange:({target:{files:e}})=>{this.contents.uploadFiles(e,{selectLast:!0})}};e&&(t.accept=e);const n=Ng("input",t);this.editorElement.appendChild(n),n.click(),setTimeout((()=>n.remove()),1e3)}dispatchInsertTable(){this.editor.dispatchCommand(Qg,{rows:3,columns:3,includeHeaders:!0})}dispatchUndo(){this.editor.dispatchCommand(xn,void 0)}dispatchRedo(){this.editor.dispatchCommand(Cn,void 0)}dispose(){this.#e.dispose()}#G(){for(const t of xm){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.#e.track(this.editor.registerCommand(e,n,t))}#J(){this.#te(wn,2,this.#ne.bind(this)),this.#te(Rn,2,this.#re.bind(this))}#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))}#Y(){if(this.editorElement.supportsAttachments){this.dragCounter=0;const e=this.editor.getRootElement();this.#e.track(ec(e,"dragover",this.#ie.bind(this)),ec(e,"drop",this.#oe.bind(this)),ec(e,"dragenter",this.#se.bind(this)),ec(e,"dragleave",this.#le.bind(this)))}}#se(e){this.#ae(e)||(this.dragCounter++,1===this.dragCounter&&(this.#ce(),this.editor.getRootElement().classList.add("lexxy-editor--drag-over")))}#le(e){this.#ae(e)||(this.dragCounter--,0===this.dragCounter&&(this.#Z=null,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")))}#ie(e){this.#ae(e)||e.preventDefault()}#oe(e){if(this.#ae(e))return;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.#ue(),this.contents.uploadFiles(n,{selectLast:!0}),this.editor.focus())}#ce(){this.editor.getEditorState().read((()=>{this.#Z=$i()?.clone()}))}#ue(){this.#Z&&(this.editor.update((()=>{ks(this.#Z)})),this.#Z=null)}#ae(e){return e.dataTransfer?.types.includes("application/x-lexxy-node-key")}#re(e){return this.selection.isInsideList?this.#de(e):!!this.selection.isInsideCodeBlock&&this.#he()}#de(e){if(e.shiftKey&&!this.selection.isIndentedList)return!1;e.preventDefault();const t=e.shiftKey?Dn:Mn;return this.editor.dispatchCommand(t)}#he(){const e=$i();return wi(e)&&e.isCollapsed()}}function Sm(){return new Promise(requestAnimationFrame)}function wm(e){try{return new URL(e),!0}catch{return!1}}function vm(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function km(e){return e.charAt(0).toUpperCase()+e.slice(1)}class Em extends To{static getType(){return"action_text_attachment"}static clone(e){return new Em({...e},e.__key)}static importJSON(e){return new Em({...e})}static importDOM(){return{[this.TAG_NAME]:()=>({conversion:e=>({node:new Em({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 Em({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 Em({src:t,fileName:n,contentType:r})}},priority:1})}}static get TAG_NAME(){return Pf.global.get("attachmentTagName")}constructor({tagName:e,sgid:t,src:n,previewSrc:r,previewable:i,pendingPreview:o,altText:s,caption:l,contentType:a,fileName:c,fileSize:u,width:d,height:h,uploadError:g},p){var f;super(p),this.tagName=e||Em.TAG_NAME,this.sgid=t,this.src=n,this.previewSrc=r,this.previewable="string"==typeof(f=i)?"true"===f:Boolean(f),this.pendingPreview=o,this.altText=s||"",this.caption=l||"",this.contentType=a||"",this.fileName=c||"",this.fileSize=u,this.width=d,this.height=h,this.uploadError=g,this.editor=_l()}createDOM(){if(this.uploadError)return this.createDOMForError();if(this.pendingPreview)return this.#ge();const e=this.createAttachmentFigure();return this.isPreviewableAttachment?(e.appendChild(this.#pe()),e.appendChild(this.#fe())):this.isVideo?(e.appendChild(this.#me()),e.appendChild(this.#fe())):(e.appendChild(this.#me()),e.appendChild(this.#ye())),e}updateDOM(e,t){if(this.uploadError!==e.uploadError)return!0;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(nl(this))}exportDOM(){return{element:Ng(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}createDOMForError(){const e=this.createAttachmentFigure();return e.classList.add("attachment--error"),e.appendChild(Ng("div",{innerText:`Error uploading ${this.fileName||"file"}`})),e}createAttachmentFigure(e=this.isPreviewableAttachment){const t=(n=this.contentType,r=e,i=this.fileName,Ng("figure",{className:`attachment attachment--${r?"preview":"file"} attachment--${i?i.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":n}));var n,r,i;t.draggable=!0,t.dataset.lexicalNodeKey=this.__key;const o=Ng("lexxy-node-delete-button");return t.appendChild(o),t}get isPreviewableAttachment(){return this.isPreviewableImage||this.previewable}get isPreviewableImage(){return Lg(this.contentType)}get isVideo(){return this.contentType.startsWith("video/")}#ge(){const e=this.createAttachmentFigure(!1);return e.appendChild(this.#me()),e.appendChild(this.#ye()),this.#be(e),e}#pe(e={}){const t=Ng("img",{src:this.previewSrc||this.src,draggable:!1,alt:this.altText,...this.#_e,...e});this.previewable&&!this.isPreviewableImage&&(t.onerror=()=>this.#xe(t)),this.previewSrc&&this.#Ce(t);const n=Ng("div",{className:"attachment__container"});return n.appendChild(t),n}#Ce(e){const t=this.previewSrc,n=new Image;n.onload=()=>this.#Se(e,t),n.onerror=()=>this.#we(t),n.src=this.src}#Se(e,t){e.src=this.src,this.editor.update((()=>{this.isAttached()&&(this.getWritable().previewSrc=null)}),{tag:this.#ve}),this.#ke(t)}#we(e){this.editor.update((()=>{this.isAttached()&&(this.getWritable().previewSrc=null,this.getWritable().uploadError=!0)}),{tag:this.#ve}),this.#ke(e)}get#ve(){const e=this.editor.getRootElement();return null!==e&&e.contains(document.activeElement)?zf:[...zf,Kr]}#ke(e){e?.startsWith("blob:")&&URL.revokeObjectURL(e)}#xe(e){const t=e.closest("figure.attachment");t&&this.#Ee(t,"attachment--preview","attachment--file",(()=>{t.appendChild(this.#me()),t.appendChild(this.#ye())}))}#be(e){let t=0;const n=()=>{if(!this.editor.read((()=>this.isAttached())))return;const t=new Image,n=`${this.src}${this.src.includes("?")?"&":"?"}_=${Date.now()}`;t.onload=()=>{this.editor.read((()=>this.isAttached()))&&(t.naturalWidth>150&&t.naturalHeight>150?this.#Te(e,n):r())},t.onerror=()=>r(),t.src=n},r=()=>{if(t++,t<10&&this.editor.read((()=>this.isAttached()))){const e=Math.min(2e3*Math.pow(1.5,t),15e3);setTimeout(n,e)}};setTimeout(n,3e3)}#Te(e,t){this.#Ee(e,"attachment--file","attachment--preview",(()=>{const n=Ng("img",{src:t,draggable:!1,alt:this.altText});n.onerror=()=>this.#xe(n);const r=Ng("div",{className:"attachment__container"});r.appendChild(n),e.appendChild(r),e.appendChild(this.#fe())})),this.editor.update((()=>{this.isAttached()&&(this.getWritable().pendingPreview=!1)}),{tag:this.#ve})}#Ee(e,t,n,r){e.className=e.className.replace(t,n);for(const t of[...e.querySelectorAll(".attachment__container, .attachment__icon, figcaption")])t.remove();r()}get#_e(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#me(){return Ng("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#ye(){const e=Ng("figcaption",{className:"attachment__caption"}),t=Ng("strong",{className:"attachment__name",textContent:this.caption||this.fileName});if(e.appendChild(t),this.fileSize){const t=Ng("span",{className:"attachment__size",textContent:Df(this.fileSize)});e.appendChild(t)}return e}#fe(){const e=Ng("figcaption",{className:"attachment__caption"}),t=Ng("textarea",{value:this.caption,placeholder:this.fileName,rows:"1"});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",(e=>this.#Ne(e))),t.addEventListener("keydown",(e=>this.#Ae(e))),t.addEventListener("copy",(e=>e.stopPropagation())),t.addEventListener("cut",(e=>e.stopPropagation())),t.addEventListener("paste",(e=>e.stopPropagation())),e.appendChild(t),e}#Ne(e){this.#Le(e.target)}#Le(e){e.placeholder=this.fileName,this.editor.update((()=>{this.getWritable().caption=e.value}))}#Ae(e){"Enter"===e.key&&(e.preventDefault(),e.target.blur(),this.editor.update((()=>{this.selectNext(0,0)}),{tag:Br})),e.stopPropagation()}}function Tm(...e){return new Em(...e)}function Nm(e){return e instanceof Em}class Am{#e=new tc;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#Oe(),this.#Fe(),this.#Ie(),this.#Re()}set current(e){this.editor.update((()=>{this.#Pe()}))}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.#Me();if(!t)return;const n=this.#De(t);n&&(e=this.#Be(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{const e=ws(),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=Hf(t),i=this.#ze(t);return{isBold:e.hasFormat("bold"),isItalic:e.hasFormat("italic"),isStrikethrough:e.hasFormat("strikethrough"),isUnderline:e.hasFormat("underline"),isHighlight:Gf(e),isInLink:null!==Ic(t,ld),isInQuote:nh(n),isInHeading:null!==i,isInCode:this.#$e(e,t),headingTag:i?.getTag()??null,isInList:null!==r,listType:r,isInTable:null!==ap(t)}}nearestNodeOfType(e){const t=$i()?.anchor?.getNode();return Ic(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;const r=t.getTopLevelElement();if(!r)return!1;const i=ko(t)?t:t.getParent();if(i!==(ko(n)?n:n.getParent())&&i!==r)return!1;const o=e.getNodes();for(const e of o)if(Gr(e))return!1;return!0}get isInsideList(){return this.nearestNodeOfType(Uu)}get isIndentedList(){const e=this.nearestNodeOfType(Zu);return e&&Lu(e)>1}get isInsideCodeBlock(){return null!==this.nearestNodeOfType(Sh)}get isTableCellSelected(){const e=$i(),{anchor:t,focus:n}=e;return!(!wi(e)||t.key!==n.key)&&null!==this.nearestNodeOfType(Zg)}get isOnPreviewableImage(){const e=$i(),t=e?.getNodes().at(0);return Nm(t)&&t.isPreviewableImage}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#He();return e?gi(e)?this.#Ke(e,t):ko(e)?this.#Ue(e,t):this.#We(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#He();if(!e)return null;if(gi(e)){if(t===e.getTextContentSize())return this.#Ve(e);if(this.#je(e)){const t=e.getTopLevelElement();return t?t.getNextSibling():null}return null}return ko(e)?this.#Ue(e,t):this.#We(e)}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#He();return e?gi(e)?this.#qe(e,t):ko(e)?this.#Ze(e,t):this.#Ge(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#He();if(!e)return null;if(gi(e)){if(0===t)return this.#Je(e);if(this.#Ye(e)){const t=e.getTopLevelElement();return t?t.getPreviousSibling():null}return null}return ko(e)?this.#Ze(e,t):this.#Ge(e)}dispose(){this.editorElement=null,this.editorContentElement=null,this.editor=null,this.previouslySelectedKeys=null,this.#e.dispose()}#$e(e,t){return null!==Ic(t,Sh)||!!e.hasFormat("code")&&(gi(t)&&t.hasFormat("code"))}#Re(){this.#e.track(this.editor.registerUpdateListener((({editorState:e,tags:t})=>{if(t.has("history-merge")||t.has("skip-dom-selection"))return;let n=!1;e.read((()=>{const e=$i();if(!wi(e)||!e.isCollapsed())return;if(!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#$e(e,t)||(n=!0)})),n&&setTimeout((()=>{this.editor.update((()=>{const e=$i();if(!wi(e)||!e.hasFormat("code"))return;const t=e.anchor.getNode();this.#$e(e,t)||e.toggleFormat("code")}))}),0)})))}get#Xe(){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}#Fe(){this.#e.track(this.editor.registerCommand(kn,this.#Qe.bind(this),1),this.editor.registerCommand(wn,this.#et.bind(this),1),this.editor.registerCommand(Tn,this.#tt.bind(this),1),this.editor.registerCommand(Nn,this.#nt.bind(this),1),this.editor.registerCommand(dn,this.#rt.bind(this),1),this.editor.registerCommand(rn,(()=>{this.current=$i()}),1))}#Oe(){this.#e.track(this.editor.registerCommand(sn,(({target:e})=>{if(!pl(e))return!1;const t=xs(e);return No(t)&&this.#it(t)}),1));const e=this.editor.getRootElement();this.#e.track(ec(e,"lexxy:internal:move-to-next-line",(()=>this.#ot())))}#Ie(){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)}#Pe(){this.#st(),this.#lt(),this.previouslySelectedKeys=this.#Xe,this.currentlySelectedKeys=null}#st(){for(const e of this.previouslySelectedKeys)if(!this.#Xe.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#lt(){for(const e of this.#Xe)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#Qe(e){return!e?.shiftKey&&(this.hasNodeSelection?await this.#at((e=>e.selectPrevious())):this.#it(this.nodeBeforeCursor))}async#et(e){return!e?.shiftKey&&(this.hasNodeSelection?await this.#at((e=>e.selectNext(0,0))):this.#it(this.nodeAfterCursor))}async#tt(){return this.hasNodeSelection?await this.#at((e=>e.getTopLevelElement().selectPrevious())):this.#it(this.topLevelNodeBeforeCursor)}async#nt(){return this.hasNodeSelection?await this.#at((e=>e.getTopLevelElement().selectNext(0,0))):this.#it(this.topLevelNodeAfterCursor)}async#at(e){await Sm(),this.hasNodeSelection&&this.editor.update((()=>{e($i().getNodes()[0]),this.editor.focus()}))}async#ot(){this.editor.update((()=>{const e=this.#ct();e&&this.#ut(e)}))}#ct(){const e=$i();return e?ki(e)?this.#dt(e):wi(e)?this.#ht(e):null:null}#dt(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#ht(e){return e.anchor.getNode().getTopLevelElement()}#ze(e){const t=e.getTopLevelElementOrThrow();let n=ah(t)?t:null;if(!n){let t=e.getParent();for(;t;){if(ah(t)){n=t;break}t=t.getParent()}}return n}#ut(e){const t=e.getNextSibling();t?t.selectStart():this.#gt()}#gt(){const e=ws(),t=Bo();e.append(t),t.selectStart()}#it(e){if(No(e)){const t=function(...e){const t=Bi();return e.forEach((e=>t.add(e.getKey()))),t}(e);return ks(t),t}return!1}#rt(e){if(e&&this.#pt())return!0;const t=e?this.nodeBeforeCursor:this.nodeAfterCursor;if(!No(t))return!1;if(this.#ft(t))return!0;this.#mt();const n=this.#it(t);return Boolean(n)}#pt(){const e=$i();if(!wi(e)||!e.isCollapsed())return!1;const t=Ic(e.anchor.getNode(),Uu);if(!t)return!1;if(!function(e){const t=e.getChildren();for(const e of t){if(No(e))return!1;if(!Gr(e))if(gi(e)){if(""!==e.getTextContent().trim())return!1}else if(ko(e)&&""!==e.getTextContent().trim())return!1}return!0}(t))return!1;if(!t.getNextSibling())return!1;const n=t.getPreviousSibling();if(n)return n.selectEnd(),t.remove(),!0;const r=Ic(t,Zu);if(!r)return!1;const i=Bo();return r.insertBefore(i),t.remove(),i.selectStart(),!0}#ft(e){const t=$i()?.anchor?.getNode(),n=t&&Ic(t,Uu);if(!n)return!1;if(n.isParentOf(e))return!1;const r=Ic(n,Zu);if(!r)return!1;const i=Bo();return n.getChildren().forEach((e=>i.append(e))),1===r.getChildrenSize()?(r.insertBefore(i),r.remove()):(r.insertBefore(i),n.remove()),i.selectStart(),!0}#mt(e=$i()?.anchor){const t=e?.getNode();ko(t)&&t?.isEmpty()&&t.remove()}#Me(){const e=$i();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#De(e){let t=e.getBoundingClientRect();if(this.#yt(t)){const n=this.#bt(e);t=n.getBoundingClientRect(),this.#_t(n),n.remove()}return t}#yt(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#bt(e){const t=this.#xt();return e.insertNode(t),t}#xt(){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}#_t(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#Be(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const o=this.#Ct(t);return isNaN(o)||(i+=o),{x:r,y:i,fontSize:o}}#Ct(e){const t=window.getSelection().anchorNode,n=this.#St(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#St(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#He(){const e=$i();if(!wi(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#Ke(e,t){return t===e.getTextContentSize()?this.#Ve(e):null}#Ve(e){const t=e.getNextSibling();if(No(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getNextSibling():null}#Ue(e,t){return t<e.getChildrenSize()?e.getChildAtIndex(t):this.#We(e)}#qe(e,t){return 0===t?this.#Je(e):null}#Je(e){const t=e.getPreviousSibling();if(No(t))return t;if(null!=t)return null;const n=e.getParent();return n?n.getPreviousSibling():null}#Ze(e,t){return t>0?e.getChildAtIndex(t-1):this.#Ge(e)}#We(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#Ge(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}#Ye(e){return this.#wt(e,"first")}#je(e){return this.#wt(e,"last")}#wt(e,t){const n=e.getTopLevelElement();if(!n)return!1;const r=this.editor.getElementByKey(n.getKey());if(!r)return!1;const i=window.getSelection();if(!i?.rangeCount)return!1;const o=this.#De(i.getRangeAt(0));if(!o||this.#yt(o))return!1;const s=this.#vt(r,t);if(!s||this.#yt(s))return!1;const l=s.height>0?.5*s.height:5;return Math.abs(o.top-s.top)<l}#vt(e,t){const n=document.createTreeWalker(e,4);let r;if("first"===t)r=n.nextNode();else for(;n.nextNode();)r=n.currentNode;if(!r||0===r.length)return null;const i=document.createRange();return"first"===t?(i.setStart(r,0),i.setEnd(r,1)):(i.setStart(r,r.length-1),i.setEnd(r,r.length)),i.getBoundingClientRect()}}class Lm{#q;#kt;constructor(e){this.#q=e,this.#kt=new Of(Pf.presets.get("default"),Pf.presets.get(e.preset),this.#Et)}get(e){return this.#kt.get(e)}get#Et(){const e={};for(const t of this.#Tt){const n=t.replace(/([A-Z])/g,((e,t)=>`-${t.toLowerCase()}`));this.#q.hasAttribute(n)&&(e[t]=this.#Nt(n))}return e}get#Tt(){return Object.keys(Pf.presets.get("default"))}#Nt(e){const t=this.#q.getAttribute(e);try{return JSON.parse(t)}catch{return t}}}class Om extends Mo{$config(){return this.config("provisonal_paragraph",{extends:Mo,importDOM:()=>null,$transform:e=>{e.concretizeIfEdited(e),e.removeUnlessRequired(e)}})}static neededBetween(e,t){return!Im(e,"next")&&!Im(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();if(!t)return!1;if(t.getNodes().some((e=>e.is(this)||this.isParentOf(e))))return!0;if(wi(t)&&t.isCollapsed()){const{anchor:e}=t,n=this.getParent();if(n&&e.getNode().is(n)&&"element"===e.type){const t=this.getIndexWithinParent();return e.offset===t||e.offset===t+1}}return!1}removeUnlessRequired(e=this.getLatest()){e.required||e.remove()}concretizeIfEdited(e=this.getLatest()){e.getTextContentSize()>0&&e.replace(Bo(),!0)}get required(){return this.isDirectRootChild&&Om.neededBetween(...this.immediateSiblings)}get isDirectRootChild(){return rl(this.getParent())}get immediateSiblings(){return[this.getPreviousSibling(),this.getNextSibling()]}}function Fm(e){return e instanceof Om}function Im(e,t){return ko(e)&&("next"===t?e.canInsertTextBefore():e.canInsertTextAfter())}class Rm extends Em{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.createDOMForError();this.#At();const e=this.isPreviewableAttachment&&null!=this.uploadUrl,t=this.createAttachmentFigure(e);if(e){const e=t.appendChild(this.#pe());(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,e).then((e=>this.#Lt(e)))}else t.appendChild(this.#me());return t.appendChild(this.#Ot()),t.appendChild(this.#Ft()),t}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#It(){return null!==this.progress}#pe(){return Ng("img")}#me(){return Ng("span",{className:"attachment__icon",textContent:this.#Rt()})}#Rt(){return this.file.name.split(".").pop().toLowerCase()}#Ot(){const e=Ng("figcaption",{className:"attachment__caption"}),t=Ng("span",{className:"attachment__name",textContent:this.caption||this.file.name||""}),n=Ng("span",{className:"attachment__size",textContent:Df(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#Ft(){return Ng("progress",{value:this.progress??0,max:100})}#Lt({width:e,height:t}){this.#Pt||this.editor.update((()=>{const n=this.getWritable();n.width=e,n.height=t}),{tag:this.#ve})}get#Pt(){return Boolean(this.width&&this.height)}async#At(){if(this.#It)return;if(!this.uploadUrl)return;this.#Mt();const{DirectUpload:e}=await import("@rails/activestorage"),t=new e(this.file,this.uploadUrl,this);t.delegate=this.#Dt(),this.#Bt("lexxy:upload-start",{file:this.file}),t.create(((e,t)=>{e?(this.#Bt("lexxy:upload-end",{file:this.file,error:e}),this.#zt(e)):(this.#Bt("lexxy:upload-end",{file:this.file,error:null}),this.editor.update((()=>{this.showUploadedAttachment(t)}),{tag:this.#ve}))}))}#Dt(){const e=Pf.global.get("authenticatedUploads");return{directUploadWillCreateBlobWithXHR:t=>{e&&(t.withCredentials=!0)},directUploadWillStoreFileWithXHR:t=>{e&&(t.withCredentials=!0);t.upload.addEventListener("progress",(e=>this.#$t(e)))}}}#Mt(){this.#Ht(1)}#$t(e){const t=Math.round(e.loaded/e.total*100);this.#Ht(t),this.#Bt("lexxy:upload-progress",{file:this.file,progress:t})}#Ht(e){this.editor.update((()=>{this.getWritable().progress=e}),{tag:this.#ve})}#zt(e){console.warn(`Upload error for ${this.file?.name??"file"}: ${e}`),this.editor.update((()=>{this.getWritable().uploadError=!0}),{tag:this.#ve})}showUploadedAttachment(e){const t=this.isPreviewableImage&&this.file?URL.createObjectURL(this.file):null,n=this.#Kt(e,t),r=this.#Ut;return this.replace(n),r&&rl(n.getParent())&&n.selectNext(),n.getKey()}get#ve(){return this.#Wt?zf:[...zf,Kr]}get#Wt(){const e=this.editor.getRootElement();return null!==e&&e.contains(document.activeElement)}get#Ut(){const e=$i();if(null===e)return!1;if(e.getNodes().some((e=>e.is(this))))return!0;if(!wi(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!Fm(t)||!t.isEmpty())return!1;const n=t.getPreviousSibling();return null!==n&&n.is(this)}#Kt(e,t){return new Pm(this,e,t).toAttachmentNode()}#Bt(e,t){const n=this.editor.getElementByKey(this.getKey());n&&Og(n,e,t)}}class Pm{constructor(e,t,n){this.uploadNode=e,this.blob=t,this.previewSrc=n}toAttachmentNode(){return new Em({...this.uploadNode,...this.#Vt,src:this.#jt,previewSrc:this.previewSrc,pendingPreview:this.blob.previewable&&!this.uploadNode.isPreviewableImage})}get#Vt(){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#jt(){return this.blob.previewable?this.blob.url:this.#qt}get#qt(){return this.uploadNode.blobUrlTemplate.replace(":signed_id",this.blob.signed_id).replace(":filename",encodeURIComponent(this.blob.filename))}}function Mm(...e){return new Rm(...e)}class Dm extends vo{$config(){return this.config("image_gallery",{extends:vo})}static transform(){return e=>{e.unwrapEmptyNode()||e.replaceWithSingularChild()||e.splitAroundInvalidChild()}}static importDOM(){return{div:e=>this.#Zt(e)?{conversion:()=>({node:Bm()}),priority:2}:null}}static canCollapseWith(e){return zm(e)||this.isValidChild(e)}static isValidChild(e){return Nm(e)&&e.isPreviewableImage}static#Zt(e){const t=e.querySelectorAll(`:scope > :is(${this.#Gt.join()})`);return""===e.textContent.trim()&&t.length>0&&e.children.length===t.length}static get#Gt(){return Object.keys(Em.importDOM())}createDOM(){const e=document.createElement("div");return e.className=this.#Jt,e}updateDOM(e,t){return t.className=this.#Jt,!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=Bo();return this.insertAfter(e,!1),e.insertAfter(this.getLastChild(),!1),e.selectEnd(),null}const n=Bm();return this.insertAfter(n,t),n}getImageAttachments(){return this.getChildren().filter(Nm)}exportDOM(){const e=document.createElement("div");return e.className=this.#Jt,{element:e}}collapseWith(e,t){return!!Dm.canCollapseWith(e)&&(t?zc(this,e):this.append(e),$c(this,Dm.isValidChild),!0)}unwrapEmptyNode(){if(this.isEmpty()){const e=Bo();return this.replace(e)}}replaceWithSingularChild(){if(this.#Yt){const e=this.getFirstChild();return this.replace(e)}}splitAroundInvalidChild(){for(const e of Uc(this)){if(Dm.isValidChild(e))continue;const t=$f(e),[n,r]=this.splitAtIndex(t.getIndexWithinParent());n.insertAfter(t),t.selectEnd(),r.isEmpty()&&r.remove();break}}splitAtIndex(e){return dl(this,e)}get#Yt(){return 1===this.getChildrenSize()}get#Jt(){return`attachment-gallery attachment-gallery--${this.getChildrenSize()}`}}function Bm(){return new Dm}function zm(e){return e instanceof Dm}function $m(e){if(!Dm.canCollapseWith(e))return null;return Ic(e,Dm)??Mc(e,Bm)}class Hm{#Xt;static for(e,t){return new(Km.handle(e,t)?Km:Hm)(e,t)}constructor(e,t){this.#Xt=t,this.editorElement=e,this.contents=e.contents,this.selection=e.selection}get files(){return Array.from(this.#Xt)}$uploadFiles(){this.$createUploadNodes(),this.$insertUploadNodes()}$createUploadNodes(){this.nodes=this.files.map((e=>Mm({...this.#Qt,file:e,contentType:e.type})))}$insertUploadNodes(){this.contents.insertAtCursor(...this.nodes)}get#Qt(){return{uploadUrl:this.editorElement.directUploadUrl,blobUrlTemplate:this.editorElement.blobUrlTemplate}}}class Km extends Hm{#en;static handle(e,t){return this.#tn(t)||this.#nn(e.selection)}static#tn(e){let t=0;for(const n of e)if(Lg(n.type)&&t++,t>1)return!0;return!1}static#nn(e){if(e.isOnPreviewableImage)return!0;const{node:t}=e.selectedNodeWithOffset();return null!==Ic(t,Dm)}$insertUploadNodes(){this.#rn(),this.#in(),this.#on()}#rn(){this.selection.isOnPreviewableImage?this.#en=$m(this.#sn):(this.#en=Bm(),this.contents.insertAtCursor(this.#en))}get#sn(){const{node:e}=this.selection.selectedNodeWithOffset();return e}get#ln(){const e=$i()?.anchor,t=e?.getNode().is(this.#en);if(t)return e.offset;const n=this.#sn,r=this.#en.isParentOf(n)&&n.getIndexWithinParent();return!1!==r?r+1:0}get#an(){return this.nodes.filter((e=>Dm.isValidChild(e)))}get#cn(){return this.nodes.filter((e=>!Dm.isValidChild(e)))}#in(){this.#en.splice(this.#ln,0,this.#an)}#on(){let e=this.#en;for(const t of this.#cn)e.insertAfter(t),e=t}}class Um{constructor(e){this.editorElement=e,this.editor=e.editor}dispose(){this.editorElement=null,this.editor=null}get selection(){return this.editorElement.selection}insertHtml(e,{tag:t}={}){this.insertDOM(Ag(e),{tag:t})}insertDOM(e,{tag:t}={}){this.#un(e),this.editor.update((()=>{Js(zr)&&this.#dn(e);const t=bd(this.editor,e);this.#hn(t)||this.insertAtCursor(...t)}),{tag:t})}insertAtCursor(...e){const t=$i()??ws().selectEnd();Vm.for(t).insertNodes(e)}insertAtCursorEnsuringLineBelow(e){this.insertAtCursor(e),this.#gn(e)}applyParagraphFormat(){const e=$i();wi(e)&&Ua(e,(()=>Bo()))}applyHeadingFormat(e){const t=$i();wi(t)&&Ua(t,(()=>lh(e)))}applyUnorderedListFormat(){this.#pn(),this.editor.dispatchCommand(nd,void 0)}applyOrderedListFormat(){this.#pn(),this.editor.dispatchCommand(rd,void 0)}clearFormatting(){const e=$i();wi(e)&&($a((e=>{e.setFormat(0),e.setStyle("")})),fd(null),this.#fn(e).filter(nh).forEach((e=>this.#mn(e))),Ua(e,(()=>Bo())))}toggleCodeBlock(){const e=$i();if(!wi(e))return;if(this.#yn(wh("plain")))return;const t=this.#bn(e);if(t.every(vh))t.forEach((e=>this.#_n(e)));else{const e=wh("plain");t.at(-1).insertAfter(e),e.selectEnd(),this.insertAtCursor(...t)}}toggleBlockquote(){const e=$i();if(!wi(e))return;if(this.#yn(th()))return;const t=this.#fn(e);if(t.length>0&&t.every(nh))t.forEach((e=>this.#mn(e)));else{t.filter(nh).forEach((e=>this.#mn(e))),this.#xn(e);const n=this.#fn(e);if(0===n.length)return;const r=th();n[0].insertBefore(r),n.forEach((e=>r.append(e)))}}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=$i();e=wi(t)&&!t.isCollapsed()})),e}createLink(e){let t=null;return this.editor.update((()=>{const n=hi(e),r=cd(e);r.append(n);const i=$i();wi(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{fd(null),fd(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.#Cn();if(!r)return;const o=this.#Sn(r,i,e);-1!==o&&this.#wn(r,n,i,o,t)}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.#vn.bind(this));this.editor.update((()=>{const e=Hm.for(this.editorElement,n);if(e.$uploadFiles(),t&&e.nodes?.length){e.nodes.at(-1).selectEnd(),this.#kn()}}))}insertPendingAttachment(e){if(!this.editorElement.supportsAttachments)return null;let t=null;if(this.editor.update((()=>{const n=new Rm({file:e,uploadUrl:null,blobUrlTemplate:this.editorElement.blobUrlTemplate,editor:this.editor});this.insertAtCursor(n),t=n.getKey()}),{tag:Br}),!t)return null;const n=this.editor;return{setAttributes(e){n.update((()=>{const n=ys(t);if(!(n instanceof Rm))return;const r=n.showUploadedAttachment(e);r&&(t=r)}),{tag:Br})},setUploadProgress(e){n.update((()=>{const n=ys(t);n instanceof Rm&&(n.getWritable().progress=e)}),{tag:Br})},remove(){n.update((()=>{const e=ys(t);e&&e.remove()}))}}}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=ys(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&&ks(null)}const s=n.attachment?this.#En(t,n.attachment):this.#Tn(t);r.replace(s),o&&s.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=ys(e);if(!r)return;const i=r.getTopLevelElement()||r,o=n.attachment?this.#En(t,n.attachment):this.#Tn(t);i.insertAfter(o)}))}#yn(e){const t=$i();if(!wi(t))return!1;const n=t.anchor.getNode();return!!rl(n)&&(n.append(e),e.selectEnd(),!0)}#_n(e){const t=e.getChildren(),n=[[]];for(const e of t)Gr(e)?n.push([]):n[n.length-1].push(e.getTextContent());for(const t of n){const n=Bo(),r=t.join("");r&&n.append(hi(r)),e.insertBefore(n)}e.remove()}#pn(){if(this.selection.isInsideList)return;const e=$i();wi(e)&&this.#xn(e)}#xn(e){const t=e.anchor.getNode().getTopLevelElement(),n=e.focus.getNode().getTopLevelElement(),r=this.#fn(e);for(const e of r){if(!zo(e))continue;const r=e.getChildren();if(!r.some(Gr))continue;if(e!==t&&e!==n)continue;const i=[[]];for(const e of r)Gr(e)?(i.push([]),e.remove()):i[i.length-1].push(e);for(const t of i){if(0===t.length)continue;const n=Bo();t.forEach((e=>n.append(e))),e.insertBefore(n)}i.some((e=>e.length>0))&&e.remove()}}#bn(e){const t=new Set;for(const n of e.getNodes())t.add(Rc(n));return Array.from(t)}#fn(e){const t=new Set;for(const n of e.getNodes()){const e=n.getTopLevelElement();e&&t.add(e)}return Array.from(t)}#hn(e){if(e.every(Nm)){const t=Hm.for(this.editorElement,[]);return t.nodes=e,t.$insertUploadNodes(),!0}}#gn(e){this.editor.update((()=>{if(!e.getNextSibling()){const t=Bo();e.insertAfter(t),t.selectStart()}}))}#mn(e){const t=e.getChildren();0==t.length?e.insertBefore(Bo()):t.forEach((t=>{if(gi(t)&&""!==t.getTextContent().trim()){const n=Bo();n.append(t),e.insertBefore(n)}else Gr(t)||e.insertBefore(t)})),e.remove()}#un(e){for(const t of e.querySelectorAll("a")){const e=t.getAttribute("href")||"";""!==e&&"#"!==e||t.replaceWith(...t.childNodes)}}#dn(e){for(const t of e.querySelectorAll("td, th"))t.style.removeProperty("background-color"),t.style.removeProperty("background"),t.style.removeProperty("color")}#Cn(){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}}#Sn(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#wn(e,t,n,r,i){const o=e.getTextContent(),s=o.slice(0,r),l=o.slice(n),a=this.#Nn(e,t,s),c=this.#Nn(e,t,l||" ");e.replace(a);this.#An(a,i).insertAfter(c),this.#Ln(c.getParentOrThrow());const u=l?0:1;c.select(u,u)}#Nn(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)}#An(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#Ln(e){if(zo(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())}}#En(e,t={}){return new Bf({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#Tn(e){return bd(this.editor,Ag(e))[0]||Bo()}#vn(e){return Og(this.editorElement,"lexxy:file-accept",{file:e},!0)}#kn(){const e=$i();if(!wi(e))return;const t=e.anchor.getNode();if(!Wm(t))return;const n=Bo();t.append(n),n.selectStart()}}function Wm(e){return ko(e)&&rl(e)&&!Lo(e)}class Vm{static for(e){const t=[jm,qm,Zm,Gm].find((t=>t.handles(e)));return t?new t(e):e}constructor(e){this.selection=e}}class jm extends Vm{static handles(e){return Ic(e.anchor?.getNode(),Sh)}insertNodes(e){this.selection.isCollapsed()||this.selection.removeText(),Ha(this.selection);const t=this.selection.focus.getNode(),n=Ic(t,Sh),r=_a(n,(t.is(n)?0:t.getIndexWithinParent())+1,"previous");for(const t of e)t.isAttached()&&(r.getNodeAtCaret()&&ko(t)&&r.insert(Zr()),r.insert(this.#On(t)));r.getNodeAtCaret().selectEnd()}#On(e){return Gr(e)?e:(e.remove(),hi(e.getTextContent()))}}class qm extends Vm{static handles(e){return Ic(e.anchor?.getNode(),eh)}insertNodes(e){this.selection.isCollapsed()||this.selection.removeText(),Ha(this.selection);let t=this.selection.focus.getNode();for(const n of e)t=t.insertAfter(n);t.selectEnd()}}class Zm extends Vm{static handles(e){return Wm(e?.anchor.getNode())}insertNodes(e){const t=this.selection.anchor.getNode(),n=Bo();t.append(n),n.selectStart().insertNodes(e)}}class Gm extends Vm{static handles(e){return ki(e)}insertNodes(e){let t=this.selection.getNodes().at(-1);for(const n of e)t=t.insertAfter(n)}}function Jm(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ym={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Xm(e){Ym=e}var Qm={exec:()=>null};function ey(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(ty.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ty={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")},ny=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ry=/(?:[*+-]|\d{1,9}[.)])/,iy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,oy=ey(iy).replace(/bull/g,ry).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(),sy=ey(iy).replace(/bull/g,ry).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(),ly=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ay=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cy=ey(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ay).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),uy=ey(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ry).getRegex(),dy="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",hy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gy=ey("^ {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",hy).replace("tag",dy).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),py=ey(ly).replace("hr",ny).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",dy).getRegex(),fy={blockquote:ey(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",py).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:cy,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:ny,html:gy,lheading:oy,list:uy,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:py,table:Qm,text:/^[^\n]+/},my=ey("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ny).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",dy).getRegex(),yy={...fy,lheading:sy,table:my,paragraph:ey(ly).replace("hr",ny).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",my).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",dy).getRegex()},by={...fy,html:ey("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",hy).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:Qm,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ey(ly).replace("hr",ny).replace("heading"," *#{1,6} *[^\n]").replace("lheading",oy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},_y=/^( {2,}|\\)\n(?!\s*$)/,xy=/[\p{P}\p{S}]/u,Cy=/[\s\p{P}\p{S}]/u,Sy=/[^\s\p{P}\p{S}]/u,wy=ey(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Cy).getRegex(),vy=/(?!~)[\p{P}\p{S}]/u,ky=ey(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ey=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ty=ey(Ey,"u").replace(/punct/g,xy).getRegex(),Ny=ey(Ey,"u").replace(/punct/g,vy).getRegex(),Ay="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ly=ey(Ay,"gu").replace(/notPunctSpace/g,Sy).replace(/punctSpace/g,Cy).replace(/punct/g,xy).getRegex(),Oy=ey(Ay,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,vy).getRegex(),Fy=ey("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Sy).replace(/punctSpace/g,Cy).replace(/punct/g,xy).getRegex(),Iy=ey(/\\(punct)/,"gu").replace(/punct/g,xy).getRegex(),Ry=ey(/^<(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(),Py=ey(hy).replace("(?:--\x3e|$)","--\x3e").getRegex(),My=ey("^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",Py).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Dy=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,By=ey(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Dy).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),zy=ey(/^!?\[(label)\]\[(ref)\]/).replace("label",Dy).replace("ref",ay).getRegex(),$y=ey(/^!?\[(ref)\](?:\[\])?/).replace("ref",ay).getRegex(),Hy=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ky={_backpedal:Qm,anyPunctuation:Iy,autolink:Ry,blockSkip:ky,br:_y,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Qm,emStrongLDelim:Ty,emStrongRDelimAst:Ly,emStrongRDelimUnd:Fy,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:By,nolink:$y,punctuation:wy,reflink:zy,reflinkSearch:ey("reflink|nolink(?!\\()","g").replace("reflink",zy).replace("nolink",$y).getRegex(),tag:My,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Qm},Uy={...Ky,link:ey(/^!?\[(label)\]\((.*?)\)/).replace("label",Dy).getRegex(),reflink:ey(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Dy).getRegex()},Wy={...Ky,emStrongRDelimAst:Oy,emStrongLDelim:Ny,url:ey(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Hy).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:ey(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Hy).getRegex()},Vy={...Wy,br:ey(_y).replace("{2,}","*").getRegex(),text:ey(Wy.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},jy={normal:fy,gfm:yy,pedantic:by},qy={normal:Ky,gfm:Wy,breaks:Vy,pedantic:Uy},Zy={"&":"&","<":"<",">":">",'"':""","'":"'"},Gy=e=>Zy[e];function Jy(e,t){if(t){if(ty.escapeTest.test(e))return e.replace(ty.escapeReplace,Gy)}else if(ty.escapeTestNoEncode.test(e))return e.replace(ty.escapeReplaceNoEncode,Gy);return e}function Yy(e){try{e=encodeURI(e).replace(ty.percentDecode,"%")}catch{return null}return e}function Xy(e,t){let n=e.replace(ty.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(ty.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(ty.slashPipe,"|");return r}function Qy(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 eb(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 tb=class{options;rules;lexer;constructor(e){this.options=e||Ym}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:Qy(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=Qy(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:Qy(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Qy(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=Xy(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(Xy(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=Qy(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)),eb(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 eb(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}}}},nb=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ym,this.options.tokenizer=this.options.tokenizer||new tb,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:ty,block:jy.normal,inline:qy.normal};this.options.pedantic?(t.block=jy.pedantic,t.inline=qy.pedantic):this.options.gfm&&(t.block=jy.gfm,this.options.breaks?t.inline=qy.breaks:t.inline=qy.gfm),this.tokenizer.rules=t}static get rules(){return{block:jy,inline:qy}}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(ty.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(ty.tabCharGlobal," ").replace(ty.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}},rb=class{options;parser;constructor(e){this.options=e||Ym}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(ty.notSpaceStart)?.[0],i=e.replace(ty.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Jy(r)+'">'+(n?i:Jy(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:Jy(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+" "+Jy(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>${Jy(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=Yy(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+Jy(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=Yy(e);if(null===i)return Jy(n);let o=`<img src="${e=i}" alt="${n}"`;return t&&(o+=` title="${Jy(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Jy(e.text)}},ib=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""}},ob=class e{options;renderer;textRenderer;constructor(e){this.options=e||Ym,this.options.renderer=this.options.renderer||new rb,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ib}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}},sb=class{options;block;constructor(e){this.options=e||Ym}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?nb.lex:nb.lexInline}provideParser(){return this.block?ob.parse:ob.parseInline}},lb=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=ob;Renderer=rb;TextRenderer=ib;Lexer=nb;Tokenizer=tb;Hooks=sb;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 rb(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 tb(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 sb;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];sb.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&sb.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 nb.lex(e,t??this.defaults)}parser(e,t){return ob.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?nb.lex:nb.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?ob.parse:ob.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?nb.lex:nb.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?ob.parse:ob.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>"+Jy(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function ab(e,t){return lb.parse(e,t)}ab.options=ab.setOptions=function(e){return lb.setOptions(e),ab.defaults=lb.defaults,Xm(ab.defaults),ab},ab.getDefaults=Jm,ab.defaults=Ym,ab.use=function(...e){return lb.use(...e),ab.defaults=lb.defaults,Xm(ab.defaults),ab},ab.walkTokens=function(e,t){return lb.walkTokens(e,t)},ab.parseInline=lb.parseInline,ab.Parser=ob,ab.parser=ob.parse,ab.Renderer=rb,ab.TextRenderer=ib,ab.Lexer=nb,ab.lexer=nb.lex,ab.Tokenizer=tb,ab.Hooks=sb,ab.parse=ab,ab.options,ab.setOptions,ab.use,ab.walkTokens,ab.parseInline,ob.parse,nb.lex;class cb{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;if(!t||this.#Fn())return!1;if(this.#In(t))return this.#Rn(t),e.preventDefault(),!0;const n=this.#Pn(t);return n&&e.preventDefault(),n}#In(e){return this.#Mn(e)||this.#Dn(e)}#Mn(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#Dn(e){const t=Array.from(e.types);return 2===t.length&&t.includes("text/uri-list")&&t.includes("text/plain")}#Fn(){let e=!1;return this.editor.getEditorState().read((()=>{const t=$i();if(!wi(t))return;let n=t.anchor.getNode();for(;n;){if(vh(n))return void(e=!0);n=n.getParent()}})),e}#Rn(e){e.items[0].getAsString((t=>{if(wm(t)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(t);else if(wm(t)){const e=this.contents.createLink(t);this.#Bn(e,{url:t})}else this.editorElement.supportsMarkdown?this.#zn(t):this.#$n(e)}))}#Bn(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};Og(this.editorElement,"lexxy:insert-link",{...t,...n})}#zn(e){const t=Ag(ab(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)});Og(this.editorElement,"lexxy:insert-markdown",n),this.contents.insertDOM(t,{tag:zr})}#$n(e){this.editor.update((()=>{const t=$i();Ed(e,t,this.editor)}),{tag:zr})}#Pn(e){if(!this.editorElement.supportsAttachments)return!1;const t=e.getData("text/html"),n=e.files;return n.length&&this.#Hn(t)?(this.#Kn(n),!0):t&&!this.#Un(e)?(this.contents.insertHtml(t,{tag:zr}),!0):!!n.length&&(this.#Kn(n),!0)}#Un(e){return Array.from(e.types).includes("application/x-lexical-editor")}#Hn(e){if(!e)return!1;const t=Ag(e),n=Array.from(t.body.children);return 1===n.length&&"IMG"===n[0].tagName}#Kn(e){this.#Wn((()=>{e.length&&this.contents.uploadFiles(e,{selectLast:!0})}))}async#Wn(e){const t=window.scrollY,n=window.scrollX;e(),await Sm(),window.scrollTo(n,t),this.editor.focus()}}class ub{constructor(e){this.lexxyElement=e,this.enabledExtensions=this.#Vn()}get lexicalExtensions(){return this.enabledExtensions.map((e=>e.lexicalExtension)).filter(Boolean)}initializeToolbars(){const e=this.#jn;e&&(this.#qn(e),this.#Zn(e))}#qn(e){e.querySelectorAll("[data-lexxy-extension]").forEach((e=>e.remove()))}#Zn(e){this.enabledExtensions.forEach((t=>{const n=new Set(e.children);t.initializeToolbar(e);for(const t of e.children)n.has(t)||t.setAttribute("data-lexxy-extension","")}))}get allowedElements(){return this.enabledExtensions.flatMap((e=>e.allowedElements))}get#jn(){return this.lexxyElement.toolbar}get#Gn(){return this.lexxyElement.baseExtensions}get#Jn(){return Pf.global.get("extensions")}#Vn(){return this.#Gn.concat(this.#Jn).map((e=>new e(this.lexxyElement))).filter((e=>e.enabled))}}class db{frozenLinkKey=null;dispatchAttributesChange(e,t,n,r){}dispatchEditorInitialized(e){}freeze(){}thaw(){}unlinkFrozenNode(){return!1}}function hb(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")&&!gb(n,"strong")&&(r=pb(r,"b")),t.hasFormat("italic")&&!gb(n,"em")&&(r=pb(r,"i")),t.hasFormat("strikethrough")&&(r=pb(r,"s")),t.hasFormat("underline")&&(r=pb(r,"u")),{element:fb(r)}}function gb(e,t){const n=t.toUpperCase();return e.tagName===n||null!==e.querySelector(t)}function pb(e,t){const n=document.createElement(t);return n.appendChild(e),n}function fb(e){if("SPAN"===e.tagName)return e.firstChild;for(const t of e.querySelectorAll("span"))t.replaceWith(...t.childNodes);return e}class mb extends Qf{get lexicalExtension(){return{name:"lexxy/provisional-paragraph",nodes:[Om],register:e=>Na(e.registerNodeTransform(Ao,yb),e.registerNodeTransform(Ao,bb),e.registerCommand(rn,_b,3))}}}function yb(e){const t=e.getFirstChild();Om.neededBetween(null,t)&&zc(e,new Om);for(const t of Uc(e)){const e=t.getNextSibling();Om.neededBetween(t,e)&&t.insertAfter(new Om)}}function bb(e){for(const t of xb(e))t.removeUnlessRequired()}function _b(){for(const e of xb())e.markDirty()}function xb(e=ws()){return Kc(e.getChildren(),Fm)}const Cb="language";class Sb extends Qf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/trix-content",html:{import:{em:e=>wb(e,{conversion:Uf("i",sm),priority:1}),span:e=>wb(e,{conversion:Uf("mark",sm),priority:1}),strong:e=>wb(e,{conversion:Uf("b",sm),priority:1}),del:()=>({conversion:Uf("s",vb,sm),priority:1}),pre:e=>function(e,t){return e.hasAttribute(Cb)?t:null}(e,{conversion:Wf(Sh,"pre",kb),priority:1})}}}}}function wb(e,t){return""!==e.style.color||""!==e.style.backgroundColor?t:null}function vb(e){return e.hasFormat("strikethrough")||e.toggleFormat("strikethrough"),e}function kb(e,t){const n=og(t.getAttribute(Cb));e.node.setLanguage(n)}class Eb extends yf{$config(){return this.config("wrapped_table_node",{extends:yf})}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 Ng("figure",{className:"lexxy-content__table-wrapper"},(e=t.after(e)).cloneNode(!0).outerHTML)}return e}}}}class Tb extends Qf{get enabled(){return this.editorElement.supportsRichText}get allowedElements(){return["figure","tbody"]}get lexicalExtension(){return{name:"lexxy/tables",nodes:[Eb,{replace:yf,with:()=>new Eb,withKlass:Eb},Zg,tp],register:e=>(function(e){ff.add(e)}(e),Na(Nf(e),Tf(e,!0),e.registerNodeTransform(Zg,(e=>{null===e.getBackgroundColor()&&e.setBackgroundColor("")})),e.registerNodeTransform(Zg,(e=>{const t=e.getHeaderStyles();if(t!==qg)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()!==jg)),l=i.every((e=>{const t=e.getChildren()[o];return t&&t.getHeaderStyles()!==jg}));let a=jg;s&&(a|=qg),l&&(a|=Vg),a!==t&&e.setHeaderStyles(a,Wg)})),e.registerCommand("insertTableRowAfter",(()=>{hp(!0)}),2),e.registerCommand("insertTableRowBefore",(()=>{hp(!1)}),2),e.registerCommand("insertTableColumnAfter",(()=>{pp(!0)}),2),e.registerCommand("insertTableColumnBefore",(()=>{pp(!1)}),2),e.registerCommand("deleteTableRow",(()=>{!function(){const e=$i();wi(e)||Np(e)||ep(188);const[t,n]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[r,,i]=wp(t),[o]=wp(n),[s,l,a]=Cp(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&&ep(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?yp(p,n):r.insertAfter(n)}}}const t=i.getChildAtIndex(e);ip(t)||ep(206,String(e)),t.remove()}if(void 0!==g){const{cell:e}=g[0];mp(e)}else{const e=s[c-1],{cell:t}=e[0];mp(t)}}()}),2),e.registerCommand("deleteTableColumn",(()=>{!function(){const e=$i();wi(e)||Np(e)||ep(188);const t=e.anchor.getNode(),n=e.focus.getNode(),[r,,i]=wp(t),[o]=wp(n),[s,l,a]=Cp(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;mp(e)}else{const e=d<c?m[d-1]:m[c-1],{cell:t}=e;mp(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;sf(e.anchor.getNode())?.remove()}),2)))}}}class Nb{#Yn;#Xn=null;#Qn=null;#er=null;#e=new tc;constructor(e){this.#Yn=e,this.#e.track(e.registerCommand($n,(e=>this.#tr(e)),3),e.registerCommand(Bn,(e=>this.#oe(e)),3)),this.#e.track(e.registerRootListener(((e,t)=>{t&&(t.removeEventListener("dragover",this.#nr),t.removeEventListener("dragend",this.#rr)),e&&(e.addEventListener("dragover",this.#nr),e.addEventListener("dragend",this.#rr))})))}destroy(){this.#ir(),this.#e.dispose()}#tr(e){if(e.target.closest("textarea"))return!1;const t=e.target.closest("figure.attachment[data-lexical-node-key]");return!!t&&(this.#Xn=t.dataset.lexicalNodeKey,e.dataTransfer.setData("application/x-lexxy-node-key",this.#Xn),e.dataTransfer.effectAllowed="move",this.#er=requestAnimationFrame((()=>{this.#er=null,t.classList.add("lexxy-dragging")})),!0)}#nr=e=>{this.#Xn&&(e.preventDefault(),e.dataTransfer.dropEffect="move",this.#Qn||(this.#Qn=requestAnimationFrame((()=>{this.#Qn=null,this.#or(e)}))))};#oe(e){if(!this.#Xn)return!1;e.preventDefault();const t=this.#sr(e),n=this.#Xn;return this.#ir(),t&&this.#lr(n,t),!0}#rr=()=>{this.#ir()};#or(e){this.#ar();const t=this.#sr(e);t&&("gallery"===t.type||"gallery-reorder"===t.type?t.element.classList.add(`lexxy-drop-target--gallery-${t.position}`):"list-item"===t.type?t.element.classList.add(`lexxy-drop-target--list-${t.position}`):t.element.classList.add(`lexxy-drop-target--block-${t.position}`))}#sr(e){const t=document.elementFromPoint(e.clientX,e.clientY);if(!t)return null;const n=this.#Yn.getRootElement();if(!n||!n.contains(t))return null;const r=t.closest("figure.attachment--preview[data-lexical-node-key]");if(r&&r.dataset.lexicalNodeKey!==this.#Xn){const t=r.closest(".attachment-gallery");if(t){const i=n.querySelector(`[data-lexical-node-key="${this.#Xn}"]`);if(i&&t.contains(i)){const t=this.#cr(r,e.clientX);return{type:"gallery-reorder",element:r,nodeKey:r.dataset.lexicalNodeKey,position:t}}}const i=this.#cr(r,e.clientX);return{type:"gallery",element:r,nodeKey:r.dataset.lexicalNodeKey,position:i}}if(r&&r.closest(".attachment-gallery"))return null;const i=t.closest(".attachment-gallery");if(i){let n=t.closest("figure.attachment[data-lexical-node-key]");if(n||(n=this.#ur(i,e.clientX)),n&&n.dataset.lexicalNodeKey!==this.#Xn){const t=this.#cr(n,e.clientX);return{type:"gallery-reorder",element:n,nodeKey:n.dataset.lexicalNodeKey,position:t}}if(n)return null}const o=t.closest("li");if(o&&n.contains(o)){return{type:"list-item",element:o,position:this.#dr(o,e.clientY)}}const s=this.#hr(t,n,e.clientY);if(!s)return null;const l=this.#dr(s,e.clientY);return"before"===l&&s.previousElementSibling?{type:"block",element:s.previousElementSibling,position:"after"}:{type:"block",element:s,position:l}}#hr(e,t,n){let r=e;for(;r&&r!==t;){if(r.parentElement===t)return r;r=r.parentElement}let i=null,o=1/0;for(const e of t.children){const t=e.getBoundingClientRect(),r=Math.min(Math.abs(n-t.top),Math.abs(n-t.bottom));r<o&&(o=r,i=e)}return i}#dr(e,t){const n=e.getBoundingClientRect();return t<n.top+n.height/2?"before":"after"}#cr(e,t){const n=e.getBoundingClientRect();return t<n.left+n.width/2?"before":"after"}#ur(e,t){const n=e.querySelectorAll("figure.attachment[data-lexical-node-key]");let r=null,i=1/0;for(const e of n){const n=e.getBoundingClientRect(),o=n.left+n.width/2,s=Math.abs(t-o);s<i&&(i=s,r=e)}return r}static#gr=["lexxy-drop-target--gallery-before","lexxy-drop-target--gallery-after","lexxy-drop-target--list-before","lexxy-drop-target--list-after","lexxy-drop-target--block-before","lexxy-drop-target--block-after"];#ar(){const e=this.#Yn.getRootElement();if(e)for(const t of e.querySelectorAll("[class*='lexxy-drop-target--']"))t.classList.remove(...Nb.#gr)}#lr(e,t){const n=ys(e);n&&Nm(n)&&("gallery"===t.type?this.#pr(n,t.nodeKey,t.position):"gallery-reorder"===t.type?this.#fr(n,t.nodeKey,t.position):"list-item"===t.type?this.#mr(n,t):this.#yr(n,t),ks(null))}#pr(e,t,n){const r=ys(t);if(!r||!Nm(r))return;if(e.is(r))return;e.remove();$m(r)&&("before"===n?r.insertBefore(e):r.insertAfter(e))}#fr(e,t,n){const r=ys(t);r&&!e.is(r)&&(e.remove(),"before"===n?r.insertBefore(e):r.insertAfter(e))}#mr(e,t){const n=xs(t.element);if(!n||!qu(n))return;const r=n.getParent();if(!r||!ed(r))return;const i=r.getChildren(),o=i.indexOf(n);if(-1===o)return;const s="before"===t.position?o:o+1;if(e.remove(),0===s)r.insertBefore(e);else if(s>=i.length)r.insertAfter(e);else{const[,t]=dl(r,s);t.insertBefore(e)}}#yr(e,t){const n=xs(t.element);if(!n)return;const r=n.getTopLevelElement?.()||n;e.is(r)||(e.remove(),"before"===t.position?r.insertBefore(e):r.insertAfter(e))}#ir(){if(this.#ar(),this.#Xn){const e=this.#Yn.getRootElement();if(e){const t=e.querySelector(`[data-lexical-node-key="${this.#Xn}"]`);t?.classList.remove("lexxy-dragging")}}this.#Xn=null,this.#Qn&&(cancelAnimationFrame(this.#Qn),this.#Qn=null),this.#er&&(cancelAnimationFrame(this.#er),this.#er=null)}}const Ab=["alt","caption","content","content-type","data-direct-upload-id","data-sgid","filename","filesize","height","presentation","previewable","sgid","url","width"];class Lb extends Qf{get enabled(){return this.editorElement.supportsAttachments}get allowedElements(){return[{tag:Em.TAG_NAME,attributes:Ab}]}get lexicalExtension(){return{name:"lexxy/action-text-attachments",nodes:[Em,Rm,Dm],register(e){const t=new Nb(e);return Na(e.registerNodeTransform(Em,Ob),e.registerCommand(dn,Fb,2),(()=>t.destroy()))}}}}function Ob(e){const t=e.getParent();if(zo(t))if(1===t.getChildrenSize())t.replace(e);else{const n=e.getIndexWithinParent(),[r,i]=dl(t,n);r.insertAfter(e);for(const e of[r,i])e.isEmpty()&&e.remove()}}function Fb(e){const t=$i()?.anchor;return!!t&&(!!function(e,t){const n=e.getNode();if(!zm(n))return!1;const r=Kf(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=zo(t)&&t.isEmpty(),r=$m(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(!zm(e.getNode())||!Kf(e,!0)||!t)return!1;if(No(t))return!1;t.isEmpty()?t.remove():t.selectEnd();return!0}(t)))}class Ib extends Sh{$config(){return this.config("early_escape_code",{extends:Sh})}static $fromSelection(e){const t=e.anchor.getNode();return Ic(t,Ib)||(t instanceof Ib?t:null)}insertNewAfter(e,t){if(!e.isCollapsed())return super.insertNewAfter(e,t);if(this.#br(e)){qf(this);const e=Bo();return this.insertAfter(e),e}return super.insertNewAfter(e,t)}#br(e){if(!Vf(e))return!1;const t=this.getTextContent();return""===t||t.endsWith("\n")}}class Rb extends Uu{$config(){return this.config("early_escape_listitem",{extends:Uu})}insertNewAfter(e,t){return this.#_r(e)?this.#xr():super.insertNewAfter(e,t)}#_r(e){if(!Ic(this,eh))return!1;if(jf(this))return!0;const t=Ic(e.anchor.getNode(),Mo);return t&&jf(t)&&qu(t.getParent())}#xr(){const e=this.getParent();if(!e||!ed(e))return;const t=e.getParent();if(t&&nh(t)){if(this.getNextSiblings().some((e=>qu(e)&&!jf(e))))return this.#Cr()}const n=Bo();return e.insertAfter(n),this.remove(),n}#Cr(){const e=dl(this.getParent(),this.getIndexWithinParent());this.remove();const t=Bo();return e[0].insertAfter(t),e.forEach(qf),t}}class Pb extends Qf{get enabled(){return this.editorElement.supportsRichText}get lexicalExtension(){return{name:"lexxy/format-escape",nodes:[Ib,{replace:Sh,with:e=>new Ib(e.getLanguage()),withKlass:Ib},Rb,{replace:Uu,with:()=>new Rb,withKlass:Rb}],register:e=>Na(e.registerCommand(gn,(()=>function(){const e=Ic($i().anchor.getNode(),Mo);if(!e||!jf(e))return!1;const t=e.getParent();if(!t||!nh(t))return!1;e.getNextSiblings().filter((e=>!jf(e))).length>0?function(e,t){const n=dl(e,t.getIndexWithinParent());n[0].insertAfter(t),n.forEach(qf),t.selectEnd()}(t,e):(t.insertAfter(e),e.selectStart());return!0}()),3),e.registerCommand(Nn,(e=>function(e){const t=$i();if(!wi(t)||!t.isCollapsed())return!1;const n=Ib.$fromSelection(t);if(!n)return!1;if(Vf(t)&&!n.getNextSibling()){e?.preventDefault();const t=Bo();return n.insertAfter(t),t.selectEnd(),!0}return!1}(e)),2))}}}class Mb extends HTMLElement{static formAssociated=!0;static debug=!1;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#Sr="";#wr=document.createElement("textarea");#vr=null;#e=new tc;#kr=[];constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id||=Fg("lexxy-editor"),this.config=new Lm(this),this.extensions=new ub(this),this.editor=this.#Er(),this.#kr.push(this.editor),this.#kr.push(this.#e),this.contents=new Um(this),this.#kr.push(this.contents),this.selection=new Am(this),this.#kr.push(this.selection),this.clipboard=new cb(this),this.adapter=new db;const e=Cm.configureFor(this);this.#kr.push(e),this.#Tr(),this.#Nr(),this.toggleAttribute("connected",!0),this.#Ar(),this.valueBeforeDisconnect=null}disconnectedCallback(){this.#Lr(),this.valueBeforeDisconnect=this.value,this.#Or()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#h())),"required"===e&&this.isConnected&&(this.#wr.required=this.hasAttribute("required"),this.#Fr())}formResetCallback(){this.value=this.#Sr,this.editor.dispatchCommand(qn,void 0)}toString(){return null==this.cachedStringValue&&this.editor?.getEditorState().read((()=>{this.cachedStringValue=Db(ws())})),this.cachedStringValue}get form(){return this.internals.form}get name(){return this.getAttribute("name")}get toolbarElement(){return this.#Ir?(this.toolbar??=this.#Rr(),this.toolbar):null}get baseExtensions(){return[mb,om,Sb,Tb,Lb,Pb]}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")}registerAdapter(e){this.adapter=e,this.editor&&(this.#Lr(),this.#Pr(),this.#Mr())}freezeSelection(){this.adapter.freeze()}thawSelection(){this.adapter.thaw()}dispatchAttributesChange(){this.#Mr()}dispatchEditorInitialized(){this.#Pr()}get isSingleLineMode(){return this.hasAttribute("single-line")}get contentTabIndex(){return parseInt(this.editorContentElement?.getAttribute("tabindex")??"0")}focus(){this.editor.focus((()=>this.#Dr()))}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=Mf(_d(this.editor,null),this.#Br)})),this.cachedValue}set value(e){this.editor.update((()=>{Ys(Kr);const t=ws();t.clear(),t.append(...this.#zr(e)),t.selectEnd(),this.#$r(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#zr(e){e||(e="<p></p>");return bd(this.editor,Ag(`${e}`)).filter(this.#Hr).map(this.#Kr)}#Hr(e){return!Gr(e)&&(!gi(e)||""!==e.getTextContent().trim())}#Kr(e){if(!gi(e))return e;const t=Bo();return t.append(e),t}#Tr(){this.#Ur(),this.#Wr(),this.#Vr(),this.#jr(),this.#qr(),this.#Zr(),this.#Gr(),this.#Jr()}#Er(){this.editorContentElement||=this.#Yr(),this.appendChild(this.editorContentElement);const e=function(...e){return Nu.fromExtensions(e).buildEditor()}({name:"lexxy/core",namespace:"Lexxy",theme:Kg,nodes:this.#Xr,html:{export:new Map([[ri,hb],[Oh,hb]])}},...this.extensions.lexicalExtensions);return e.setRootElement(this.editorContentElement),e}get#Xr(){const e=[Bf];return this.supportsRichText&&e.push(eh,rh,Zu,Uu,Sh,Oh,ld,dd,Rg),e}#Yr(){const e=Ng("div",{classList:"lexxy-editor__content",contenteditable:!0,autocapitalize:"none",role:"textbox","aria-multiline":!0,"aria-label":this.#Qr,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#ei.forEach((t=>e.setAttribute(t.name,t.value))),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#Qr(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#ei(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#ti(e){const t=void 0!==this.#ti&&this.#ti!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#wr.value=this.isEmpty?"":e,t&&Og(this,"lexxy:change")}get#ti(){return this._internalFormValue}#Gr(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"<p></p>";this.value=this.#Sr=e}#Jr(){this.#e.track(ec(document,"turbo:before-cache",this.#ni))}#ni=e=>{this.#Or()};#Ur(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{this.#ri(),this.#ti=this.value,this.#$r(),this.#Fr(),this.#Mr()})))}#ri(){this.cachedValue=null,this.cachedStringValue=null}#Wr(){const e=[];if(this.supportsRichText){if(e.push(hh(this.editor),od(this.editor)),this.#ii(),this.#oi(),this.supportsMarkdown){const t=[...wg,Pg];e.push(Tg(this.editor,t),function(e,t){const n=t.filter((e=>"text-format"===e.type)).sort(((e,t)=>t.tag.length-e.tag.length));return 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((()=>ys(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=ys(a);if(!e||!gi(e))return;const n=e.getParent();null===n||vh(n)||Dg(e,i,t)}));break}}}))}(this.editor,t))}}else e.push(function(e){return Na(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)kd(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!!ja(t,!0)&&(n.preventDefault(),Za(t,r,!0),!0)}),0),e.registerCommand(wn,(e=>{const t=$i();if(!wi(t))return!1;const n=e,r=n.shiftKey;return!!ja(t,!1)&&(n.preventDefault(),Za(t,r,!1),!0)}),0),e.registerCommand(On,(t=>!!wi($i())&&(!$d||"ko-KR"!==navigator.language)&&(t.preventDefault(),e.dispatchCommand(dn,!0))),0),e.registerCommand(In,(t=>!!wi($i())&&(t.preventDefault(),e.dispatchCommand(dn,!1))),0),e.registerCommand(An,(t=>{if(!wi($i()))return!1;if(null!==t){if(($d||zd||Kd)&&Bd)return!1;t.preventDefault()}return e.dispatchCommand(hn,!1)}),0),e.registerCommand(Vn,(()=>($s(),!0)),0),e.registerCommand(Un,(t=>!!wi($i())&&(Ud(t,e),!0)),0),e.registerCommand(Wn,(t=>!!wi($i())&&(function(e,t){Ud(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=Dc(e,ClipboardEvent)?e.clipboardData:null;null!=n&&wi(t)&&kd(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:[]},e.push($g(this.editor,this.historyState,20)),this.#e.track(...e)}#ii(){let e=this.querySelector("lexxy-table-tools");e??=Ng("lexxy-table-tools"),this.append(e),this.#kr.push(e)}#oi(){sg(this.editor);let e=this.querySelector("lexxy-code-language-picker");e??=Ng("lexxy-code-language-picker"),this.append(e),this.#kr.push(e)}#Vr(){this.#e.track(this.editor.registerCommand(An,(e=>(e.ctrlKey||e.metaKey||!this.supportsMultiLine)&&(e.preventDefault(),!0)),2))}#jr(){this.#e.track(ec(this,"focusin",this.#si),ec(this,"focusout",this.#li))}#si(e){this.#ai(e.target)&&!this.currentlyFocused&&(this.#Mr(),Og(this,"lexxy:focus"),this.currentlyFocused=!0)}#li(e){this.#ai(e.relatedTarget)||(Og(this,"lexxy:blur"),this.currentlyFocused=!1)}#ai(e){return this.contains(e)||this.toolbarElement?.contains(e)}#Dr(){this.isEmpty&&this.selection.placeCursorAtTheEnd()}#Ar(){document.querySelector(":focus")||this.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===this&&this.focus()}#qr(){}#Zr(){this.#Ir&&(this.toolbarElement.setEditor(this),"function"==typeof this.toolbarElement.dispose&&this.#kr.push(this.toolbarElement),this.extensions.initializeToolbars())}#Rr(){const e=this.config.get("toolbar");return"string"==typeof e?document.getElementById(e):this.querySelector("lexxy-toolbar")??this.#ci()}get#Ir(){return this.supportsRichText&&!!this.config.get("toolbar")}#ci(){const e=Ng("lexxy-toolbar");return e.innerHTML=Nc.defaultTemplate,e.setAttribute("data-attachments",this.supportsAttachments),e.configure(this.config.get("toolbar")),this.prepend(e),e}#$r(){this.classList.toggle("lexxy-editor--empty",this.isEmpty)}#Fr(){this.#wr.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#wr.validity,this.#wr.validationMessage,this.editorContentElement)}get#Br(){return this.#ui.concat(this.extensions.allowedElements)}get#ui(){return Array.from(this.editor._htmlConversions.keys()).filter((e=>!e.startsWith("#")))}#Mr(){let e=null,t=null,n=null,r=null;this.editor.getEditorState().read((()=>{const i=$i();if(!wi(i))return;const o=this.selection.getFormat();if(0===Object.keys(o).length)return;const s=Ic(i.anchor.getNode(),ld);e={bold:{active:o.isBold,enabled:!0},italic:{active:o.isItalic,enabled:!0},strikethrough:{active:o.isStrikethrough,enabled:!0},code:{active:o.isInCode,enabled:!0},highlight:{active:o.isHighlight,enabled:!0},link:{active:o.isInLink,enabled:!0},quote:{active:o.isInQuote,enabled:!0},heading:{active:o.isInHeading,enabled:!0},"unordered-list":{active:o.isInList&&"bullet"===o.listType,enabled:!0},"ordered-list":{active:o.isInList&&"number"===o.listType,enabled:!0},undo:{active:!1,enabled:this.historyState?.undoStack.length>0},redo:{active:!1,enabled:this.historyState?.redoStack.length>0}},t=s?s.getURL():null,n=o.isHighlight?function(e){if(!wi(e))return null;let t=Fa(e.style);if(!t.color&&!t["background-color"]){const n=e.anchor.getNode();gi(n)&&(t=Fa(n.getStyle()))}const n=t.color||null,r=t["background-color"]||null;return n||r?{color:n,backgroundColor:r}:null}(i):null,r=o.headingTag??null})),e&&this.adapter.dispatchAttributesChange(e,t,n,r)}#Pr(){this.adapter&&this.adapter.dispatchEditorInitialized({highlightColors:this.#di,headingFormats:this.#hi})}#Nr(){this.#Lr(),this.#vr=requestAnimationFrame((()=>{this.#vr=null,this.isConnected&&this.adapter&&(Og(this,"lexxy:initialize"),this.#Pr())}))}#Lr(){null!=this.#vr&&(cancelAnimationFrame(this.#vr),this.#vr=null)}get#di(){const e=this.config.get("highlight.buttons");if(!e)return null;return{colors:this.#gi("color",e.color||[]),backgroundColors:this.#gi("background-color",e["background-color"]||[])}}get#hi(){return this.supportsRichText?[{label:"Normal",command:"setFormatParagraph",tag:null},{label:"Large heading",command:"setFormatHeadingLarge",tag:"h2"},{label:"Medium heading",command:"setFormatHeadingMedium",tag:"h3"},{label:"Small heading",command:"setFormatHeadingSmall",tag:"h4"}]:[]}#gi(e,t){const n=document.createElement("span");n.style.display="none",this.appendChild(n);const r=t.map((t=>{n.style.setProperty(e,t);const r=window.getComputedStyle(n).getPropertyValue(e);return n.style.removeProperty(e),{name:t,value:r}}));return n.remove(),r}#Or(){this.#Lr(),this.#pi(),this.editorContentElement?.remove(),this.editorContentElement=null,this.toolbar=null}#pi(){for(;this.#kr.length;)this.#kr.pop().dispose()}#h(){this.disconnectedCallback(),this.valueBeforeDisconnect=null,this.connectedCallback()}}function Db(e){if(e instanceof Bf)return e.getReadableTextContent();if(ko(e)){let t="";const n=e.getChildren();for(let e=0;e<n.length;e++){const r=n[e];Zf(r,n[e-1],e,n.length)||(t+=Db(r),ko(r)&&e!==n.length-1&&!r.isInline()&&(t+="\n\n"))}return t}return e.getTextContent()}class Bb extends HTMLElement{#e=new tc;connectedCallback(){this.container=this.closest("details"),this.#e.track(ec(this.container,"toggle",this.#fi),ec(this.container,"keydown",this.#mi)),this.#yi(this.initialize.bind(this))}disconnectedCallback(){this.#e.dispose()}get toolbar(){return this.closest("lexxy-toolbar")}get editorElement(){return this.toolbar.editorElement}get editor(){return this.toolbar.editor}track(...e){this.#e.track(...e)}initialize(){}close(){this.editor.focus(),this.container.open=!1}async#yi(e){await this.toolbar.editorElement,e()}#fi=()=>{this.container.open&&this.#bi()};async#bi(){this.#_i[0].focus(),this.#f()}#mi=e=>{"Escape"===e.key&&(e.stopPropagation(),this.close())};async#f(){await Sm(),this.#z.forEach(((e,t)=>{e.setAttribute("tabindex",0===t?0:"-1")}))}get#_i(){return Array.from(this.querySelectorAll("button, input"))}get#z(){return Array.from(this.querySelectorAll("button"))}}class zb extends Bb{connectedCallback(){super.connectedCallback(),this.input=this.querySelector("input"),this.track(ec(this.container,"toggle",this.#fi),ec(this.input,"keydown",this.#Vr),ec(this.linkButton,"click",this.#xi),ec(this.unlinkButton,"click",this.#Ci))}get linkButton(){return this.querySelector("[value='link']")}get unlinkButton(){return this.querySelector("[value='unlink']")}#fi=({newState:e})=>{this.input.value=this.#Si,this.input.required="open"===e};#Vr=e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),this.#xi(e))};#xi=()=>{this.input.checkValidity()?(this.editor.dispatchCommand("link",this.input.value),this.close()):this.input.reportValidity()};#Ci=()=>{this.editor.dispatchCommand("unlink"),this.close()};get#Si(){return this.editor.getEditorState().read((()=>{const e=this.editorElement.selection.nearestNodeOfType(ld);return e?.getUrl()??null}))}}const $b="button.lexxy-highlight-button",Hb="[data-command='removeHighlight']",Kb=Symbol("no_style");class Ub extends Bb{initialize(){this.#wi(),this.#vi()}connectedCallback(){super.connectedCallback(),this.track(ec(this.container,"toggle",this.#fi))}#vi(){this.#ki.forEach((e=>{this.track(ec(e,"click",this.#Ei))})),this.track(ec(this.querySelector(Hb),"click",this.#Ti))}#wi(){this.#Ni.innerHTML="";const e=this.editorElement.config.get("highlight.buttons");this.#Ai("color",e.color),this.#Ai("background-color",e["background-color"]);const t=Math.max(e.color.length,e["background-color"].length);this.style.setProperty("--max-colors",t)}#Ai(e,t){t.forEach(((t,n)=>{this.#Ni.appendChild(this.#Li(e,t,n))}))}#Li(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}#fi=({newState:e})=>{"open"===e&&this.editor.getEditorState().read((()=>{this.#Oi($i())}))};#Ei=e=>{e.preventDefault();const t=e.target.closest($b);if(!t)return;const n=t.dataset.style,r=t.dataset.value;this.editor.dispatchCommand("toggleHighlight",{[n]:r}),this.close()};#Ti=e=>{e.preventDefault(),this.editor.dispatchCommand("removeHighlight"),this.close()};#Oi(e){if(!wi(e))return;const t=Ja(e,"color",Kb),n=Ja(e,"background-color",Kb);this.#ki.forEach((e=>{const r=e.dataset.value===t||e.dataset.value===n;e.setAttribute("aria-pressed",r)}));const r=t!==Kb||n!==Kb;this.querySelector(Hb).disabled=!r}get#Ni(){return this.querySelector(".lexxy-highlight-colors")}get#ki(){return Array.from(this.querySelectorAll($b))}}class Wb{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=Ng("li",{role:"option",id:Fg("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=Ag(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class Vb extends Wb{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#Fi(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#Fi(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return vm(e).includes(vm(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class jb extends Vb{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class qb extends Vb{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class Zb extends Wb{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.#Ii(e));return this.#Fi(t)}#Ii(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#Fi(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 Gb extends HTMLElement{#Ri=new tc;#Pi=new tc;constructor(){super(),this.showPopoverId=0}static observedAttributes=["connected"];connectedCallback(){this.source=this.#Mi(),this.#Di(),this.toggleAttribute("connected",!0)}disconnectedCallback(){this.#Pi.dispose(),this.#Ri.dispose(),this.source=null,this.popoverElement=null}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#h()))}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#Bi(){return!this.supportsSpaceInSearches}#Mi(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new Zb(e):new qb(e):new jb(this.querySelectorAll("lexxy-prompt-item"))}#Di(){this.#Pi.track(this.#Yn.registerUpdateListener((({editorState:e})=>{e.read((()=>{if(this.#zi.isInsideCodeBlock)return;const{node:e,offset:t}=this.#zi.selectedNodeWithOffset();if(e&&gi(e)){const n=e.getTextContent(),r=this.trigger.length;if(t>=r){if(n.slice(t-r,t)===this.trigger){const e=t===r,i=t>r?n[t-r-1]:null;(e||(" "===i||"\n"===i))&&(this.#Pi.dispose(),this.#$i())}}}}))})))}#Hi(){this.#Pi.track(this.#Yn.registerUpdateListener((({editorState:e})=>{this.closed||e.read((()=>{if(this.#zi.isInsideCodeBlock)return void this.#Ki();const{node:e,offset:t}=this.#zi.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.#Ki()}else this.#Ki()}))})))}get#Yn(){return this.#q.editor}get#q(){return this.closest("lexxy-editor")}get#zi(){return this.#q.selection}async#$i(){const e=++this.showPopoverId;this.popoverElement??=await this.#Ui(),this.showPopoverId===e&&(this.#Wi(),await this.#Vi(),this.showPopoverId===e&&(this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#ji(),this.#Pi.track(ec(this.#q,"keydown",this.#qi),ec(this.#q,"lexxy:change",this.#Vi)),this.#Zi(),this.#Hi()))}#Zi(){this.#Pi.track(this.#Yn.registerCommand(An,this.#Gi.bind(this),4),this.#Yn.registerCommand(Rn,this.#Gi.bind(this),4)),this.#Bi&&this.#Pi.track(this.#Yn.registerCommand(Ln,this.#Gi.bind(this),4)),this.#Pi.track(this.#Yn.registerCommand(Tn,this.#Ji.bind(this),4),this.#Yn.registerCommand(Nn,this.#Yi.bind(this),4))}#Ji(e){return this.#Xi(),e.preventDefault(),!0}#Yi(e){return this.#Qi(),e.preventDefault(),!0}#ji(){const e=this.#eo[0];e&&this.#to(e)}get#eo(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#to(e){this.#no(),e.toggleAttribute("aria-selected",!0),e.scrollIntoView({block:"nearest",behavior:"smooth"}),e.focus(),this.#zi.preservingSelection((()=>{this.#q.focus()})),this.#ro.setAttribute("aria-controls",this.popoverElement.id),this.#ro.setAttribute("aria-activedescendant",e.id),this.#ro.setAttribute("aria-haspopup","listbox")}#no(){this.#eo.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#ro.removeAttribute("aria-controls"),this.#ro.removeAttribute("aria-activedescendant"),this.#ro.removeAttribute("aria-haspopup")}#io(){const{x:e,y:t,fontSize:n}=this.#zi.cursorPosition,r=this.#q.getBoundingClientRect(),i=this.#ro.getBoundingClientRect(),o=i.top-r.top;this.popoverElement.hasAttribute("data-anchored")||(this.#oo(e),this.#so(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.#so(i.height-t+n),this.popoverElement.toggleAttribute("data-clipped-at-bottom",!0))}#oo(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-x",`${e}px`)}#so(e){this.popoverElement.style.setProperty("--lexxy-prompt-offset-y",`${e}px`)}#Wi(){this.popoverElement.removeAttribute("data-clipped-at-bottom"),this.popoverElement.removeAttribute("data-clipped-at-right"),this.popoverElement.removeAttribute("data-anchored")}async#Ki(){this.showPopoverId++,this.#no(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#Pi.dispose(),await Sm(),this.#Di()}#Vi=async()=>{if(this.initialPrompt)this.initialPrompt=!1;else if(this.#lo.containsTextBackUntil(this.trigger)){if(await this.#ao(),!this.#lo.containsTextBackUntil(this.trigger))return void this.#Ki();await Sm(),this.#io()}else this.#Ki()};async#ao(){const e=this.showPopoverId,t=this.#lo.textBackUntil(this.trigger),n=await this.source.buildListItems(t);this.showPopoverId===e&&this.#lo.containsTextBackUntil(this.trigger)&&(this.popoverElement.innerHTML="",n.length>0?this.#co(n):this.#uo(),this.#ji())}#co(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#uo(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=Ng("li",{innerHTML:this.#do});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#do(){return this.getAttribute("empty-results")||"Nothing found"}#qi=e=>{"Escape"===e.key?(this.#Ki(),this.#q.focus(),e.stopPropagation()):","===e.key&&(e.preventDefault(),e.stopPropagation(),this.#ho(),this.#Yn.update((()=>{const e=$i();wi(e)&&e.insertText(",")})))};#Qi(){const e=this.#go+1;e<this.#eo.length&&this.#to(this.#eo[e])}#Xi(){const e=this.#go-1;e>=0&&this.#to(this.#eo[e])}get#go(){return this.#eo.findIndex((e=>e.hasAttribute("aria-selected")))}get#po(){return this.#eo[this.#go]}#Gi(e){return e.preventDefault(),e.stopPropagation(),this.#ho(),!0}#ho(){this.#fo(),this.#Ki(),this.#q.focus()}#fo(){const e=this.source.promptItemFor(this.#po);if(!e)return;const t=Array.from(e.querySelectorAll("template[type='editor']")),n=`${this.trigger}${this.#lo.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#mo(t,n):this.#yo(t,n,e.getAttribute("sgid"))}#mo(e,t){this.#Yn.update((()=>{const n=e.flatMap((e=>this.#bo(e)));this.#lo.replaceTextBackUntil(t,n)}))}#bo(e){return bd(this.#Yn,Ag(`${e.innerHTML}`))}#yo(e,t,n=null){this.#Yn.update((()=>{const r=this.#_o(e,n).flatMap((e=>[e,this.#xo()])).slice(0,-1);this.#lo.replaceTextBackUntil(t,r)}))}#_o(e,t=null){return e.map((e=>this.#Co(e.innerHTML,e.getAttribute("content-type")||this.#So,e.getAttribute("sgid")||t)))}#xo(){return hi(" ")}get#So(){return`application/vnd.${Pf.global.get("attachmentContentTypeNamespace")}.${this.name}`}#Co(e,t,n){return new Bf({sgid:n,contentType:t,innerHtml:e})}get#lo(){return this.#q.contents}get#ro(){return this.#q.editorContentElement}async#Ui(){const e=Ng("ul",{role:"listbox",id:Fg("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",Qa()),e.append(...await this.source.buildListItems()),this.#Ri.track(ec(e,"click",this.#wo)),this.#q.appendChild(e),e}#wo=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#to(t),this.#ho())};#h(){this.disconnectedCallback(),this.connectedCallback()}}class Jb extends HTMLElement{#vo=null;#e=new tc;connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.#vo=new AbortController,this.#e.track((()=>this.#vo?.abort())),this.#ko(),this.#Eo(),this.#To()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose()}#ko(){this.languagePickerElement=this.#No()??this.#Ao();const e=this.#vo.signal;this.#e.track(ec(this.languagePickerElement,"change",(()=>{this.#Lo(this.languagePickerElement.value)}),{signal:e})),this.#e.track(ec(this.languagePickerElement,"mousedown",(e=>{this.#Oo(e)}),{signal:e})),this.languagePickerElement.setAttribute("nonce",Qa()),this.appendChild(this.languagePickerElement)}#No(){return this.querySelector("select")}#Ao(){const e=Ng("select",{className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#Fo)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#Fo(){const e={...ig};e.ruby||="Ruby",e.php||="PHP",e.go||="Go",e.bash||="Bash",e.json||="JSON",e.diff||="Diff",delete e.plain;const t=Object.entries(e).sort(((e,t)=>e[1].localeCompare(t[1])));return{plain:"Plain text",...Object.fromEntries(t)}}#Oo(e){!Og(this.editorElement,"lexxy:code-language-picker-open",{languages:this.#Io,currentLanguage:this.languagePickerElement.value},!0)&&e.preventDefault()}get#Io(){return Object.entries(this.#Fo).map((([e,t])=>({key:e,name:t})))}#Lo(e){this.editor.update((()=>{const t=this.#Ro();t&&t.setLanguage(e)}))}#To(){this.#e.track(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{const e=this.#Ro();e?this.#Po(e):this.#Eo()}))})))}#Ro(){return this.editorElement.selection.nearestNodeOfType(Sh)}#Po(e){const t=e.getLanguage();this.#Mo(t),this.#Do(),this.#Bo(e)}#Mo(e){if(this.languagePickerElement&&e){const t=og(e);this.languagePickerElement.value=t}}#Bo(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`}#Do(){this.hidden=!1}#Eo(){this.hidden=!0}}class Yb extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.classList.add("lexxy-floating-controls"),this.querySelector(".lexxy-node-delete")||this.#zo()}disconnectedCallback(){this.editor=null,this.editorElement=null}#zo(){const e=Ng("div",{className:"lexxy-floating-controls__group"});this.deleteButton=Ng("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.#$o(),this.deleteButton.addEventListener("click",this.handleDeleteClick),e.appendChild(this.deleteButton),this.appendChild(e)}#$o(){this.editor.update((()=>{const e=xs(this);e?.remove()}))}}class Xb{#e=new tc;constructor(e){this.editor=e.editor,this.contents=e.contents,this.selection=e.selection,this.currentTableNodeKey=null,this.currentCellKey=null,this.#Ho()}destroy(){this.currentTableNodeKey=null,this.currentCellKey=null,this.#e.dispose()}get currentCell(){return this.currentCellKey?this.editor.getEditorState().read((()=>{const e=ys(this.currentCellKey);return e instanceof Zg?e:null})):null}get currentTableNode(){return this.currentTableNodeKey?this.editor.getEditorState().read((()=>{const e=ys(this.currentTableNodeKey);return e instanceof yf?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=cp(e);return up(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 cp(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=of(r),t=sf(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.#Ko(e,t):this.#Uo(e):this.#Wo()}#Ko(e,t=null){this.#Vo(),this.editor.dispatchCommand(this.#jo(e)),this.#qo(e,t)}#Uo(e){const t=e.childType;let n=null,r=null;"row"===t?(n=this.currentRowCells,r=qg):"column"===t&&(n=this.currentColumnCells,r=Vg),n&&0!==n.length&&this.editor.update((()=>{const e=ap(n[0]);if(!e)return;const t=e.getHeaderStyles()^r;n.forEach((e=>{this.#Zo(e,t,r)}))}))}#Wo(){this.#Vo(),this.editor.dispatchCommand("deleteTable")}#Vo(){this.editor.update((()=>{const e=$i();if(!e)return;const t=e.getNodes()[0];of(t)?.selectEnd()}))}#jo(e){const{action:t,childType:n,direction:r}=e;return`${t}Table${km(n)}${"insert"==t?km(r):""}`}#Zo(e,t,n){const r=ap(e);r?.setHeaderStyles(t,n)}async#Go(e,t){if(await Sm(),!this.currentTableNode)return;const n=this.tableRows;if(!n)return;const r=n[e];r&&this.editor.update((()=>{const e=ap(r.getChildAtIndex(t));e?.selectEnd()}))}#qo(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.#Go(i,o)}#Jo(){const e=this.tableRows;if(!e)return;const t=e.at(this.currentRowIndex+1);t&&this.editor.update((()=>{t.getChildAtIndex(this.currentColumnIndex)?.selectEnd()}))}#Yo(){const e=this.currentCell;e&&this.editor.update((()=>{e.selectPrevious()}))}#Xo(){this.executeTableCommand({action:"insert",childType:"row",direction:"after"},0)}#Qo(){this.executeTableCommand({action:"delete",childType:"row"},-1)}#es(){const e=this.currentTableNode;this.executeTableCommand({action:"delete",childType:"row"}),this.editor.update((()=>{const t=e?.getNextSibling();if(zo(t))t.selectStart();else{const e=Bo();this.currentTableNode.insertAfter(e),e.selectStart()}}))}#ts(){if(!this.currentTableNode)return!1;const e=this.currentCell;return!!e&&""===e.getTextContent().trim()}#ns(){if(!this.currentTableNode)return!1;const e=this.tableRows;return!!e&&e.length===this.currentRowIndex+1}#rs(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&e.every((e=>""===e.getTextContent().trim()))}#is(){if(!this.currentTableNode)return!1;const e=this.currentRowCells;return!!e&&0===e.indexOf(this.currentCell)}#Ho(){this.#e.track(this.editor.registerCommand(On,(e=>this.#os(e)),3),this.editor.registerCommand(An,(e=>this.#ss(e)),3))}#os(e){return!!this.currentTableNode&&(this.#rs()&&this.#is()?(e.preventDefault(),this.#Qo(),!0):!(!this.#ts()||this.#is())&&(e.preventDefault(),this.#Yo(),!0))}#ss(e){return!(e.ctrlKey||e.metaKey||e.shiftKey||!this.currentTableNode)&&(!this.selection.isInsideList&&!this.selection.isInsideCodeBlock&&(e.preventDefault(),this.#ns()&&this.#rs()?this.#es():this.#ns()?this.#Xo():this.#Jo(),!0))}}var Qb={"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 e_ extends HTMLElement{#e=new tc;connectedCallback(){this.tableController=new Xb(this.#q),this.classList.add("lexxy-floating-controls"),this.#wi(),this.#Eo(),this.#ls(),this.#as()}disconnectedCallback(){this.dispose()}dispose(){this.#e.dispose(),this.tableController?.destroy(),this.tableController=null}get#Yn(){return this.#q.editor}get#q(){return this.closest("lexxy-editor")}get#cs(){return Array.from(this.querySelectorAll("button, details > summary"))}#wi(){this.innerHTML="",this.appendChild(this.#us()),this.appendChild(this.#ds()),this.appendChild(this.#hs()),this.#e.track(ec(this,"keydown",this.#gs))}#ps(e,t,n){const r=Ng("div",{className:`lexxy-floating-controls__group lexxy-table-control lexxy-table-control--${e}`}),i=this.#Li(`Add ${e}`,{action:"insert",childType:e,direction:"after"},"+"),o=this.#Li(`Remove ${e}`,{action:"delete",childType:e},"−"),s=Ng("details",{className:"lexxy-table-control__more-menu"});s.setAttribute("name","lexxy-dropdown"),s.tabIndex=-1;const l=Ng("summary",{},`_ ${e}s`);return t(l),s.appendChild(l),s.appendChild(n),r.appendChild(o),r.appendChild(s),r.appendChild(i),r}#us(){return this.#ps("row",(e=>{this.rowCount=e}),this.#fs("row"))}#ds(){return this.#ps("column",(e=>{this.columnCount=e}),this.#fs("column"))}#fs(e){const t=Ng("div",{className:"lexxy-floating-controls__group lexxy-table-control__more-menu-details"}),n=this.#Li(`Add ${e} before`,{action:"insert",childType:e,direction:"before"}),r=this.#Li(`Add ${e} after`,{action:"insert",childType:e,direction:"after"}),i=this.#Li(`Toggle ${e} style`,{action:"toggle",childType:e}),o=this.#Li(`Remove ${e}`,{action:"delete",childType:e});return t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(o),t}#hs(){const e=Ng("div",{className:"lexxy-table-control lexxy-floating-controls__group"}),t=this.#Li("Delete this table?",{action:"delete",childType:"table"});return t.classList.add("lexxy-table-control__button--delete-table"),e.appendChild(t),this.deleteContainer=e,e}#Li(e,t={},n=this.#ms(t)){const r=Ng("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.#ys(t))),r.addEventListener("mouseover",(()=>this.#bs())),r.addEventListener("focus",(()=>this.#bs())),r.addEventListener("mouseout",(()=>this.#bs())),r}#as(){this.#e.track(this.#Yn.registerCommand(Sn,this.#_s,3))}#_s=e=>{if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F10"===e.key){const e=this.querySelector("button, [tabindex]:not([tabindex='-1'])");e?.focus()}};#gs=e=>{"Escape"===e.key?this.#xs():nc(this.#cs,e)};#xs(){const e=this.tableController.currentCell;e&&(this.#Yn.update((()=>{e.select(),this.#Yn.focus()})),this.#Cs())}async#bs(){await Sm(),this.#Ss();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.#Yn.getElementByKey(e.getKey());n&&(n.classList.toggle(Kg.tableCellHighlight,!0),Object.assign(n.dataset,t))}))}#ls(){this.#e.track(this.#Yn.registerUpdateListener((()=>{this.tableController.updateSelectedTable();this.tableController.currentTableNode?this.#Do():this.#Eo()})))}#ys(e){this.tableController.executeTableCommand(e),this.#Cs()}#Do(){this.#ws(),this.style.display="flex",this.#vs(),this.#ks(),this.#bs()}#Eo(){this.style.display="none",this.#Ss()}#Cs(){this.#ws(),this.#vs(),this.#ks(),this.#bs()}#ks(){this.querySelector("details[open]")?.removeAttribute("open")}#ws(){const e=this.tableController.currentTableNode;if(!e)return;const t=this.#Yn.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.#q.getBoundingClientRect(),i=n.top-r.top,o=(n.left+n.right)/2-r.left;this.style.top=`${i}px`,this.style.left=`${o}px`}#vs(){const e=this.tableController.currentTableNode;if(!e)return;const t=bf(this.#Yn,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"}`}#Es(){const e=this.tableController.currentCell;if(!e)return;const t=this.#Yn.getElementByKey(e.getKey());t&&t.classList.add(Kg.tableCellFocus)}#Ss(){this.#q.querySelectorAll(`.${Kg.tableCellFocus}`)?.forEach((e=>{e.classList.remove(Kg.tableCellFocus)})),this.#q.querySelectorAll(`.${Kg.tableCellHighlight}`)?.forEach((e=>{e.classList.remove(Kg.tableCellHighlight),e.removeAttribute("data-action"),e.removeAttribute("data-child-type"),e.removeAttribute("data-direction")})),this.#Es()}#ms(e){const{action:t,childType:n}=e,r=[t,n,"insert"==t?e.direction:null].filter(Boolean).join("-");return Qb[r]}}function t_(){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;const i=function(e){const t=[],n=e.querySelector("code")||e;let r=0;function i(e){if(e.nodeType===Node.TEXT_NODE)r+=e.textContent.length;else if(e.nodeType===Node.ELEMENT_NODE){if("BR"===e.tagName)return void(r+=1);const n="MARK"===e.tagName,o=r;for(const t of e.childNodes)i(t);if(n){const n=function(e){const t=[];e.style?.color&&t.push(`color: ${e.style.color};`);e.style?.backgroundColor&&t.push(`background-color: ${e.style.backgroundColor};`);return t.length>0?t.join(" "):null}(e);n&&t.push({start:o,end:r,style:n})}}}for(const e of n.childNodes)i(e);return t}(e);n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const s=o.highlight(n,r,t),l=Ng("code",{"data-language":t,innerHTML:s});i.length>0&&function(e,t){for(const{start:n,end:r,style:i}of t)n_(e,n,r,i)}(l,i);e.replaceWith(l)}(e)}))}function n_(e,t,n,r){const i=function(e){const t=[];let n=0;const r=document.createTreeWalker(e,4);let i;for(;i=r.nextNode();){const e=i.textContent.length;t.push({node:i,start:n,end:n+e}),n+=e}return t}(e);for(let e=i.length-1;e>=0;e--){const{node:o,start:s,end:l}=i[e],a=Math.max(t,s),c=Math.min(n,l);if(a>=c)continue;const u=a-s,d=c-s,h=o.textContent,g=o.parentNode,p=document.createElement("mark");p.setAttribute("style",r),p.textContent=h.slice(u,d),d<h.length&&g.insertBefore(document.createTextNode(h.slice(d)),o.nextSibling),g.insertBefore(p,o.nextSibling),u>0?o.textContent=h.slice(0,u):g.removeChild(o)}}class r_{frozenLinkKey=null;constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement}dispatchAttributesChange(e,t,n,r){Og(this.editorElement,"lexxy:attributes-change",{attributes:e,link:t?{href:t}:null,highlight:n,headingTag:r})}dispatchEditorInitialized(e){Og(this.editorElement,"lexxy:editor-initialized",e)}freeze(){let e=null;this.editorElement.editor?.getEditorState().read((()=>{const t=$i();if(!wi(t))return;const n=Ic(t.anchor.getNode(),ld);n&&(e=n.getKey())})),this.frozenLinkKey=e,this.editorContentElement.contentEditable="false"}thaw(){this.editorContentElement.contentEditable="true"}unlinkFrozenNode(){const e=this.frozenLinkKey;if(!e)return!1;const t=ys(e);if(!ud(t))return this.frozenLinkKey=null,!1;const n=t.getChildren();for(const e of n)t.insertBefore(e);t.remove();const r=this.#Ts(n),i=this.#Ns(n);if(r&&i){const e=$i();wi(e)&&(e.anchor.set(r.getKey(),0,"text"),e.focus.set(i.getKey(),i.getTextContent().length,"text"))}return this.frozenLinkKey=null,!0}#Ts(e){for(const t of e){if(gi(t))return t;if(ko(t)){const e=this.#Ts(t.getChildren());if(e)return e}}return null}#Ns(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(gi(n))return n;if(ko(n)){const e=this.#Ns(n.getChildren());if(e)return e}}return null}}const i_=Pf.configure;setTimeout((function(){const e={"lexxy-toolbar":Nc,"lexxy-editor":Mb,"lexxy-link-dropdown":zb,"lexxy-highlight-dropdown":Ub,"lexxy-prompt":Gb,"lexxy-code-language-picker":Jb,"lexxy-node-delete-button":Yb,"lexxy-table-tools":e_};Object.entries(e).forEach((([e,t])=>{customElements.define(e,t)}))}),0);export{Tm as $createActionTextAttachmentNode,Mm as $createActionTextAttachmentUploadNode,Nm as $isActionTextAttachmentNode,Em as ActionTextAttachmentNode,Rm as ActionTextAttachmentUploadNode,Bf as CustomActionTextAttachmentNode,Qf as Extension,Rg as HorizontalDividerNode,r_ as NativeAdapter,i_ as configure,t_ as highlightCode};
|