diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c423d77a4..f4641eba9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,21 @@ jobs: ruby-version: ruby-3.3.7 bundler-cache: true - - name: Lint code for consistent style + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install JavaScript dependencies + run: yarn install --frozen-lockfile + + - name: Lint Ruby code for consistent style run: bin/rubocop -f github + - name: Lint JavaScript code for consistent style + run: yarn lint + test: runs-on: ubuntu-latest diff --git a/app/assets/javascript/lexxy.js b/app/assets/javascript/lexxy.js index 3def1095c..e2a1fc246 100644 --- a/app/assets/javascript/lexxy.js +++ b/app/assets/javascript/lexxy.js @@ -1337,7 +1337,7 @@ var purify = createDOMPurify(); purify.addHook("uponSanitizeElement", (node, data) => { if (data.tagName === "strong" || data.tagName === "em") { - node.removeAttribute('class'); + node.removeAttribute("class"); } }); @@ -1351,10 +1351,10 @@ purify.addHook("uponSanitizeElement", (node, data) => { function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const e="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,n=e&&"documentMode"in document?document.documentMode:null,r=e&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),i=e&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!e||!("InputEvent"in window)||n)&&"getTargetRanges"in new window.InputEvent("input"),o=e&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),l=e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=e&&/Android/.test(navigator.userAgent),a=e&&/^(?=.*Chrome).*/i.test(navigator.userAgent),u=e&&c&&a,f$1=e&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!a;function d$2(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}const h$4=1,g$3=3,_$3=9,p$1=11,y$4=0,m$4=1,x$3=2,C$3=0,S$4=1,v$4=2,b$2=4,N$3=8,A$2=128,O$3=1792|(112|(3|b$2|N$3)|A$2),D$4=1,P$3=2,F$2=3,L$3=4,I$5=5,z$5=6,K$3=o||l||f$1?" ":"​",B$3="\n\n",R$5=i?" ":K$3,W$4="֑-߿יִ-﷽ﹰ-ﻼ",J$5="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",U$4=new RegExp("^[^"+J$5+"]*["+W$4+"]"),$$3=new RegExp("^[^"+W$4+"]*["+J$5+"]"),j$4={bold:1,capitalize:1024,code:16,highlight:A$2,italic:2,lowercase:256,strikethrough:b$2,subscript:32,superscript:64,underline:N$3,uppercase:512},V$3={directionless:1,unmergeable:2},Y$3={center:P$3,end:z$5,justify:L$3,left:D$4,right:F$2,start:I$5},H$1={[P$3]:"center",[z$5]:"end",[L$3]:"justify",[D$4]:"left",[F$2]:"right",[I$5]:"start"},q$4={normal:0,segmented:2,token:1},G$4={[C$3]:"normal",[v$4]:"segmented",[S$4]:"token"},X$4="$";function Q$3(t,e,n,r,i,s){let o=t.getFirstChild();for(;null!==o;){const t=o.__key;o.__parent===e&&(di(o)&&Q$3(o,t,n,r,i,s),n.has(t)||s.delete(t),i.push(t)),o=o.getNextSibling();}}const Z$3=100;let tt$2=false,et$2=0;function nt$2(t){et$2=t.timeStamp;}function rt$3(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==ds(t,n)}function it$4(t,e,n){const r=lo(Xs(n));let i=null,s=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,s=r.focusOffset);const o=t.nodeValue;null!==o&&Ns(e,o,i,s,false);}function st$3(t,e,n){if(cr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return false}return ts(e)&&n.isAttached()}function ot$3(t,e,n,r){for(let i=t;i&&!No(i);i=$s(i)){const t=ds(i,e);if(void 0!==t){const e=us(t,n);if(e)return _i(e)||!fo(i)?void 0:[i,e]}else if(i===r)return [r,ys(n)]}}function lt$2(t,e,n){tt$2=true;const r=performance.now()-et$2>Z$3;try{ci(t,(()=>{const s=Nr()||function(t){return t.getEditorState().read((()=>{const t=Nr();return null!==t?t.clone():null}))}(t),o=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n0){let e=0;for(let i=0;i0)for(const[e,n]of o)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e{lt$2(t,e,n);}));}let pt$4 = class pt{constructor(t,e=new Map,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedConfigMap=e,this.unknownState=n,this.knownState=r;const s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++;}return r}(e,n,r);this.size=s;}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n);}return n}getInternalState(){return [this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);return yt$4(t)?{[X$4]:t}:{}}getWritable(t){if(this.node===t)return this;const e=new Map(this.knownState),n=yt$4(r=this.unknownState)&&{...r};var r;if(n)for(const t of e.keys())delete n[t.key];return new pt(t,this.sharedConfigMap,yt$4(n),e,this.size)}updateFromKnown(t,e){const n=t.key;this.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||this.size++,r.set(t,e);}updateFromUnknown(t,e){const n=this.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e);}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState={},t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n);this.unknownState=yt$4(this.unknownState);}};function yt$4(t){if(t)for(const e in t)return t}function mt$4(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new pt$4(e);return e.__state=n,n}function xt$3(t,e){const n=t.__mode,r=t.__format,i=t.__style,s=e.__mode,o=e.__format,l=e.__style,c=t.__state,a=e.__state;return (null===n||n===s)&&(null===r||r===o)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return true;if(t&&e&&t.size!==e.size)return false;const n=new Set,r=(t,e)=>{for(const[r,i]of t.knownState){if(n.has(r.key))continue;n.add(r.key);const t=e?e.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return true}return false},i=(t,e)=>{const{unknownState:r}=t,i=e?e.unknownState:void 0;if(r)for(const[t,e]of Object.entries(r))if(!n.has(t)&&(n.add(t),e!==(i?i[t]:void 0)))return true;return false};return !(t&&r(t,e)||e&&r(e,t)||t&&i(t,e)||e&&i(e,t))}(c,a))}function Ct$2(t,e){const n=t.mergeWithSibling(e),r=qr()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function St$3(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Qn(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(xt$3(e,r)){r=Ct$2(e,r);break}break}e.remove();}for(;null!==(n=r.getNextSibling())&&Qn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(xt$3(r,n)){r=Ct$2(r,n);break}break}n.remove();}}else r.remove();}function vt$4(t){return kt$1(t.anchor),kt$1(t.focus),t}function kt$1(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=true):(r=e.getChildAtIndex(n),i=false),Qn(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",true);break}if(!di(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",true);}}let Tt$3,bt$1,Nt$3,wt$3,Et$2,Mt$1,At$1,Ot$1,Dt$1,Pt$2,Ft$2="",Lt$2="",It$2=null,zt="",Kt="",Bt$1=false,Rt$1=false,Wt=null;function Jt(t,e){const n=At$1.get(t);if(null!==e){const n=se$1(t);n.parentNode===e&&e.removeChild(n);}if(Ot$1.has(t)||bt$1._keyToDOMMap.delete(t),di(n)){const t=te(n,At$1);Ut(t,0,t.length-1,null);} void 0!==n&&Is(Pt$2,Nt$3,wt$3,n,"destroyed");}function Ut(t,e,n,r){let i=e;for(;i<=n;++i){const e=t[i];void 0!==e&&Jt(e,r);}}function $t$1(t,e){t.setProperty("text-align",e);}const jt="40px";function Vt(t,e){const n=Tt$3.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n);}const r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||jt;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`);}function Yt(t,e){const n=t.style;0===e?$t$1(n,""):e===D$4?$t$1(n,"left"):e===P$3?$t$1(n,"center"):e===F$2?$t$1(n,"right"):e===L$3?$t$1(n,"justify"):e===I$5?$t$1(n,"start"):e===z$5&&$t$1(n,"end");}function Ht(e,n){const r=Ot$1.get(e);void 0===r&&t(60);const i=r.createDOM(Tt$3,bt$1);if(function(t,e,n){const r=n._keyToDOMMap;((function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n;}))(e,n,t),r.set(t,e);}(e,i,bt$1),Qn(r)?i.setAttribute("data-lexical-text","true"):_i(r)&&i.setAttribute("data-lexical-decorator","true"),di(r)){const t=r.__indent,e=r.__size;if(0!==t&&Vt(i,t),0!==e){const t=e-1;!function(t,e,n,r){const i=Lt$2;Lt$2="",qt(t,n,0,e,n.getDOMSlot(r)),Qt(n,r),Lt$2=i;}(te(r,Ot$1),t,r,i);}const n=r.__format;0!==n&&Yt(i,n),r.isInline()||Xt(null,r,i),Js(r)&&(Ft$2+=B$3,Kt+=B$3);}else {const t=r.getTextContent();if(_i(r)){const t=r.decorate(bt$1,Tt$3);null!==t&&ne(e,t),i.contentEditable="false";}else Qn(r)&&(r.isDirectionless()||(Lt$2+=t));Ft$2+=t,Kt+=t;}return null!==n&&n.insertChild(i),Is(Pt$2,Nt$3,wt$3,r,"created"),i}function qt(t,e,n,r,i){const s=Ft$2;Ft$2="";let o=n;for(;o<=r;++o){Ht(t[o],i);const e=Ot$1.get(t[o]);null!==e&&Qn(e)&&(null===It$2&&(It$2=e.getFormat()),""===zt&&(zt=e.getStyle()));}Js(e)&&(Ft$2+=B$3);i.element.__lexicalTextContent=Ft$2,Ft$2=s+Ft$2;}function Gt(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return Fn(t)?"line-break":_i(t)&&t.isInline()?"decorator":null}return "empty"}return null}function Xt(t,e,n){const r=Gt(t,At$1),i=Gt(e,Ot$1);r!==i&&e.getDOMSlot(n).setManagedLineBreak(i);}function Qt(t,e){const n=e.__lexicalDirTextContent||"",r=e.__lexicalDir||"";if(n!==Lt$2||r!==Wt){const n=""===Lt$2,i=n?Wt:function(t){if(U$4.test(t))return "rtl";if($$3.test(t))return "ltr";return null}(Lt$2);if(i!==r){const s=e.classList,o=Tt$3.theme;let l=null!==r?o[r]:void 0,c=null!==i?o[i]:void 0;if(void 0!==l){if("string"==typeof l){const t=d$2(l);l=o[r]=t;}s.remove(...l);}if(null===i||n&&"ltr"===i)e.removeAttribute("dir");else {if(void 0!==c){if("string"==typeof c){const t=d$2(c);c=o[i]=t;} void 0!==c&&s.add(...c);}e.dir=i;}if(!Rt$1){t.getWritable().__dir=i;}}Wt=i,e.__lexicalDirTextContent=Lt$2,e.__lexicalDir=i;}}function Zt(e,n,r){const i=Lt$2;var s;Lt$2="",It$2=null,zt="",function(e,n,r){const i=Ft$2,s=e.__size,o=n.__size;Ft$2="";const l=r.element;if(1===s&&1===o){const t=e.__first,r=n.__first;if(t===r)ee(t,l);else {const e=se$1(t),n=Ht(r,null);try{l.replaceChild(n,e);}catch(i){if("object"==typeof i&&null!=i){const s=`${i.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(s)}throw i}Jt(t,null);}const i=Ot$1.get(r);Qn(i)&&(null===It$2&&(It$2=i.getFormat()),""===zt&&(zt=i.getStyle()));}else {const i=te(e,At$1),c=te(n,Ot$1);if(i.length!==s&&t(227),c.length!==o&&t(228),0===s)0!==o&&qt(c,n,0,o-1,r);else if(0===o){if(0!==s){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Ut(i,0,s-1,t?null:l),t&&(l.textContent="");}}else !function(t,e,n,r,i,s){const o=r-1,l=i-1;let c,a,u=s.getFirstChild(),f=0,d=0;for(;f<=o&&d<=l;){const t=e[f],r=n[d];if(t===r)u=re$1(ee(r,s.element)),f++,d++;else { void 0===c&&(c=new Set(e)),void 0===a&&(a=new Set(n));const i=a.has(t),o=c.has(r);if(i)if(o){const t=Us(bt$1,r);t===u?u=re$1(ee(r,s.element)):(s.withBefore(u).insertChild(t),ee(r,s.element)),f++,d++;}else Ht(r,s.withBefore(u)),d++;else u=re$1(se$1(t)),Jt(t,s.element),f++;}const i=Ot$1.get(r);null!==i&&Qn(i)&&(null===It$2&&(It$2=i.getFormat()),""===zt&&(zt=i.getStyle()));}const h=f>o,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:bt$1.getElementByKey(e);qt(n,t,d,l,s.withBefore(r));}else g&&!h&&Ut(e,f,o,s.element);}(n,i,c,s,o,r);}Js(n)&&(Ft$2+=B$3);l.__lexicalTextContent=Ft$2,Ft$2=i+Ft$2;}(e,n,n.getDOMSlot(r)),Qt(n,r),s=n,null==It$2||It$2===s.__textFormat||Rt$1||s.setTextFormat(It$2),function(t){""===zt||zt===t.__textStyle||Rt$1||t.setTextStyle(zt);}(n),Lt$2=i;}function te(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=n.get(i);void 0===e&&t(101),r.push(i),i=e.__next;}return r}function ee(e,n){const r=At$1.get(e);let i=Ot$1.get(e);void 0!==r&&void 0!==i||t(61);const s=Bt$1||Mt$1.has(e)||Et$2.has(e),o=Us(bt$1,e);if(r===i&&!s){if(di(r)){const t=o.__lexicalTextContent;void 0!==t&&(Ft$2+=t,Kt+=t);const e=o.__lexicalDirTextContent;void 0!==e&&(Lt$2+=e);}else {const t=r.getTextContent();Qn(r)&&!r.isDirectionless()&&(Lt$2+=t),Kt+=t,Ft$2+=t;}return o}if(r!==i&&s&&Is(Pt$2,Nt$3,wt$3,i,"updated"),i.updateDOM(r,o,Tt$3)){const r=Ht(e,null);return null===n&&t(62),n.replaceChild(r,o),Jt(e,null),r}if(di(r)&&di(i)){const t=i.__indent;t!==r.__indent&&Vt(o,t);const e=i.__format;e!==r.__format&&Yt(o,e),s&&(Zt(r,i,o),yi(i)||i.isInline()||Xt(r,i,o)),Js(i)&&(Ft$2+=B$3,Kt+=B$3);}else {const t=i.getTextContent();if(_i(i)){const t=i.decorate(bt$1,Tt$3);null!==t&&ne(e,t);}else Qn(i)&&!i.isDirectionless()&&(Lt$2+=t);Ft$2+=t,Kt+=t;}if(!Rt$1&&yi(i)&&i.__cachedText!==Kt){const t=i.getWritable();t.__cachedText=Kt,i=t;}return o}function ne(t,e){let n=bt$1._pendingDecorators;const r=bt$1._decorators;if(null===n){if(r[t]===e)return;n=gs(bt$1);}n[t]=e;}function re$1(t){let e=t.nextSibling;return null!==e&&e===bt$1._blockCursorElement&&(e=e.nextSibling),e}function ie$1(t,e,n,r,i,s){Ft$2="",Kt="",Lt$2="",Bt$1=r===x$3,Wt=null,bt$1=n,Tt$3=n._config,Nt$3=n._nodes,wt$3=bt$1._listeners.mutation,Et$2=i,Mt$1=s,At$1=t._nodeMap,Ot$1=e._nodeMap,Rt$1=e._readOnly,Dt$1=new Map(n._keyToDOMMap);const o=new Map;return Pt$2=o,ee("root",null),bt$1=void 0,Nt$3=void 0,Et$2=void 0,Mt$1=void 0,At$1=void 0,Ot$1=void 0,Tt$3=void 0,Dt$1=void 0,Pt$2=void 0,o}function se$1(e){const n=Dt$1.get(e);return void 0===n&&t(75,e),n}function oe$1(t){return {type:t}}const le$1=oe$1("SELECTION_CHANGE_COMMAND"),ce$1=oe$1("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ae$1=oe$1("CLICK_COMMAND"),ue$1=oe$1("DELETE_CHARACTER_COMMAND"),fe$1=oe$1("INSERT_LINE_BREAK_COMMAND"),de$1=oe$1("INSERT_PARAGRAPH_COMMAND"),he$1=oe$1("CONTROLLED_TEXT_INSERTION_COMMAND"),ge$1=oe$1("PASTE_COMMAND"),_e$1=oe$1("REMOVE_TEXT_COMMAND"),pe$1=oe$1("DELETE_WORD_COMMAND"),ye$1=oe$1("DELETE_LINE_COMMAND"),me=oe$1("FORMAT_TEXT_COMMAND"),xe$1=oe$1("UNDO_COMMAND"),Ce$1=oe$1("REDO_COMMAND"),Se$1=oe$1("KEYDOWN_COMMAND"),ve$1=oe$1("KEY_ARROW_RIGHT_COMMAND"),ke$1=oe$1("MOVE_TO_END"),Te$1=oe$1("KEY_ARROW_LEFT_COMMAND"),be$1=oe$1("MOVE_TO_START"),Ne$1=oe$1("KEY_ARROW_UP_COMMAND"),we$1=oe$1("KEY_ARROW_DOWN_COMMAND"),Ee$1=oe$1("KEY_ENTER_COMMAND"),Me$1=oe$1("KEY_SPACE_COMMAND"),Ae$1=oe$1("KEY_BACKSPACE_COMMAND"),Oe$1=oe$1("KEY_ESCAPE_COMMAND"),De$1=oe$1("KEY_DELETE_COMMAND"),Pe$1=oe$1("KEY_TAB_COMMAND"),Fe$1=oe$1("INSERT_TAB_COMMAND"),Le$1=oe$1("INDENT_CONTENT_COMMAND"),Ie$1=oe$1("OUTDENT_CONTENT_COMMAND"),ze$1=oe$1("DROP_COMMAND"),Ke$1=oe$1("FORMAT_ELEMENT_COMMAND"),Be$1=oe$1("DRAGSTART_COMMAND"),Re$1=oe$1("DRAGOVER_COMMAND"),We$1=oe$1("DRAGEND_COMMAND"),Je$1=oe$1("COPY_COMMAND"),Ue$1=oe$1("CUT_COMMAND"),$e$1=oe$1("SELECT_ALL_COMMAND"),je$1=oe$1("CLEAR_EDITOR_COMMAND"),Ve=oe$1("CLEAR_HISTORY_COMMAND"),Ye=oe$1("CAN_REDO_COMMAND"),He$1=oe$1("CAN_UNDO_COMMAND"),qe$1=oe$1("FOCUS_COMMAND"),Ge$1=oe$1("BLUR_COMMAND"),Xe$1=oe$1("KEY_MODIFIER_COMMAND"),Qe$1=Object.freeze({}),Ze$1=30,tn=[["keydown",function(t,e){if(en=t.timeStamp,nn=t.key,e.isComposing())return;if(Ws(e,Se$1,t))return;if(null==t.key)return;if(fn&&Ds(t))return ci(e,(()=>{Sn(e,dn);})),fn=false,void(dn="");if(function(t){return Ms(t,"ArrowRight",{shiftKey:"any"})}(t))Ws(e,ve$1,t);else if(function(t){return Ms(t,"ArrowRight",As)}(t))Ws(e,ke$1,t);else if(function(t){return Ms(t,"ArrowLeft",{shiftKey:"any"})}(t))Ws(e,Te$1,t);else if(function(t){return Ms(t,"ArrowLeft",As)}(t))Ws(e,be$1,t);else if(function(t){return Ms(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))Ws(e,Ne$1,t);else if(function(t){return Ms(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))Ws(e,we$1,t);else if(function(t){return Ms(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:true})}(t))an=true,Ws(e,Ee$1,t);else if(function(t){return " "===t.key}(t))Ws(e,Me$1,t);else if(function(t){return r&&Ms(t,"o",{ctrlKey:true})}(t))t.preventDefault(),an=true,Ws(e,fe$1,true);else if(function(t){return Ms(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))an=false,Ws(e,Ee$1,t);else if(function(t){return Ms(t,"Backspace",{shiftKey:"any"})||r&&Ms(t,"h",{ctrlKey:true})}(t))Ds(t)?Ws(e,Ae$1,t):(t.preventDefault(),Ws(e,ue$1,true));else if(function(t){return "Escape"===t.key}(t))Ws(e,Oe$1,t);else if(function(t){return Ms(t,"Delete",{})||r&&Ms(t,"d",{ctrlKey:true})}(t))!function(t){return "Delete"===t.key}(t)?(t.preventDefault(),Ws(e,ue$1,false)):Ws(e,De$1,t);else if(function(t){return Ms(t,"Backspace",Os)}(t))t.preventDefault(),Ws(e,pe$1,true);else if(function(t){return Ms(t,"Delete",Os)}(t))t.preventDefault(),Ws(e,pe$1,false);else if(function(t){return r&&Ms(t,"Backspace",{metaKey:true})}(t))t.preventDefault(),Ws(e,ye$1,true);else if(function(t){return r&&(Ms(t,"Delete",{metaKey:true})||Ms(t,"k",{ctrlKey:true}))}(t))t.preventDefault(),Ws(e,ye$1,false);else if(function(t){return Ms(t,"b",As)}(t))t.preventDefault(),Ws(e,me,"bold");else if(function(t){return Ms(t,"u",As)}(t))t.preventDefault(),Ws(e,me,"underline");else if(function(t){return Ms(t,"i",As)}(t))t.preventDefault(),Ws(e,me,"italic");else if(function(t){return Ms(t,"Tab",{shiftKey:"any"})}(t))Ws(e,Pe$1,t);else if(function(t){return Ms(t,"z",As)}(t))t.preventDefault(),Ws(e,xe$1,void 0);else if(function(t){if(r)return Ms(t,"z",{metaKey:true,shiftKey:true});return Ms(t,"y",{ctrlKey:true})||Ms(t,"z",{ctrlKey:true,shiftKey:true})}(t))t.preventDefault(),Ws(e,Ce$1,void 0);else {const n=e._editorState._selection;null===n||cr(n)?Ps(t)&&(t.preventDefault(),Ws(e,$e$1,t)):!function(t){return Ms(t,"c",As)}(t)?!function(t){return Ms(t,"x",As)}(t)?Ps(t)&&(t.preventDefault(),Ws(e,$e$1,t)):(t.preventDefault(),Ws(e,Ue$1,t)):(t.preventDefault(),Ws(e,Je$1,t));}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&Ws(e,Xe$1,t);}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;ho(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&ci(e,(()=>{Vi(n)||(cn=true);}));}],["compositionstart",function(t,e){ci(e,(()=>{const n=Nr();if(cr(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();cs(r.key),(t.timeStamp{Sn(e,t.data);})):(fn=true,dn=t.data);}],["input",function(t,e){t.stopPropagation(),ci(e,(()=>{if(fo(t.target)&&Vi(t.target))return;const n=Nr(),r=t.data,c=Cn(t);if(null!=r&&cr(n)&&_n(n,c,r,t.timeStamp,false)){un&&(Sn(e,r),un=false);const c=n.anchor.getNode(),a=lo(Xs(e));if(null===a)return;const u=n.isBackward(),d=u?n.anchor.offset:n.focus.offset,h=u?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Qn(c)&&null!==a.anchorNode&&c.getTextContent().slice(0,d)+r+c.getTextContent().slice(d+h)===Ts(a.anchorNode)||Ws(e,he$1,r);const g=r.length;i&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),o||l||f$1||!e.isComposing()||(en=0,cs(null));}else {bs(false,e,null!==r?r:void 0),un&&(Sn(e,r||void 0),un=false);}!function(){Vr();const t=qr();ct$3(t);}();}),{event:t}),sn=null;}],["click",function(t,e){ci(e,(()=>{const n=Nr(),r=lo(Xs(e)),i=wr();if(r)if(cr(n)){const e=n.anchor,s=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!yi(s)&&1===ps().getChildrenSize()&&s.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=true;else if(3===t.detail&&!n.isCollapsed()){if(s!==n.focus.getNode()){const t=function(t,e){let n=t;for(;n!==ps()&&null!=n;){if(e(n))return n;n=n.getParent();}return null}(s,(t=>di(t)&&!t.isInline()));di(t)&&t.select(0);}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(fo(n)||ts(n)){ms(br(i,r,e,t));}}Ws(e,ae$1,t);}));}],["cut",Qe$1],["copy",Qe$1],["dragstart",Qe$1],["dragover",Qe$1],["dragend",Qe$1],["paste",Qe$1],["focus",Qe$1],["blur",Qe$1],["drop",Qe$1]];s&&tn.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,s=Cn(e);if("deleteCompositionText"===r||i&&Rs(n))return;if("insertCompositionText"===r)return;ci(n,(()=>{const i=Nr();if("deleteContentBackward"===r){if(null===i){const t=wr();if(!cr(t))return;ms(t.clone());}if(cr(i)){const r=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===nn&&o{ci(n,(()=>{cs(null);}));}),Ze$1),cr(i)){const e=i.anchor.getNode();e.markDirty(),Qn(e)||t(142),xn(i,e);}}else {cs(null),e.preventDefault();const t=i.anchor.getNode(),s=t.getTextContent(),o=t.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===s.length;let c=u&&r&&!l&&o;if(c&&i.isCollapsed()&&(c=!_i(Bs(i.anchor,true))),!c){Ws(n,ue$1,true);const t=Nr();u&&cr(t)&&t.isCollapsed()&&(hn=t,setTimeout((()=>hn=null)));}}return}}var o;if(!cr(i))return;const c=e.data;null!==sn&&bs(false,n,sn),i.dirty&&null===sn||!i.isCollapsed()||yi(i.anchor.getNode())||null===s||i.applyDOMRange(s),sn=null;const a=i.anchor,f=i.focus,d=a.getNode(),h=f.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":Ws(n,he$1,e);break;case "insertFromComposition":cs(null),Ws(n,he$1,e);break;case "insertLineBreak":cs(null),Ws(n,fe$1,false);break;case "insertParagraph":cs(null),an&&!l?(an=false,Ws(n,fe$1,false)):Ws(n,de$1,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":Ws(n,ge$1,e);break;case "deleteByComposition":(function(t,e){return t!==e||di(t)||di(e)||!Qi(t)||!Qi(e)})(d,h)&&Ws(n,_e$1,e);break;case "deleteByDrag":case "deleteByCut":Ws(n,_e$1,e);break;case "deleteContent":Ws(n,ue$1,false);break;case "deleteWordBackward":Ws(n,pe$1,true);break;case "deleteWordForward":Ws(n,pe$1,false);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":Ws(n,ye$1,true);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":Ws(n,ye$1,false);break;case "formatStrikeThrough":Ws(n,me,"strikethrough");break;case "formatBold":Ws(n,me,"bold");break;case "formatItalic":Ws(n,me,"italic");break;case "formatUnderline":Ws(n,me,"underline");break;case "historyUndo":Ws(n,xe$1,void 0);break;case "historyRedo":Ws(n,Ce$1,void 0);}else {if("\n"===c)e.preventDefault(),Ws(n,fe$1,false);else if(c===B$3)e.preventDefault(),Ws(n,de$1,void 0);else if(null==c&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t);}else null!=c&&_n(i,s,c,e.timeStamp,true)?(e.preventDefault(),Ws(n,he$1,c)):sn=c;rn=e.timeStamp;}}));}(e,n)]);let en=0,nn=null,rn=0,sn=null;const on=new WeakMap;let ln=false,cn=false,an=false,un=false,fn=false,dn="",hn=null,gn=[0,"",0,"root",0];function _n(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=qr(),u=lo(Xs(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Qn(c)||(!i&&(!s||rn1||(i||!s)&&null!==h&&!c.isComposing()&&f!==ns(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||c.getFormat()!==t.format||c.getStyle()!==t.style||function(t,e){if(e.isSegmented())return true;if(!t.isCollapsed())return false;const n=t.anchor.offset,r=e.getParentOrThrow(),i=Qi(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return (Qn(e)||di(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function pn(t,e){return ts(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function yn(e,n,r){const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=e;ln&&(ln=false,pn(i,s)&&pn(o,l)&&!hn)||ci(n,(()=>{if(!r)return void ms(null);if(!Hi(n,i,o))return;let c=Nr();if(hn&&cr(c)&&c.isCollapsed()){const t=c.anchor,e=hn.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=hn.clone(),ms(c));}if(hn=null,cr(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=true);const s=Xs(n).event,o=s?s.timeStamp:performance.now(),[l,a,u,f,d]=gn,h=ps(),g=false===n.isComposing()&&""===h.getTextContent();if(o{const r=wr(),i=e.anchorNode;if(fo(i)||ts(i)){ms(br(r,e,n,t));}})));const r=vs(n),i=r[r.length-1],s=i._key,o=kn.get(s),l=o||i;l!==n&&yn(e,l,false),yn(e,n,true),n!==i?kn.set(s,n):o&&kn.delete(s);}function bn(t){t._lexicalHandled=true;}function Nn(t){return true===t._lexicalHandled}function En(e){const n=e.ownerDocument,r=on.get(n);if(void 0===r)return void 0;const i=r-1;i>=0||t(164),on.set(n,i),0===i&&n.removeEventListener("selectionchange",Tn);const s=Xi(e);qi(s)?(!function(t){if(null!==t._parentEditor){const e=vs(t),n=e[e.length-1]._key;kn.get(n)===t&&kn.delete(n);}else kn.delete(t._key);}(s),e.__lexicalEditor=null):s&&t(198);const o=vn(e);for(let t=0;tt.__key===this.__key));if(Qn(this))return n;if(cr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return false;const t=this.getParent();if(_i(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return false}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return -1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling();}return -1}getParent(){const t=this.getLatest().__parent;return null===t?null:us(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(to(n))return di(e)||e===this&&_i(e)||t(194),e;e=n;}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:us(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:us(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=di(this)?this:this.getParent(),n=di(t)?t:t.getParent(),r=e&&n?ol(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=ol(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===rl(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),false)))}isParentOf(t){const e=ol(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let s=this;for(;null!==s;){const o=s.__key;if(i.has(o)||(i.add(o),r.push(s)),s===e)break;const l=di(s)?n?s.getFirstChild():s.getLastChild():null;if(null!==l){s=l;continue}const c=n?s.getNextSibling():s.getPreviousSibling();if(null!==c){s=c;continue}const a=s.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f);}while(null===u);s=u;}return n||r.reverse(),r}isDirty(){const t=qr()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){const e=us(this.__key);return null===e&&t(113),e}getWritable(){Vr();const t=Hr(),e=qr(),n=t._nodeMap,r=this.__key,i=this.getLatest(),s=e._cloneNotNeeded,o=Nr();if(null!==o&&o.setCachedNodes(null),s.has(r))return ls(i),i;const l=ko(i);return s.add(r),ls(l),n.set(r,l),l}getTextContent(){return ""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70);}updateDOM(e,n,r){t(71);}exportDOM(t){return {element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return {type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name);}updateFromJSON(t){return function(t,e){const n=t.getWritable();return (e||n.__state)&&mt$4(t).updateFromJSON(e),n}(this,t.$)}static transform(){return null}remove(t){Mn(this,true,t);}replace(e,n){Vr();let r=Nr();null!==r&&(r=r.clone()),ro(this,e);const i=this.getLatest(),s=this.__key,o=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;os(l);const u=i.getPreviousSibling(),f=i.getNextSibling(),d=i.__prev,h=i.__next,g=i.__parent;if(Mn(i,false,true),null===u)c.__first=o;else {u.getWritable().__next=o;}if(l.__prev=d,null===f)c.__last=o;else {f.getWritable().__prev=o;}if(l.__next=h,l.__parent=g,c.__size=a,n&&(di(this)&&di(l)||t(139),this.getChildren().forEach((t=>{l.append(t);}))),cr(r)){ms(r);const t=r.anchor,e=r.focus;t.key===s&&or(t,l),e.key===s&&or(e,l);}return as()===s&&cs(o),l}insertAfter(t,e=true){Vr(),ro(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),s=Nr();let o=false,l=false;if(null!==i){const e=t.getIndexWithinParent();if(os(r),cr(s)){const t=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1;}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else {c.getWritable().__prev=u;}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&cr(s)){const t=this.getIndexWithinParent();Er(s,a,t+1);const e=a.__key;o&&s.anchor.set(e,t+2,"element"),l&&s.focus.set(e,t+2,"element");}return t}insertBefore(t,e=true){Vr(),ro(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key;os(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===s)o.__first=i;else {s.getWritable().__next=i;}o.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=Nr();if(e&&cr(a)){Er(a,this.getParentOrThrow(),c);}return t}isParentRequired(){return false}createParentElementNode(){return Pi()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Vr();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(di(n))return n.select();if(!Qn(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){Vr();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(di(n))return n.select(0,0);if(!Qn(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable();}reconcileObservedMutation(t,e){this.markDirty();}}class On extends An{static getType(){return "linebreak"}static clone(t){return new On(t.__key)}constructor(t){super(t);}getTextContent(){return "\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}isInline(){return true}static importDOM(){return {br:t=>function(t){const e=t.parentElement;if(null!==e&&po(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Ln(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&Ln(n))return true}}return false}(t)||function(t){const e=t.parentElement;if(null!==e&&po(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Ln(n))return false;const r=e.lastChild;if(r===t||r.previousSibling===t&&Ln(r))return true}return false}(t)?null:{conversion:Dn,priority:0}}}static importJSON(t){return Pn().updateFromJSON(t)}}function Dn(t){return {node:Pn()}}function Pn(){return no(new On)}function Fn(t){return t instanceof On}function Ln(t){return ts(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function In(t,e){return 16&e?"code":e&A$2?"mark":32&e?"sub":64&e?"sup":null}function zn(t,e){return 1&e?"strong":2&e?"em":"span"}function Kn(t,e,n,r,i){const s=r.classList;let o=Ls(i,"base");void 0!==o&&s.add(...o),o=Ls(i,"underlineStrikethrough");let l=false;const c=e&N$3&&e&b$2;void 0!==o&&(n&N$3&&n&b$2?(l=true,c||s.add(...o)):c&&s.remove(...o));for(const t in j$4){const r=j$4[t];if(o=Ls(i,t),void 0!==o)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&s.remove(...o);continue}e&r&&(!c||"underline"!==t)&&"strikethrough"!==t||s.add(...o);}else e&r&&s.remove(...o);}}function Bn(t,e,n){const r=e.firstChild,s=n.isComposing(),o=t+(s?K$3:"");if(null==r)e.textContent=o;else {const t=r.nodeValue;if(t!==o)if(s||i){const[e,n,i]=function(t,e){const n=t.length,r=e.length;let i=0,s=0;for(;i({conversion:Yn,priority:0}),b:()=>({conversion:$n,priority:0}),code:()=>({conversion:Gn,priority:0}),em:()=>({conversion:Gn,priority:0}),i:()=>({conversion:Gn,priority:0}),mark:()=>({conversion:Gn,priority:0}),s:()=>({conversion:Gn,priority:0}),span:()=>({conversion:Un,priority:0}),strong:()=>({conversion:Gn,priority:0}),sub:()=>({conversion:Gn,priority:0}),sup:()=>({conversion:Gn,priority:0}),u:()=>({conversion:Gn,priority:0})}}static importJSON(t){return Xn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return fo(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Wn(n,"b")),this.hasFormat("italic")&&(n=Wn(n,"i")),this.hasFormat("strikethrough")&&(n=Wn(n,"s")),this.hasFormat("underline")&&(n=Wn(n,"u")),{element:n}}exportJSON(){return {detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?j$4[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?V$3[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=rs(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=q$4[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){Vr();let n=t,r=e;const i=Nr(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const t=s.length;void 0===n&&(n=t),void 0===r&&(r=t);}else n=0,r=0;if(!cr(i))return Sr(o,n,o,r,"text","text");{const t=as();t!==i.anchor.key&&t!==i.focus.key||cs(o),i.setTextNodeRange(this,n,this,r);}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),s=i.__text,o=n.length;let l=t;l<0&&(l=o+l,l<0&&(l=0));const c=Nr();if(r&&cr(c)){const e=t+o;c.setTextNodeRange(i,e,i,e);}const a=s.slice(0,l)+n+s.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...t){Vr();const e=this.getLatest(),n=e.getTextContent();if(""===n)return [];const r=e.__key,i=as(),s=n.length;t.sort(((t,e)=>t-e)),t.push(s);const o=[],l=t.length;for(let e=0,r=0;ee&&(o.push(n.slice(e,i)),e=i);}const c=o.length;if(1===c)return [e];const a=o[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=false,p=null,y=null;const m=Nr();if(cr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e);}e.isSegmented()?(f=Xn(a),f.__format=d,f.__style=h,f.__detail=g,_=true):f=e.setTextContent(a);const x=[f];for(let t=1;t=v&&(p.set(t.getKey(),C-v,"text"),C=v){y.set(t.getKey(),S-v,"text");break}v=e;}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&ls(e);null!==n&&ls(n);}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),cr(m)&&Er(m,u,e,c-1);}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,s=this.__text,o=s.length;as()===i&&cs(r);const l=Nr();if(cr(l)){const t=l.anchor,s=l.focus;null!==t&&t.key===i&&Or(t,n,r,e,o),null!==s&&s.key===i&&Or(s,n,r,e,o);}const c=e.__text,a=n?c+s:s+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return false}}function Un(t){return {forChild:Zn(t.style),node:null}}function $n(t){const e=t,n="normal"===e.style.fontWeight;return {forChild:Zn(e.style,n?void 0:"bold"),node:null}}const jn=new WeakMap;function Vn(t){if(!fo(t))return false;if("PRE"===t.nodeName)return true;const e=t.style.whiteSpace;return "string"==typeof e&&e.startsWith("pre")}function Yn(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=jn.get(n))&&!Vn(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=false;break}}e&&(r=r.slice(1));}if(" "===r[r.length-1]){let t=n,e=true;for(;null!==t&&null!==(t=Hn(t,true));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=false;break}}e&&(r=r.slice(0,r.length-1));}return ""===r?{node:null}:{node:Xn(r)}}function Hn(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t;}if(n=t,fo(n)){const t=n.style.display;if(""===t&&!_o(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(ts(n))return n;if("BR"===n.nodeName)return null}}const qn={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Gn(t){const e=qn[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Zn(t.style,e),node:null}}function Xn(t=""){return no(new Jn(t))}function Qn(t){return t instanceof Jn}function Zn(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>Qn(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),s&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),o&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class tr extends Jn{static getType(){return "tab"}static clone(t){return new tr(t.__key)}constructor(t){super("\t",t),this.__detail=2;}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=Ls(t.theme,"tab");if(void 0!==n){e.classList.add(...n);}return e}static importJSON(t){return er().updateFromJSON(t)}setTextContent(e){return "\t"!==e&&""!==e&&t(126),super.setTextContent("\t")}spliceText(e,n,r,i){return ""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return "normal"!==e&&t(128),this}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function er(){return no(new tr)}function nr(t){return t instanceof tr}class rr{constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n;}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offsett&&(r=t);}else if(!di(e)){const t=e.getNextSibling();if(Qn(t))n=t.__key,r=0,i="text";else {const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1);}}t.set(n,r,i);}function or(t,e){if(di(e)){const n=e.getLastDescendant();di(n)||Qn(n)?sr(t,n):sr(t,e);}else sr(t,e);}class lr{constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){if(!ur(t))return false;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every((t=>n.has(t)))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(t){this.dirty=true,this._nodes.add(t),this._cachedNodes=null;}delete(t){this.dirty=true,this._nodes.delete(t),this._cachedNodes=null;}clear(){this.dirty=true,this._nodes.clear(),this._cachedNodes=null;}has(t){return this._nodes.has(t)}clone(){return new lr(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(Qn(r))i=r.select();else {const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t);}i.insertNodes(t);for(let t=0;t1;){const t=e[e.length-1];if(!di(t)||s.has(t)||t.isEmpty()||i.has(t))break;e.pop();}if(0===e.length&&t.isCollapsed()){const n=pl(t.anchor),r=pl(t.anchor.getFlipped()),i=t=>Lo(t)?t.origin:t.getNodeAtCaret(),s=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(s);}return e}(xl(fl(this),"next"));return jr()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text");}getTextContent(){const t=this.getNodes();if(0===t.length)return "";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[o,l]=dr(this);let c="",a=true;for(let u=0;u=0;t--){const e=s[t];if(e.is(d)||di(e)&&e.isParentOf(d))break;e.isAttached()&&(!o.has(e)||e.is(i)?g||p.insertAfter(e,false):e.remove());}if(!g){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(Qi(d))if(c===h)d.select();else {const t=Xn(e);t.select(),d.replace(t);}else d=d.spliceText(c,h-c,e,true),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach((n=>{if(di(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r);}}));},s=r.length;if(0===s)return this.toggleFormat(t),cs(null),void i(e);const o=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:o,u=c?o:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);i(g);const _=s-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(Zi(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else {const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text");}return void(this.format=g)}0===h||Zi(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||Zi(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,m);n.setFormat(i);}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m;}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=Nr();return cr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=mo(n,yo),i=e[e.length-1];if(di(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else {const t=Ir(this);r.splice(t,0,e),i.selectEnd();}return}if(!e.some((t=>(di(t)||_i(t))&&!t.isInline()))){di(r)||t(211,n.constructor.name,n.getType());const s=Ir(this);return r.splice(s,0,e),void i.selectEnd()}const s=function(t){const e=Pi();let n=null;for(let r=0;rc?c:l,e=l>c?l:c,n=s.splitText(t,e),r=0===t?n[0]:n[1];return null!=r?[r]:[]}return [s]}const a=r.isBefore(i);if(Qn(s)){const e=a?l:c;e===s.getTextContentSize()?t.shift():0!==e&&([,s]=s.splitText(e),t[0]=s);}if(Qn(o)){const e=o.getTextContent().length,r=a?c:l;0===r?t.pop():r!==e&&([o]=o.splitText(r),t[n]=o);}return t}modify(t,e,n){if(Kr(this,t,e,n))return;const r="move"===t,i=qr(),s=lo(Xs(i));if(!s)return;const o=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===o||!di(c)||c.isInline()||c.canBeEmpty()||oo(o,i,l),this.dirty){let t=Us(i,this.anchor.key),e=Us(i,this.focus.key);"text"===this.anchor.type&&(t=ns(t)),"text"===this.focus.type&&(e=ns(e)),t&&e&&Dr(s,t,this.anchor.offset,e,this.focus.offset);}if(function(t,e,n,r){t.modify(e,n,r);}(s,t,e?"backward":"forward",n),s.rangeCount>0){const t=s.getRangeAt(0),n=this.anchor.getNode(),i=yi(n)?n:Zs(n);if(this.applyDOMRange(t),this.dirty=true,!r){const n=this.getNodes(),r=[];let o=false;for(let t=0;t0)if(e){const t=r[0];di(t)?t.selectStart():t.getParentOrThrow().selectStart();}else {const t=r[r.length-1];di(t)?t.selectEnd():t.getParentOrThrow().selectEnd();}s.anchorNode===t.startContainer&&s.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,s=n.type;n.set(e.key,e.offset,e.type,true),e.set(r,i,s,true);}(this);}}"lineboundary"===n&&Kr(this,t,e,n,"decorators");}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&di(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(di(n)&&n.isShadowRoot())return true}return false}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=Qo(ll(e,t?"previous":"next"));if(r.getTextSlices().every((t=>null===t||0===t.distance))){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(Ko(e))if(e.origin.isInline());else {if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(di(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=pl(e);ul(this,tl(t,t)),r.anchor.origin.remove();}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"});}else {if("merge-block"===t.type)break;if(zo(e)){if(di(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(_i(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&di(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=kr();t.add(e.origin.getKey()),ms(t);}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return ul(this,tl(!e.origin.isEmpty()&&n.isEmpty()?dl(Jo(n,e.direction)):r.anchor,e)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&hr(this,e.getNode()))return}else {const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,s=r.getTextContentSize();if(r.is(n)||t&&e!==s||!t&&0!==e)return void _r(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,s=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==s)return void _r(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),s=r.getNode();if(i===s&&"text"===n.type&&"text"===r.type){const t=n.offset,s=r.offset,o=t{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch(t){}return ()=>false})();function _r(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let t=0;tn||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l));}function pr(e,n,r,i){let s,o=n;if(fo(e)){let l=false;const c=e.childNodes,a=c.length,u=i._blockCursorElement;o===a&&(l=true,o=a-1);let f=c[o],d=false;if(f===u)f=c[o+1],d=true;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&o--;}}if(s=xs(f),Qn(s))o=Cs(s,l);else {let c=xs(e);if(null===c)return null;if(di(c)){const a=i.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,o]=u.resolveChildIndex(c,a,e,n),di(c)||t(215),l&&o>=c.getChildrenSize()&&(o=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(o);if(di(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=di(f)?f:f.getParentOrThrow()),o=0;}Qn(f)?(s=f,c=null,o=Cs(f,l)):f!==c&&l&&!d&&(di(c)||t(216),o=Math.min(c.getChildrenSize(),o+1));}else {const t=c.getIndexWithinParent();o=0===n&&_i(c)&&xs(e)===c?t:t+1,c=c.getParentOrThrow();}if(di(c))return ir(c.__key,o,"element")}}else s=xs(e);return Qn(s)?ir(s.__key,o,"text"):null}function yr(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(e){if((n||!e)&&null===r&&di(s)&&s.isInline()){const e=s.getPreviousSibling();Qn(e)&&t.set(e.__key,e.getTextContent().length,"text");}}else di(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Qn(r)&&t.set(r.__key,r.getTextContent().length,"text");}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(e&&di(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&di(s)&&s.isInline()&&!s.canInsertTextAfter()){const e=s.getNextSibling();Qn(e)&&t.set(e.__key,0,"text");}}}function mr(t,e,n){if("text"===t.type&&"text"===e.type){const r=t.isBefore(e),i=t.is(e);yr(t,r,i),yr(e,!r,i),i&&e.set(t.key,t.offset,t.type);const s=qr();if(s.isComposing()&&s._compositionKey!==t.key&&cr(n)){const r=n.anchor,i=n.focus;t.set(r.key,r.offset,r.type,true),e.set(i.key,i.offset,i.type,true);}}}function xr(t,e,n,r,i,s){if(null===t||null===n||!Hi(i,t,n))return null;const o=pr(t,e,cr(s)?s.anchor:null,i);if(null===o)return null;const l=pr(n,r,cr(s)?s.focus:null,i);if(null===l)return null;if("element"===o.type&&"element"===l.type){const e=xs(t),r=xs(n);if(_i(e)&&_i(r))return null}return mr(o,l,s),[o,l]}function Cr(t){return di(t)&&!t.isInline()}function Sr(t,e,n,r,i,s){const o=Hr(),l=new ar(ir(t,e,i),ir(n,r,s),0,"");return l.dirty=true,o._selection=l,l}function vr(){const t=ir("root",0,"element"),e=ir("root",0,"element");return new ar(t,e,0,"")}function kr(){return new lr(new Set)}function br(t,e,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,l="selectionchange"===o,c=!tt$2&&(l||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let a,u,f,d;if(cr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&cr(t)&&!Hi(n,a,u))return t.clone();const h=xr(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;return new ar(g,_,cr(t)?t.format:0,cr(t)?t.style:"")}function Nr(){return Hr()._selection}function wr(){return qr()._editorState._selection}function Er(t,e,n,r=1){const i=t.anchor,s=t.focus,o=i.getNode(),l=s.getNode();if(!e.is(o)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n0||n0||n=t,o=i?s.getChildAtIndex(t-1):s.getChildAtIndex(n);if(Qn(o)){let t=0;i&&(t=o.getTextContentSize()),e.set(o.__key,t,"text"),r.set(o.__key,t,"text");}}else {if(di(s)){const t=s.getChildrenSize(),r=n>=t,i=r?s.getChildAtIndex(t-1):s.getChildAtIndex(n);if(Qn(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text");}}if(di(o)){const t=o.getChildrenSize(),e=i>=t,n=e?o.getChildAtIndex(t-1):o.getChildAtIndex(i);if(Qn(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text");}}}}function Ar(t,e,n,r,i){let s=null,o=0,l=null;null!==r?(s=r.__key,Qn(r)?(o=r.getTextContentSize(),l="text"):di(r)&&(o=r.getChildrenSize(),l="element")):null!==i&&(s=i.__key,Qn(i)?l="text":di(i)&&(l="element")),null!==s&&null!==l?t.set(s,o,l):(o=e.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),t.set(n.__key,o,"element"));}function Or(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element");}function Dr(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i);}catch(t){}}function Pr(t,e,n,r,i,s,o){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has(Ni)&&f!==s||null!==f&&Yi(f))return;if(!cr(e))return void(null!==t&&Hi(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=Us(n,g),y=Us(n,_),m=d.offset,x=h.offset,C=e.format,S=e.style,v=e.isCollapsed();let k=p,T=y,b=false;if("text"===d.type){k=ns(p);const t=d.getNode();b=t.getFormat()!==C||t.getStyle()!==S;}else cr(t)&&"text"===t.anchor.type&&(b=true);var N,w,E,M,A;if(("text"===h.type&&(T=ns(y)),null!==k&&null!==T)&&(v&&(null===t||b||cr(t)&&(t.format!==C||t.style!==S))&&(N=C,w=S,E=m,M=g,A=performance.now(),gn=[N,w,E,M,A]),a!==m||u!==x||l!==k||c!==T||"Range"===r.type&&v||(null!==f&&s.contains(f)||s.focus({preventScroll:true}),"element"===d.type))){if(Dr(r,k,m,T,x),!i.has(Ei)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=cr(e)&&"element"===e.anchor.type?k.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect();}else e=t.getBoundingClientRect();!function(t,e,n){const r=js(n),i=Gs(r);if(null===r||null===i)return;let{top:s,bottom:o}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e)l=0,c=Xs(t).innerHeight;else {const t=a.getBoundingClientRect();l=t.top,c=t.bottom;}let n=0;if(sc&&(n=o-c),0!==n)if(e)i.scrollBy(0,n);else {const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;s-=e,o-=e;}if(e)break;a=$s(a);}}(n,e,s);}}ln=true;}}function Fr(t){let e=Nr()||wr();null===e&&(e=ps().selectEnd()),e.insertNodes(t);}function Ir(e){let n=e;e.isCollapsed()||n.removeText();const r=Nr();cr(r)&&(n=r),cr(n)||t(161);const i=n.anchor;let s=i.getNode(),o=i.offset;for(;!yo(s);){const t=s;if([s,o]=zr(s,o),t.is(s))break}return o}function zr(t,e){const n=t.getParent();if(!n){const t=Pi();return ps().append(t),t.select(),[ps(),0]}if(Qn(t)){const r=t.splitText(e);if(0===r.length)return [n,t.getIndexWithinParent()];const i=0===e?0:1;return [n,r[0].getIndexWithinParent()+i]}if(!di(t)||0===e)return [n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new ar(ir(t.__key,e,"element"),ir(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings());}return [n,t.getIndexWithinParent()+1]}function Kr(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),true}const s=ll(t.focus,n?"previous":"next"),o="lineboundary"===r,l="move"===e;let c=s,a="decorators-and-blocks"===i;if(!yl(c)){for(const t of c){a=false;const{origin:e}=t;if(!_i(e)||e.isIsolated()||(c=t,!o||!e.isInline()))break}if(a)for(const t of Qo(s).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(Ko(t))t.origin.isInline()||(c=t);else {if(di(t.origin))continue;_i(t.origin)&&!t.origin.isInline()&&(c=t);}break}}if(c===s)return false;if(l&&!o&&_i(c.origin)&&c.origin.isKeyboardSelectable()){const t=kr();return t.add(c.origin.getKey()),ms(t),true}return c=pl(c),l&&cl(t.anchor,c),cl(t.focus,c),a||!o}let Br=null,Rr=null,Wr=false,Jr=false,Ur=0;const $r={characterData:true,childList:true,subtree:true};function jr(){return Wr||null!==Br&&Br._readOnly}function Vr(){Wr&&t(13);}function Yr(){Ur>99&&t(14);}function Hr(){return null===Br&&t(195,Gr()),Br}function qr(){return null===Rr&&t(196,Gr()),Rr}function Gr(){let t=0;const e=new Set,n=Ji.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=Xi(r);if(qi(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t);}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Xr(){return Rr}function Qr(e,n,r){const i=n.__type,s=function(e,n){const r=e._nodes.get(n);void 0===r&&t(30,n);return r}(e,i);let o=r.get(i);void 0===o&&(o=Array.from(s.transforms),r.set(i,o));const l=o.length;for(let t=0;t0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);Qn(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&St$3(r),void 0!==r&&Zr(r,s)&&Qr(e,r,o),n.add(t);}if(l=e._dirtyLeaves,c=l.size,c>0){Ur++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&Zr(c,s)&&Qr(e,c,o);}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,Ur++;}e._dirtyLeaves=n,e._dirtyElements=r;}(a,e),oi(e),function(t,e,n,r){const i=t._nodeMap,s=e._nodeMap,o=[];for(const[t]of r){const e=s.get(t);void 0!==e&&(e.isAttached()||(di(e)&&Q$3(e,t,i,s,o,r),i.has(t)||r.delete(t),o.push(t)));}for(const t of o)s.delete(t);for(const t of n){const e=s.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),s.delete(t));}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const s=a._selection;if(cr(s)){const e=a._nodeMap,n=s.anchor.key,r=s.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19);}else ur(s)&&0===s._nodes.size&&(a._selection=null);}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=x$3,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void ii(e)}finally{Br=f,Wr=d,Rr=h,e._updating=g,Ur=0;}const p=e._dirtyType!==y$4||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return true}else if(null!==n)return true;return false}(a,e);p?a._flushSync?(a._flushSync=false,ii(e)):u&&ji((()=>{ii(e);})):(a._flushSync=false,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null));}function ci(t,e,n){Rr===t&&void 0===n?e():li(t,e,n);}class ai{constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null;}withBefore(t){return new ai(this.element,t,this.after)}withAfter(t){return new ai(this.element,this.before,t)}withElement(t){return this.element===t?this:new ai(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else {const e="decorator"===t&&(l||o);this.insertManagedLineBreak(e);}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0;}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak();}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t;}else n.__lexicalLineBreak=i;}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return [t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const i=ui(e,n);i.push(r);const s=ui(e,this.element);let o=t.getIndexWithinParent();for(let t=0;tn){o+=1;break}}return [t.getParentOrThrow(),o]}}function ui(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t);}return i!==e&&t(225),r.reverse()}class fi extends An{constructor(t){super(t),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(t){super.afterCloneFrom(t),this.__first=t.__first,this.__last=t.__last,this.__size=t.__size,this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle;}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return H$1[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=qr()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(Qn(e)&&t.push(e),di(e)){const n=e.getAllTextNodes();t.push(...n);}e=e.getNextSibling();}return t}getFirstDescendant(){let t=this.getFirstChild();for(;di(t);){const e=t.getFirstChild();if(null===e)break;t=e;}return t}getLastDescendant(){let t=this.getLastChild();for(;di(t);){const e=t.getLastChild();if(null===e)break;t=e;}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return di(t)&&t.getLastDescendant()||t||null}const r=e[t];return di(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:us(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:us(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t=t;){if(r===t)return n;n=n.getPreviousSibling(),r--;}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;rt.remove())),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?Y$3[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){const i=r.length,s=this.getChildrenSize(),o=this.getWritable();e+n<=s||t(226,String(e),String(n),String(s));const l=o.__key,c=[],a=[],u=this.getChildAtIndex(e+n);let f=null,d=s-n+i;if(0!==e)if(e===s)f=this.getLastChild();else {const t=this.getChildAtIndex(e);null!==t&&(f=t.getPreviousSibling());}if(n>0){let e=null===f?this.getFirstChild():f.getNextSibling();for(let r=0;r0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n);}return {element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return true}collapseAtStart(t){return false}excludeFromCopy(t){return false}canReplaceWith(t){return true}canInsertAfter(t){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(t){return false}extractWithChild(t,e,n){return false}canMergeWhenEmpty(){return false}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling);}}}function di(t){return t instanceof fi}function hi(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return true;r=r.getParent();}return false}class gi extends An{decorate(e,n){t(47);}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function _i(t){return t instanceof gi}class pi extends fi{static getType(){return "root"}static clone(){return new pi}constructor(){super("root"),this.__cachedText=null;}getTopLevelElementOrThrow(){t(51);}getTextContent(){const t=this.__cachedText;return !jr()&&qr()._dirtyType!==y$4||null===t?super.getTextContent():t}remove(){t(52);}replace(e){t(53);}insertBefore(e){t(54);}insertAfter(e){t(55);}updateDOM(t,e){return false}splice(e,n,r){for(const e of r)di(e)||_i(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return ps().updateFromJSON(t)}collapseAtStart(){return true}}function yi(t){return t instanceof pi}function mi(t){return new Si(new Map(t._nodeMap))}function xi(){return new Si(new Map([["root",new pi]]))}function Ci(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),di(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const s=e.getChildren();for(let t=0;t({root:Ci(ps())})))}}const vi="historic",ki="history-push",Ti="history-merge",bi="paste",Ni="collaboration",Ei="skip-scroll-into-view",Mi="skip-dom-selection";class Ai extends fi{static getType(){return "artificial"}createDOM(t){return document.createElement("div")}}class Oi extends fi{static getType(){return "paragraph"}static clone(t){return new Oi(t.__key)}createDOM(t){const e=document.createElement("p"),n=Ls(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n);}return e}updateDOM(t,e,n){return false}static importDOM(){return {p:t=>({conversion:Di,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(fo(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);}return {element:e}}static importJSON(t){return Pi().updateFromJSON(t)}exportJSON(){return {...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const n=Pi();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||Qn(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),true;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),true}return false}}function Di(t){const e=Pi();return t.style&&(e.setFormat(t.style.textAlign),To(t,e)),{node:e}}function Pi(){return no(new Oi)}function Fi(t){return t instanceof Oi}const Li=0,Ii=1,zi=2,Ki=3,Bi=4;function Ri(t,e,n,r){const i=t._keyToDOMMap;i.clear(),t._editorState=xi(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=y$4,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const s=t._observer;null!==s&&(s.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n));}function Wi(t){const e=t||{},n=Xr(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,s=e.disableEvents||false,o=xi(),l=e.namespace||(null!==i?i._config.namespace:ks()),c=e.editorState,a=[pi,Jn,On,tr,Oi,Ai,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else {h=new Map;for(let t=0;t{Object.keys(t).forEach((e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e]);}));};return t.forEach((t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n);})),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=x$3),g}class Ji{constructor(t,e,n,r,i,s,o,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=false,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=y$4,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=ks(),this._onError=i,this._htmlConversions=s,this._editable=o,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null;}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t);}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t);}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t);}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t);}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t);}}registerCommand(e,n,r){ void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);void 0===s&&t(36,String(e));const o=s[r];return o.add(n),()=>{o.delete(n),s.every((t=>0===t.size))&&i.delete(e);}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;i.set(e,r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{i.delete(e);}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=vo(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])});}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t);}return function(t,e){const n=vo(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e);}if(0===r.length)return;t.update((()=>{for(const t of r)for(const e of t.keys()){const t=us(e);t&&t.markDirty();}}),null===t._pendingEditorState?{tag:Ti}:void 0);}(this,r.map((t=>t.klass.getType()))),()=>{r.forEach((t=>t.transforms.delete(e)));}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return Ws(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=Ls(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Ri(this,e,t,r),null!==e&&(this._config.disableEvents||En(e),null!=n&&e.classList.remove(...n)),null!==t){const e=Gs(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=x$3,at$1(this),this._updateTags.add(Ti),ii(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument,r=on.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",Tn),on.set(n,(r||0)+1),t.__lexicalEditor=e;const i=vn(t);for(let n=0;n{Nn(t)||(bn(t),(e.isEditable()||"click"===r)&&s(t,e));}:t=>{if(Nn(t))return;bn(t);const n=e.isEditable();switch(r){case "cut":return n&&Ws(e,Ue$1,t);case "copy":return Ws(e,Je$1,t);case "paste":return n&&Ws(e,ge$1,t);case "dragstart":return n&&Ws(e,Be$1,t);case "dragover":return n&&Ws(e,Re$1,t);case "dragend":return n&&Ws(e,We$1,t);case "focus":return n&&Ws(e,qe$1,t);case "blur":return n&&Ws(e,Ge$1,t);case "drop":return n&&Ws(e,ze$1,t)}};t.addEventListener(r,o),i.push((()=>{t.removeEventListener(r,o);}));}}(t,this),null!=n&&t.classList.add(...n);}else this._window=null,this._updateTags.add(Ti),ii(this);si("root",this,false,t,e);}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=mi(e),r._selection=e._selection?e._selection.clone():null),ct$3(this);const i=this._pendingEditorState,s=this._updateTags,o=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=o&&s.add(o),ii(this)),this._pendingEditorState=r,this._dirtyType=x$3,this._dirtyElements.set("root",false),this._compositionKey=null,null!=o&&s.add(o),this._updating||ii(this);}parseEditorState(t,e){return function(t,e,n){const r=xi(),i=Br,s=Wr,o=Rr,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,Br=r,Wr=false,Rr=e;try{const i=e._nodes;ni(t.root,i),n&&n(),r._readOnly=!0;}catch(t){t instanceof Error&&e._onError(t);}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,Br=i,Wr=s,Rr=o;}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return ii(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):li(t,e,n);}(this,t,e);}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),ci(this,(()=>{const r=Nr(),i=ps();null!==r?r.dirty||ms(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),Ys("focus"),Hs((()=>{n.removeAttribute("autocapitalize"),t&&t();}));})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"));}blur(){const t=this._rootElement;null!==t&&t.blur();const e=lo(this._window);null!==e&&e.removeAllRanges();}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,si("editable",this,true,t));}toJSON(){return {editorState:this._editorState.toJSON()}}}Ji.version="0.32.1+prod.esm";let Ui=1;const ji="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t);};function Vi(t){return _i(hs(t))}function Yi(t){const e=document.activeElement;if(!fo(e))return false;const n=e.nodeName;return _i(hs(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==Xi(e))}function Hi(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!Yi(e)&&Gi(e)===t}catch(t){return false}}function qi(t){return t instanceof Ji}function Gi(t){let e=t;for(;null!=e;){const t=Xi(e);if(qi(t))return t;e=$s(e);}return null}function Xi(t){return t?t.__lexicalEditor:null}function Qi(t){return nr(t)||t.isToken()}function Zi(t){return Qi(t)||t.isSegmented()}function ts(t){return ho(t)&&t.nodeType===g$3}function es(t){return ho(t)&&t.nodeType===_$3}function ns(t){let e=t;for(;null!=e;){if(ts(e))return e;e=e.firstChild;}return null}function rs(t,e,n){const r=j$4[e];if(null!==n&&(t&r)==(n&r))return t;let i=t^r;return "subscript"===e?i&=-65:"superscript"===e?i&=-33:"lowercase"===e?(i&=-513,i&=-1025):"uppercase"===e?(i&=-257,i&=-1025):"capitalize"===e&&(i&=-257,i&=-513),i}function is(t){return Qn(t)||Fn(t)||_i(t)}function ss(t,e){if(null!=e)return void(t.__key=e);Vr(),Yr();const n=qr(),r=Hr(),i=""+Ui++;r._nodeMap.set(i,t),di(t)?n._dirtyElements.set(i,true):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=m$4,t.__key=i;}function os(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),s=t.getNextSibling(),o=null!==s?s.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==s?s.getWritable():null;null===i&&(r.__first=o),null===s&&(r.__last=l),null!==c&&(c.__next=o),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--;}}function ls(t){Yr();const e=t.getLatest(),n=e.__parent,r=Hr(),i=qr(),s=r._nodeMap,o=i._dirtyElements;null!==n&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,false),r=t.__parent;}}(n,s,o);const l=e.__key;i._dirtyType=m$4,di(t)?o.set(l,true):i._dirtyLeaves.add(l);}function cs(t){Vr();const e=qr(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=us(n);null!==t&&t.getWritable();}if(null!==t){const e=us(t);null!==e&&e.getWritable();}}}function as(){if(jr())return null;return qr()._compositionKey}function us(t,e){const n=(e||Hr())._nodeMap.get(t);return void 0===n?null:n}function fs(t,e){const n=ds(t,qr());return void 0!==n?us(n,e):null}function ds(t,e){return t[`__lexicalKey_${e._key}`]}function hs(t,e){let n=t;for(;null!=n;){const t=fs(n,e);if(null!==t)return t;n=$s(n);}return null}function gs(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function _s(t){return t.read((()=>ps().getTextContent()))}function ps(){return ys(Hr())}function ys(t){return t._nodeMap.get("root")}function ms(t){Vr();const e=Hr();null!==t&&(t.dirty=true,t.setCachedNodes(null)),e._selection=t;}function xs(t){const e=qr(),n=function(t,e){let n=t;for(;null!=n;){const t=ds(n,e);if(void 0!==t)return t;n=$s(n);}return null}(t,e);if(null===n){return t===e.getRootElement()?us("root"):null}return us(n)}function Cs(t,e){return e?t.getTextContentSize():0}function Ss(t){return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function vs(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function ks(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ts(t){return ts(t)?t.nodeValue:null}function bs(t,e,n){const r=lo(Xs(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let e=Ts(i);const r=hs(i);if(null!==e&&Qn(r)){if(e===K$3&&n){const t=n.length;e=n,s=t,o=t;}null!==e&&Ns(r,e,s,o,t);}}}function Ns(t,e,n,r,i){let s=t;if(s.isAttached()&&(i||!s.isDirty())){const c=s.isComposing();let a=e;(c||i)&&e[e.length-1]===K$3&&(a=e.slice(0,-1));const u=s.getTextContent();if(i||a!==u){if(""===a){if(cs(null),o||l||f$1)s.remove();else {const t=qr();setTimeout((()=>{t.update((()=>{s.isAttached()&&s.remove();}));}),20);}return}const e=s.getParent(),i=wr(),u=s.getTextContentSize(),d=as(),h=s.getKey();if(s.isToken()||null!==d&&h===d&&!c||cr(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!c||i.focus.key===t.__key&&i.focus.offset===u&&!s.canInsertTextAfter()&&!c))return void s.markDirty();const g=Nr();if(!cr(g)||null===n||null===r)return void s.setTextContent(a);if(g.setTextNodeRange(s,n,s,r),s.isSegmented()){const t=Xn(s.getTextContent());s.replace(t),s=t;}s.setTextContent(a);}}}function ws(t,e,n){const r=e[n]||false;return "any"===r||r===t[n]}function Es(t,e){return ws(t,e,"altKey")&&ws(t,e,"ctrlKey")&&ws(t,e,"shiftKey")&&ws(t,e,"metaKey")}function Ms(t,e,n){return Es(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const As={ctrlKey:!r,metaKey:r},Os={altKey:r,ctrlKey:!r};function Ds(t){return "Backspace"===t.key}function Ps(t){return Ms(t,"a",As)}function Fs(t){const e=ps();if(cr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),vt$4(t),t}{const t=e.select(0,e.getChildrenSize());return ms(vt$4(t)),t}}function Ls(t,e){ void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=d$2(i);return n[e]=t,t}return i}function Is(e,n,r,i,s){if(0===r.size)return;const o=i.__type,l=i.__key,c=n.get(o);void 0===c&&t(33,o);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===s;(void 0===f||d)&&u.set(l,d?"updated":s);}function Ks(t,e,n){const r=t.getParent();let i=n,s=t;return null!==r&&(e&&0===n?(i=s.getIndexWithinParent(),s=r):e||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function Bs(t,e){const n=t.offset;if("element"===t.type){return Ks(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?Ks(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function Rs(t){const e=Xs(t).event,n=e&&e.inputType;return "insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Ws(t,e,n){return function(t,e,n){const r=vs(t);for(let i=4;i>=0;i--)for(let s=0;s{for(let e=0;et,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Jo(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Jo(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let s=this;const o=this.getParentAtCaret(),l=new Map;for(let t=s.getAdjacentCaret();null!==t&&l.size0){const n=s.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||s.origin.is(e));else {const t=e.getParent();t&&t.is(o)&&e.remove(),n.replace(e);}else null===n&&t(263,Array.from(l).join(" "));}else s.insert(e);s=Jo(e,this.direction);}for(const t of l.values())t.remove();return this}}class Mo extends Eo{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Vo(t,this.direction)}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Oo(this.direction);return Jo(this.getNodeAtCaret(),t)||Vo(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Mo&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const Ao={root:yi,shadowRoot:to};function Oo(t){return wo[t]}function Do(t,e="root"){return Ao[e](t)?null:t}class Po extends Eo{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Jo(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return di(this.origin)?Vo(this.origin,this.direction):null}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Oo(this.direction);return Jo(this.getNodeAtCaret(),t)||Vo(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof Po&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return (t instanceof Po||t instanceof Fo)&&this.direction===t.direction&&this.origin.is(t.origin)}}class Fo extends Eo{type="text";constructor(t,e){super(t),this.offset=e;}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Uo(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Uo(this.origin,Oo(this.direction),this.offset)}isSamePointCaret(t){return t instanceof Fo&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return (t instanceof Po||t instanceof Fo)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Jo(this.origin,this.direction)}}function Lo(t){return t instanceof Fo}function zo(t){return t instanceof Po}function Ko(t){return t instanceof Mo}const Bo={next:class extends Fo{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Fo{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Ro={next:class extends Po{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Po{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Wo={next:class extends Mo{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Mo{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function Jo(t,e){return t?new Ro[e](t):null}function Uo(t,e,n){return t?new Bo[e](t,$o(t,n)):null}function $o(t,e){const n=t.getTextContentSize();let r="next"===e?n:"previous"===e?0:e;return (r<0||r>n)&&(!function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);}(284,String(e),String(n),t.getKey()),r=r<0?0:n),r}function jo(t,e){return new Go(t,e)}function Vo(t,e){return di(t)?new Wo[e](t):null}function Yo(t){return t&&t.getChildCaret()||t}function Ho(t){return t&&Yo(t.getAdjacentCaret())}class qo{type="node-caret-range";constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n;}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new qo(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return Lo(e)?function(t,e){const{direction:n,origin:r}=t,i=$o(r,"focus"===e?Oo(n):n);return jo(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return [jo(t,r.offset-t.offset),null]}return [e,n]}iterNodeCarets(t="root"){const e=Lo(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Lo(n),i=e=>e.isSameNodeCaret(n)?null:Ho(e)||e.getParentCaret(t);return el({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Go{type="slice";constructor(t,e){this.caret=t,this.distance=e;}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n{let n;for(let r=c;rn.has(t.getKey())&&yo(t)));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;Vo(t,"previous").splice(0,e.getChildren()),e.remove();}const g=[f,d,...l,...c].find(gl);if(g){return Zo(ml(pl(g),e.direction))}t(269,JSON.stringify(l.map((t=>t.origin.__key))));}function pl(t){const e=function(t){let e=t;for(;Ko(e);){const t=Ho(e);if(!Ko(t))break;e=t;}return e}(t.getLatest()),{direction:n}=e;if(Qn(e.origin))return Lo(e)?e:Uo(e.origin,n,n);const r=e.getAdjacentCaret();return zo(r)&&Qn(r.origin)?Uo(r.origin,n,Oo(n)):e}function yl(t){return Lo(t)&&t.offset!==$o(t.origin,t.direction)}function ml(t,e){return t.direction===e?t:t.getFlipped()}function xl(t,e){return t.direction===e?t:tl(ml(t.focus,e),ml(t.anchor,e))}function Cl(t,e,n){let r=Vo(t,"next");for(let t=0;t { +function getNonce() { const element = document.head.querySelector("meta[name=csp-nonce]"); return element?.content -}; +} /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -5096,7 +5096,7 @@ function isPrintableCharacter(event) { if (event.ctrlKey || event.metaKey || event.altKey) return false // Ignore special keys - if (event.key.length > 1 && event.key !== 'Enter' && event.key !== 'Space') return false + if (event.key.length > 1 && event.key !== "Enter" && event.key !== "Space") return false // Accept single character keys (letters, numbers, punctuation) return event.key.length === 1 @@ -5167,7 +5167,7 @@ class LexicalToolbarElement extends HTMLElement { } #bindHotkeys() { - this.editorElement.addEventListener('keydown', (event) => { + this.editorElement.addEventListener("keydown", (event) => { const buttons = this.querySelectorAll("[data-hotkey]"); buttons.forEach((button) => { const hotkeys = button.dataset.hotkey.toLowerCase().split(/\s+/); @@ -5183,13 +5183,13 @@ class LexicalToolbarElement extends HTMLElement { #keyCombinationFor(event) { const pressedKey = event.key.toLowerCase(); const modifiers = [ - event.ctrlKey ? 'ctrl' : null, - event.metaKey ? 'cmd' : null, - event.altKey ? 'alt' : null, - event.shiftKey ? 'shift' : null, + event.ctrlKey ? "ctrl" : null, + event.metaKey ? "cmd" : null, + event.altKey ? "alt" : null, + event.shiftKey ? "shift" : null, ].filter(Boolean); - return [ ...modifiers, pressedKey ].join('+') + return [ ...modifiers, pressedKey ].join("+") } #assignButtonTabindex() { @@ -5263,19 +5263,6 @@ class LexicalToolbarElement extends HTMLElement { this.#updateUndoRedoButtonStates(); } - #isSelectionInInlineCode(selection) { - const nodes = selection.getNodes(); - return nodes.some(node => { - if (st$1(node)) return true - // Check parent for text nodes inside code highlight - if (Qn(node)) { - const parent = node.getParent(); - if (parent && st$1(parent)) return true - } - return false - }) - } - #isInList(node) { let current = node; while (current) { @@ -5454,59 +5441,51 @@ var theme = { underline: "lexxy-content__underline", }, codeHighlight: { - 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__property', - decorator: 'code-token__function', - deleted: 'code-token__property', - doctype: 'code-token__comment', - entity: 'code-token__operator', - function: 'code-token__function', - hexcode: 'code-token__property', - important: 'code-token__variable', - inserted: 'code-token__selector', - italic: 'code-token__comment', - keyword: 'code-token__attr', - namespace: 'code-token__variable', - number: 'code-token__property', - operator: 'code-token__operator', - parameter: 'code-token__variable', - prolog: 'code-token__comment', - property: 'code-token__property', - punctuation: 'code-token__punctuation', - 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', - url: 'code-token__operator', - variable: 'code-token__variable', + 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__property", + decorator: "code-token__function", + deleted: "code-token__property", + doctype: "code-token__comment", + entity: "code-token__operator", + function: "code-token__function", + hexcode: "code-token__property", + important: "code-token__variable", + inserted: "code-token__selector", + italic: "code-token__comment", + keyword: "code-token__attr", + namespace: "code-token__variable", + number: "code-token__property", + operator: "code-token__operator", + parameter: "code-token__variable", + prolog: "code-token__comment", + property: "code-token__property", + punctuation: "code-token__punctuation", + 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", + url: "code-token__operator", + variable: "code-token__variable", } }; -function bytesToHumanSize(bytes) { - if (bytes === 0) return "0 B" - const sizes = [ "B", "KB", "MB", "GB", "TB", "PB" ]; - const i = Math.floor(Math.log(bytes) / Math.log(1024)); - const value = bytes / Math.pow(1024, i); - return `${ value.toFixed(2) } ${ sizes[i] }` -} - const VISUALLY_RELEVANT_ELEMENTS_SELECTOR = [ "img", "video", "audio", "iframe", "embed", "object", "picture", "source", "canvas", "svg", "math", "form", "input", "textarea", "select", "button", "code", "blockquote", "hr" @@ -5537,9 +5516,9 @@ function parseHtml(html) { } function createAttachmentFigure(contentType, isPreviewable, fileName) { - const extension = fileName ? fileName.split('.').pop().toLowerCase() : "unknown"; + const extension = fileName ? fileName.split(".").pop().toLowerCase() : "unknown"; return createElement("figure", { - className: `attachment attachment--${isPreviewable ? 'preview' : 'file'} attachment--${extension}`, + className: `attachment attachment--${isPreviewable ? "preview" : "file"} attachment--${extension}`, "data-content-type": contentType }) } @@ -5579,13 +5558,21 @@ function generateDomId(prefix) { return `${prefix}-${randomPart}` } +function bytesToHumanSize(bytes) { + if (bytes === 0) return "0 B" + const sizes = [ "B", "KB", "MB", "GB", "TB", "PB" ]; + const i = Math.floor(Math.log(bytes) / Math.log(1024)); + const value = bytes / Math.pow(1024, i); + return `${ value.toFixed(2) } ${ sizes[i] }` +} + class ActionTextAttachmentNode extends gi { static getType() { return "action_text_attachment" } static clone(node) { - return new ActionTextAttachmentNode({ ...node }, node.__key); + return new ActionTextAttachmentNode({ ...node }, node.__key) } static importJSON(serializedNode) { @@ -5723,7 +5710,7 @@ class ActionTextAttachmentNode extends gi { } #createDOMForImage() { - return createElement("img", { src: this.src, alt: this.altText, ...this.#imageDimensions}) + return createElement("img", { src: this.src, alt: this.altText, ...this.#imageDimensions }) } get #imageDimensions() { @@ -5735,8 +5722,8 @@ class ActionTextAttachmentNode extends gi { } #createDOMForFile() { - const extension = this.fileName ? this.fileName.split('.').pop().toLowerCase() : 'unknown'; - return createElement("span", { className: "attachment__icon", textContent: `${extension}`}) + const extension = this.fileName ? this.fileName.split(".").pop().toLowerCase() : "unknown"; + return createElement("span", { className: "attachment__icon", textContent: `${extension}` }) } #createDOMForNotImage() { @@ -5773,9 +5760,6 @@ class ActionTextAttachmentNode extends gi { return caption } - #updateCaption(input) { - } - #handleCaptionInputBlurred(event) { const input = event.target; @@ -5819,7 +5803,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { } static clone(node) { - return new ActionTextAttachmentUploadNode({ ...node }, node.__key); + return new ActionTextAttachmentUploadNode({ ...node }, node.__key) } constructor({ file, uploadUrl, blobUrlTemplate, editor, progress }, key) { @@ -5872,7 +5856,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { } #getFileExtension() { - return this.file.name.split('.').pop().toLowerCase() + return this.file.name.split(".").pop().toLowerCase() } #createCaption() { @@ -5902,7 +5886,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { directUploadWillStoreFileWithXHR: (request) => { request.upload.addEventListener("progress", (event) => { this.editor.update(() => { - progressBar.value = Math.round((event.loaded / event.total) * 100); + progressBar.value = Math.round(event.loaded / event.total * 100); }); }); } @@ -6094,7 +6078,7 @@ class CommandDispatcher { dispatchInsertUnorderedList() { const selection = Nr(); - if (!selection) return; + if (!selection) return const anchorNode = selection.anchor.getNode(); @@ -6107,7 +6091,7 @@ class CommandDispatcher { dispatchInsertOrderedList() { const selection = Nr(); - if (!selection) return; + if (!selection) return const anchorNode = selection.anchor.getNode(); @@ -6550,11 +6534,11 @@ class Selection { // above when navigating UP/DOWN when Lexical shows its fake cursor on custom decorator nodes. this.editorContentElement.addEventListener("keydown", (event) => { if (event.key === "ArrowUp") { - const lexicalCursor = this.editor.getRootElement().querySelector('[data-lexical-cursor]'); + const lexicalCursor = this.editor.getRootElement().querySelector("[data-lexical-cursor]"); if (lexicalCursor) { let currentElement = lexicalCursor.previousElementSibling; - while (currentElement && currentElement.hasAttribute('data-lexical-cursor')) { + while (currentElement && currentElement.hasAttribute("data-lexical-cursor")) { currentElement = currentElement.previousElementSibling; } @@ -6565,11 +6549,11 @@ class Selection { } if (event.key === "ArrowDown") { - const lexicalCursor = this.editor.getRootElement().querySelector('[data-lexical-cursor]'); + const lexicalCursor = this.editor.getRootElement().querySelector("[data-lexical-cursor]"); if (lexicalCursor) { let currentElement = lexicalCursor.nextElementSibling; - while (currentElement && currentElement.hasAttribute('data-lexical-cursor')) { + while (currentElement && currentElement.hasAttribute("data-lexical-cursor")) { currentElement = currentElement.nextElementSibling; } @@ -6757,7 +6741,7 @@ class Selection { } #isRectUnreliable(rect) { - return (rect.width === 0 && rect.height === 0) || (rect.top === 0 && rect.left === 0) + return rect.width === 0 && rect.height === 0 || rect.top === 0 && rect.left === 0 } #createAndInsertMarker(range) { @@ -6788,7 +6772,7 @@ class Selection { #calculateCursorPosition(rect, range) { const rootRect = this.editor.getRootElement().getBoundingClientRect(); - let x = rect.left - rootRect.left; + const x = rect.left - rootRect.left; let y = rect.top - rootRect.top; const fontSize = this.#getFontSizeForCursor(range); @@ -7520,8 +7504,8 @@ class Contents { firstParagraph.selectStart(); const currentSelection = Nr(); if (currentSelection && cr(currentSelection)) { - currentSelection.anchor.set(firstParagraph.getKey(), 0, 'element'); - currentSelection.focus.set(lastParagraph.getKey(), lastParagraph.getChildrenSize(), 'element'); + currentSelection.anchor.set(firstParagraph.getKey(), 0, "element"); + currentSelection.focus.set(lastParagraph.getKey(), lastParagraph.getChildrenSize(), "element"); } } @@ -7575,14 +7559,14 @@ class Contents { const last = children[children.length - 1]; const beforeLast = children[children.length - 2]; - if ((Qn(last) && last.getTextContent() === "") && (beforeLast && !Qn(beforeLast))) { + if (Qn(last) && last.getTextContent() === "" && (beforeLast && !Qn(beforeLast))) { paragraph.append(Pn()); } } } #createCustomAttachmentNodeWithHtml(html, options = {}) { - const attachmentConfig = typeof options === 'object' ? options : {}; + const attachmentConfig = typeof options === "object" ? options : {}; return new CustomActionTextAttachmentNode({ sgid: attachmentConfig.sgid || null, @@ -7597,7 +7581,7 @@ class Contents { } #shouldUploadFile(file) { - return dispatch(this.editorElement, 'lexxy:file-accept', { file }, true) + return dispatch(this.editorElement, "lexxy:file-accept", { file }, true) } } @@ -7677,7 +7661,7 @@ function isUrl(string) { try { new URL(string); return true - } catch (_) { + } catch { return false } } @@ -7752,7 +7736,7 @@ class Clipboard { #handlePastedFiles(clipboardData) { if (!this.editorElement.supportsAttachments) return - const html = clipboardData.getData('text/html'); + const html = clipboardData.getData("text/html"); if (html) return // Ignore if image copied from browser since we will load it as a remote image this.#preservingScrollPosition(() => { @@ -8670,7 +8654,7 @@ class LexicalPromptElement extends HTMLElement { popoverContainer.classList.add("lexxy-prompt-menu"); popoverContainer.style.position = "absolute"; popoverContainer.setAttribute("nonce", getNonce()); - popoverContainer.append(...(await this.source.buildListItems())); + popoverContainer.append(...await this.source.buildListItems()); popoverContainer.addEventListener("click", this.#handlePopoverClick); this.#editorElement.appendChild(popoverContainer); return popoverContainer diff --git a/app/assets/javascript/lexxy.js.br b/app/assets/javascript/lexxy.js.br index fdca1cf5b..2f111085d 100644 Binary files a/app/assets/javascript/lexxy.js.br and b/app/assets/javascript/lexxy.js.br differ diff --git a/app/assets/javascript/lexxy.js.gz b/app/assets/javascript/lexxy.js.gz index e426e9e79..b73e132ba 100644 Binary files a/app/assets/javascript/lexxy.js.gz and b/app/assets/javascript/lexxy.js.gz differ diff --git a/app/assets/javascript/lexxy.min.js b/app/assets/javascript/lexxy.min.js index a1be50662..b9bfb56cb 100644 --- a/app/assets/javascript/lexxy.min.js +++ b/app/assets/javascript/lexxy.min.js @@ -1,5 +1,5 @@ import{DirectUpload as e}from"@rails/activestorage"; -/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:t,setPrototypeOf:n,isFrozen:r,getPrototypeOf:i,getOwnPropertyDescriptor:s}=Object;let{freeze:o,seal:a,create:l}=Object,{apply:c,construct:u}="undefined"!=typeof Reflect&&Reflect;o||(o=function(e){return e}),a||(a=function(e){return e}),c||(c=function(e,t,n){return e.apply(t,n)}),u||(u=function(e,t){return new e(...t)});const d=T(Array.prototype.forEach),h=T(Array.prototype.lastIndexOf),g=T(Array.prototype.pop),p=T(Array.prototype.push),f=T(Array.prototype.splice),m=T(String.prototype.toLowerCase),y=T(String.prototype.toString),_=T(String.prototype.match),b=T(String.prototype.replace),x=T(String.prototype.indexOf),k=T(String.prototype.trim),v=T(Object.prototype.hasOwnProperty),S=T(RegExp.prototype.test),w=(C=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:m;n&&n(e,null);let s=t.length;for(;s--;){let n=t[s];if("string"==typeof n){const e=i(n);e!==n&&(r(t)||(t[s]=e),n=e)}e[n]=!0}return e}function N(e){for(let t=0;t/gm),K=a(/\$\{[\w\W]*/gm),j=a(/^data-[\-\w.\u00B7-\uFFFF]+$/),q=a(/^aria-[\-\w]+$/),J=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=a(/^(?:\w+script|data):/i),G=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=a(/^html$/i),Y=a(/^[a-z][.\w]*(-[.\w]+)+$/i);var X=Object.freeze({__proto__:null,ARIA_ATTR:q,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:Y,DATA_ATTR:j,DOCTYPE_NAME:Z,ERB_EXPR:H,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:V,MUSTACHE_EXPR:W,TMPLIT_EXPR:K});const Q=1,ee=3,te=7,ne=8,re=9,ie=function(){return"undefined"==typeof window?null:window};var se=function e(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie();const r=t=>e(t);if(r.version="3.2.6",r.removed=[],!n||!n.document||n.document.nodeType!==re||!n.Element)return r.isSupported=!1,r;let{document:i}=n;const s=i,a=s.currentScript,{DocumentFragment:c,HTMLTemplateElement:u,Node:C,Element:T,NodeFilter:N,NamedNodeMap:W=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:H,DOMParser:K,trustedTypes:j}=n,q=T.prototype,V=L(q,"cloneNode"),G=L(q,"remove"),Y=L(q,"nextSibling"),se=L(q,"childNodes"),oe=L(q,"parentNode");if("function"==typeof u){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let ae,le="";const{implementation:ce,createNodeIterator:ue,createDocumentFragment:de,getElementsByTagName:he}=i,{importNode:ge}=s;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};r.isSupported="function"==typeof t&&"function"==typeof oe&&ce&&void 0!==ce.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:me,TMPLIT_EXPR:ye,DATA_ATTR:_e,ARIA_ATTR:be,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:ke,CUSTOM_ELEMENT:ve}=X;let{IS_ALLOWED_URI:Se}=X,we=null;const Ce=E({},[...P,...F,...O,...R,...D]);let Te=null;const Ee=E({},[...z,...B,...$,...U]);let Ne=Object.seal(l(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,Pe=!0,Fe=!0,Oe=!1,Ie=!0,Re=!1,Me=!0,De=!1,ze=!1,Be=!1,$e=!1,Ue=!1,We=!1,He=!0,Ke=!1,je=!0,qe=!1,Je={},Ve=null;const Ge=E({},["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 Ze=null;const Ye=E({},["audio","video","img","source","image","track"]);let Xe=null;const Qe=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),et="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let rt=nt,it=!1,st=null;const ot=E({},[et,tt,nt],y);let at=E({},["mi","mo","mn","ms","mtext"]),lt=E({},["annotation-xml"]);const ct=E({},["title","style","font","a","script"]);let ut=null;const dt=["application/xhtml+xml","text/html"];let ht=null,gt=null;const pt=i.createElement("form"),ft=function(e){return e instanceof RegExp||e instanceof Function},mt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!gt||gt!==e){if(e&&"object"==typeof e||(e={}),e=A(e),ut=-1===dt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ht="application/xhtml+xml"===ut?y:m,we=v(e,"ALLOWED_TAGS")?E({},e.ALLOWED_TAGS,ht):Ce,Te=v(e,"ALLOWED_ATTR")?E({},e.ALLOWED_ATTR,ht):Ee,st=v(e,"ALLOWED_NAMESPACES")?E({},e.ALLOWED_NAMESPACES,y):ot,Xe=v(e,"ADD_URI_SAFE_ATTR")?E(A(Qe),e.ADD_URI_SAFE_ATTR,ht):Qe,Ze=v(e,"ADD_DATA_URI_TAGS")?E(A(Ye),e.ADD_DATA_URI_TAGS,ht):Ye,Ve=v(e,"FORBID_CONTENTS")?E({},e.FORBID_CONTENTS,ht):Ge,Ae=v(e,"FORBID_TAGS")?E({},e.FORBID_TAGS,ht):A({}),Le=v(e,"FORBID_ATTR")?E({},e.FORBID_ATTR,ht):A({}),Je=!!v(e,"USE_PROFILES")&&e.USE_PROFILES,Pe=!1!==e.ALLOW_ARIA_ATTR,Fe=!1!==e.ALLOW_DATA_ATTR,Oe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Re=e.SAFE_FOR_TEMPLATES||!1,Me=!1!==e.SAFE_FOR_XML,De=e.WHOLE_DOCUMENT||!1,$e=e.RETURN_DOM||!1,Ue=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Be=e.FORCE_BODY||!1,He=!1!==e.SANITIZE_DOM,Ke=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,qe=e.IN_PLACE||!1,Se=e.ALLOWED_URI_REGEXP||J,rt=e.NAMESPACE||nt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,lt=e.HTML_INTEGRATION_POINTS||lt,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ft(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),Re&&(Fe=!1),Ue&&($e=!0),Je&&(we=E({},D),Te=[],!0===Je.html&&(E(we,P),E(Te,z)),!0===Je.svg&&(E(we,F),E(Te,B),E(Te,U)),!0===Je.svgFilters&&(E(we,O),E(Te,B),E(Te,U)),!0===Je.mathMl&&(E(we,R),E(Te,$),E(Te,U))),e.ADD_TAGS&&(we===Ce&&(we=A(we)),E(we,e.ADD_TAGS,ht)),e.ADD_ATTR&&(Te===Ee&&(Te=A(Te)),E(Te,e.ADD_ATTR,ht)),e.ADD_URI_SAFE_ATTR&&E(Xe,e.ADD_URI_SAFE_ATTR,ht),e.FORBID_CONTENTS&&(Ve===Ge&&(Ve=A(Ve)),E(Ve,e.FORBID_CONTENTS,ht)),je&&(we["#text"]=!0),De&&E(we,["html","head","body"]),we.table&&(E(we,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ae=e.TRUSTED_TYPES_POLICY,le=ae.createHTML("")}else void 0===ae&&(ae=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}}(j,a)),null!==ae&&"string"==typeof le&&(le=ae.createHTML(""));o&&o(e),gt=e}},yt=E({},[...F,...O,...I]),_t=E({},[...R,...M]),bt=function(e){p(r.removed,{element:e});try{oe(e).removeChild(e)}catch(t){G(e)}},xt=function(e,t){try{p(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){p(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if($e||Ue)try{bt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},kt=function(e){let t=null,n=null;if(Be)e=""+e;else{const t=_(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&rt===nt&&(e=''+e+"");const r=ae?ae.createHTML(e):e;if(rt===nt)try{t=(new K).parseFromString(r,ut)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(rt,"template",null);try{t.documentElement.innerHTML=it?le:r}catch(e){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(i.createTextNode(n),s.childNodes[0]||null),rt===nt?he.call(t,De?"html":"body")[0]:De?t.documentElement:s},vt=function(e){return ue.call(e.ownerDocument||e,e,N.SHOW_ELEMENT|N.SHOW_COMMENT|N.SHOW_TEXT|N.SHOW_PROCESSING_INSTRUCTION|N.SHOW_CDATA_SECTION,null)},St=function(e){return e instanceof H&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof W)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},wt=function(e){return"function"==typeof C&&e instanceof C};function Ct(e,t,n){d(e,(e=>{e.call(r,t,n,gt)}))}const Tt=function(e){let t=null;if(Ct(pe.beforeSanitizeElements,e,null),St(e))return bt(e),!0;const n=ht(e.nodeName);if(Ct(pe.uponSanitizeElement,e,{tagName:n,allowedTags:we}),Me&&e.hasChildNodes()&&!wt(e.firstElementChild)&&S(/<[/\w!]/g,e.innerHTML)&&S(/<[/\w!]/g,e.textContent))return bt(e),!0;if(e.nodeType===te)return bt(e),!0;if(Me&&e.nodeType===ne&&S(/<[/\w]/g,e.data))return bt(e),!0;if(!we[n]||Ae[n]){if(!Ae[n]&&Nt(n)){if(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,n))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))return!1}if(je&&!Ve[n]){const t=oe(e)||e.parentNode,n=se(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=V(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,Y(e))}}}return bt(e),!0}return e instanceof T&&!function(e){let t=oe(e);t&&t.tagName||(t={namespaceURI:rt,tagName:"template"});const n=m(e.tagName),r=m(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===tt?t.namespaceURI===nt?"svg"===n:t.namespaceURI===et?"svg"===n&&("annotation-xml"===r||at[r]):Boolean(yt[n]):e.namespaceURI===et?t.namespaceURI===nt?"math"===n:t.namespaceURI===tt?"math"===n&<[r]:Boolean(_t[n]):e.namespaceURI===nt?!(t.namespaceURI===tt&&!lt[r])&&!(t.namespaceURI===et&&!at[r])&&!_t[n]&&(ct[n]||!yt[n]):!("application/xhtml+xml"!==ut||!st[e.namespaceURI]))}(e)?(bt(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!S(/<\/no(script|embed|frames)/i,e.innerHTML)?(Re&&e.nodeType===ee&&(t=e.textContent,d([fe,me,ye],(e=>{t=b(t,e," ")})),e.textContent!==t&&(p(r.removed,{element:e.cloneNode()}),e.textContent=t)),Ct(pe.afterSanitizeElements,e,null),!1):(bt(e),!0)},Et=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in i||n in pt))return!1;if(Fe&&!Le[t]&&S(_e,t));else if(Pe&&S(be,t));else if(!Te[t]||Le[t]){if(!(Nt(e)&&(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&S(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Xe[t]);else if(S(Se,b(n,ke,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!Ze[e]){if(Oe&&!S(xe,b(n,ke,"")));else if(n)return!1}else;return!0},Nt=function(e){return"annotation-xml"!==e&&_(e,ve)},At=function(e){Ct(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||St(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te,forceKeepAttr:void 0};let i=t.length;for(;i--;){const s=t[i],{name:o,namespaceURI:a,value:l}=s,c=ht(o),u=l;let h="value"===o?u:k(u);if(n.attrName=c,n.attrValue=h,n.keepAttr=!0,n.forceKeepAttr=void 0,Ct(pe.uponSanitizeAttribute,e,n),h=n.attrValue,!Ke||"id"!==c&&"name"!==c||(xt(o,e),h="user-content-"+h),Me&&S(/((--!?|])>)|<\/(style|title)/i,h)){xt(o,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){xt(o,e);continue}if(!Ie&&S(/\/>/i,h)){xt(o,e);continue}Re&&d([fe,me,ye],(e=>{h=b(h,e," ")}));const p=ht(e.nodeName);if(Et(p,c,h)){if(ae&&"object"==typeof j&&"function"==typeof j.getAttributeType)if(a);else switch(j.getAttributeType(p,c)){case"TrustedHTML":h=ae.createHTML(h);break;case"TrustedScriptURL":h=ae.createScriptURL(h)}if(h!==u)try{a?e.setAttributeNS(a,o,h):e.setAttribute(o,h),St(e)?bt(e):g(r.removed)}catch(t){xt(o,e)}}else xt(o,e)}Ct(pe.afterSanitizeAttributes,e,null)},Lt=function e(t){let n=null;const r=vt(t);for(Ct(pe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Ct(pe.uponSanitizeShadowNode,n,null),Tt(n),At(n),n.content instanceof c&&e(n.content);Ct(pe.afterSanitizeShadowDOM,t,null)};return r.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,i=null,o=null,a=null;if(it=!e,it&&(e="\x3c!--\x3e"),"string"!=typeof e&&!wt(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!r.isSupported)return e;if(ze||mt(t),r.removed=[],"string"==typeof e&&(qe=!1),qe){if(e.nodeName){const t=ht(e.nodeName);if(!we[t]||Ae[t])throw w("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof C)n=kt("\x3c!----\x3e"),i=n.ownerDocument.importNode(e,!0),i.nodeType===Q&&"BODY"===i.nodeName||"HTML"===i.nodeName?n=i:n.appendChild(i);else{if(!$e&&!Re&&!De&&-1===e.indexOf("<"))return ae&&We?ae.createHTML(e):e;if(n=kt(e),!n)return $e?null:We?le:""}n&&Be&&bt(n.firstChild);const l=vt(qe?e:n);for(;o=l.nextNode();)Tt(o),At(o),o.content instanceof c&&Lt(o.content);if(qe)return e;if($e){if(Ue)for(a=de.call(n.ownerDocument);n.firstChild;)a.appendChild(n.firstChild);else a=n;return(Te.shadowroot||Te.shadowrootmode)&&(a=ge.call(s,a,!0)),a}let u=De?n.outerHTML:n.innerHTML;return De&&we["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&S(Z,n.ownerDocument.doctype.name)&&(u="\n"+u),Re&&d([fe,me,ye],(e=>{u=b(u,e," ")})),ae&&We?ae.createHTML(u):u},r.setConfig=function(){mt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ze=!0},r.clearConfig=function(){gt=null,ze=!1},r.isValidAttribute=function(e,t,n){gt||mt({});const r=ht(e),i=ht(t);return Et(r,i,n)},r.addHook=function(e,t){"function"==typeof t&&p(pe[e],t)},r.removeHook=function(e,t){if(void 0!==t){const n=h(pe[e],t);return-1===n?void 0:f(pe[e],n,1)[0]}return g(pe[e])},r.removeHooks=function(e){pe[e]=[]},r.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},r}();function oe(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.`)}se.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));const ae="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,le=ae&&"documentMode"in document?document.documentMode:null,ce=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ue=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),de=!(!ae||!("InputEvent"in window)||le)&&"getTargetRanges"in new window.InputEvent("input"),he=ae&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ge=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,pe=ae&&/Android/.test(navigator.userAgent),fe=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),me=ae&&pe&&fe,ye=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!fe;function _e(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const be=0,xe=1,ke=2,ve=1,Se=2,we=3,Ce=4,Te=5,Ee=6,Ne=he||ge||ye?" ":"​",Ae="\n\n",Le=ue?" ":Ne,Pe="֑-߿יִ-﷽ﹰ-ﻼ",Fe="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Oe=new RegExp("^[^"+Fe+"]*["+Pe+"]"),Ie=new RegExp("^[^"+Pe+"]*["+Fe+"]"),Re={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Me={directionless:1,unmergeable:2},De={center:2,end:6,justify:4,left:1,right:3,start:5},ze={[Se]:"center",[Ee]:"end",[Ce]:"justify",[ve]:"left",[we]:"right",[Te]:"start"},Be={normal:0,segmented:2,token:1},$e={[be]:"normal",[ke]:"segmented",[xe]:"token"},Ue="$";function We(e,t,n,r,i,s){let o=e.getFirstChild();for(;null!==o;){const e=o.__key;o.__parent===t&&(Ui(o)&&We(o,e,n,r,i,s),n.has(e)||s.delete(e),i.push(e)),o=o.getNextSibling()}}let He=!1,Ke=0;function je(e){Ke=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!==Ls(e,n)}function Je(e,t,n){const r=yo(uo(n));let i=null,s=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,s=r.focusOffset);const o=e.nodeValue;null!==o&&Ks(t,o,i,s,!1)}function Ve(e,t,n){if(Ur(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return xs(t)&&n.isAttached()}function Ge(e,t,n,r){for(let i=e;i&&!Fo(i);i=so(i)){const e=Ls(i,t);if(void 0!==e){const t=Ns(e,n);if(t)return Ki(t)||!bo(i)?void 0:[i,t]}else if(i===r)return[r,Rs(n)]}}function Ze(e,t,n){He=!0;const r=performance.now()-Ke>100;try{Di(e,(()=>{const i=ii()||function(e){return e.getEditorState().read((()=>{const e=ii();return null!==e?e.clone():null}))}(e),s=new Map,o=e.getRootElement(),a=e._editorState,l=e._blockCursorElement;let c=!1,u="";for(let n=0;n0){let t=0;for(let i=0;i0)for(const[t,n]of s)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t{Ze(e,t,n)}))}let Qe=class e{constructor(e,t=new Map,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedConfigMap=t,this.unknownState=n,this.knownState=r;const 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}(t,n,r);this.size=s}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.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};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);return et(e)?{[Ue]:e}:{}}getWritable(t){if(this.node===t)return this;const n=new Map(this.knownState),r=et(i=this.unknownState)&&{...i};var i;if(r)for(const e of n.keys())delete r[e.key];return new e(t,this.sharedConfigMap,et(r),n,this.size)}updateFromKnown(e,t){const n=e.key;this.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||this.size++,r.set(e,t)}updateFromUnknown(e,t){const n=this.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={},e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n);this.unknownState=et(this.unknownState)}};function et(e){if(e)for(const t in e)return e}function tt(e,t){const n=e.__mode,r=e.__format,i=e.__style,s=t.__mode,o=t.__format,a=t.__style,l=e.__state,c=t.__state;return(null===n||n===s)&&(null===r||r===o)&&(null===i||i===a)&&(null===e.__state||l===c||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;const n=new Set,r=(e,t)=>{for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const e=t?t.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return!0}return!1},i=(e,t)=>{const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r)for(const[e,t]of Object.entries(r))if(!n.has(e)&&(n.add(e),t!==(i?i[e]:void 0)))return!0;return!1};return!(e&&r(e,t)||t&&r(t,e)||e&&i(e,t)||t&&i(t,e))}(l,c))}function nt(e,t){const n=e.mergeWithSibling(t),r=Ci()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function rt(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Pr(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(tt(t,r)){r=nt(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&Pr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(tt(r,n)){r=nt(r,n);break}break}n.remove()}}else r.remove()}function it(e){return st(e.anchor),st(e.focus),e}function st(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),Pr(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!Ui(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let ot,at,lt,ct,ut,dt,ht,gt,pt,ft,mt="",yt="",_t=null,bt="",xt="",kt=!1,vt=!1,St=null;function wt(e,t){const n=ht.get(e);if(null!==t){const n=$t(e);n.parentNode===t&&t.removeChild(n)}if(gt.has(e)||at._keyToDOMMap.delete(e),Ui(n)){const e=Mt(n,ht);Ct(e,0,e.length-1,null)}void 0!==n&&Xs(ft,lt,ct,n,"destroyed")}function Ct(e,t,n,r){let i=t;for(;i<=n;++i){const t=e[i];void 0!==t&&wt(t,r)}}function Tt(e,t){e.setProperty("text-align",t)}const Et="40px";function Nt(e,t){const n=ot.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||Et;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function At(e,t){const n=e.style;0===t?Tt(n,""):1===t?Tt(n,"left"):2===t?Tt(n,"center"):3===t?Tt(n,"right"):4===t?Tt(n,"justify"):5===t?Tt(n,"start"):6===t&&Tt(n,"end")}function Lt(e,t){const n=gt.get(e);void 0===n&&oe(60);const r=n.createDOM(ot,at);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,at),Pr(n)?r.setAttribute("data-lexical-text","true"):Ki(n)&&r.setAttribute("data-lexical-decorator","true"),Ui(n)){const e=n.__indent,t=n.__size;if(0!==e&&Nt(r,e),0!==t){const e=t-1;!function(e,t,n,r){const i=yt;yt="",Pt(e,n,0,t,n.getDOMSlot(r)),It(n,r),yt=i}(Mt(n,gt),e,n,r)}const i=n.__format;0!==i&&At(r,i),n.isInline()||Ot(null,n,r),ro(n)&&(mt+=Ae,xt+=Ae)}else{const t=n.getTextContent();if(Ki(n)){const t=n.decorate(at,ot);null!==t&&zt(e,t),r.contentEditable="false"}else Pr(n)&&(n.isDirectionless()||(yt+=t));mt+=t,xt+=t}return null!==t&&t.insertChild(r),Xs(ft,lt,ct,n,"created"),r}function Pt(e,t,n,r,i){const s=mt;mt="";let o=n;for(;o<=r;++o){Lt(e[o],i);const t=gt.get(e[o]);null!==t&&Pr(t)&&(null===_t&&(_t=t.getFormat()),""===bt&&(bt=t.getStyle()))}ro(t)&&(mt+=Ae),i.element.__lexicalTextContent=mt,mt=s+mt}function Ft(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return gr(e)?"line-break":Ki(e)&&e.isInline()?"decorator":null}return"empty"}return null}function Ot(e,t,n){const r=Ft(e,ht),i=Ft(t,gt);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function It(e,t){const n=t.__lexicalDirTextContent||"",r=t.__lexicalDir||"";if(n!==yt||r!==St){const n=""===yt,i=n?St:function(e){return Oe.test(e)?"rtl":Ie.test(e)?"ltr":null}(yt);if(i!==r){const s=t.classList,o=ot.theme;let a=null!==r?o[r]:void 0,l=null!==i?o[i]:void 0;if(void 0!==a){if("string"==typeof a){const e=_e(a);a=o[r]=e}s.remove(...a)}if(null===i||n&&"ltr"===i)t.removeAttribute("dir");else{if(void 0!==l){if("string"==typeof l){const e=_e(l);l=o[i]=e}void 0!==l&&s.add(...l)}t.dir=i}vt||(e.getWritable().__dir=i)}St=i,t.__lexicalDirTextContent=yt,t.__lexicalDir=i}}function Rt(e,t,n){const r=yt;var i;yt="",_t=null,bt="",function(e,t,n){const r=mt,i=e.__size,s=t.__size;mt="";const o=n.element;if(1===i&&1===s){const n=e.__first,i=t.__first;if(n===i)Dt(n,o);else{const e=$t(n),t=Lt(i,null);try{o.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const s=`${r.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(s)}throw r}wt(n,null)}const s=gt.get(i);Pr(s)&&(null===_t&&(_t=s.getFormat()),""===bt&&(bt=s.getStyle()))}else{const r=Mt(e,ht),a=Mt(t,gt);if(r.length!==i&&oe(227),a.length!==s&&oe(228),0===i)0!==s&&Pt(a,t,0,s-1,n);else if(0===s){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;Ct(r,0,i-1,e?null:o),e&&(o.textContent="")}}else!function(e,t,n,r,i,s){const o=r-1,a=i-1;let l,c,u=s.getFirstChild(),d=0,h=0;for(;d<=o&&h<=a;){const e=t[d],r=n[h];if(e===r)u=Bt(Dt(r,s.element)),d++,h++;else{void 0===l&&(l=new Set(t)),void 0===c&&(c=new Set(n));const i=c.has(e),o=l.has(r);if(i)if(o){const e=io(at,r);e===u?u=Bt(Dt(r,s.element)):(s.withBefore(u).insertChild(e),Dt(r,s.element)),d++,h++}else Lt(r,s.withBefore(u)),h++;else u=Bt($t(e)),wt(e,s.element),d++}const i=gt.get(r);null!==i&&Pr(i)&&(null===_t&&(_t=i.getFormat()),""===bt&&(bt=i.getStyle()))}const g=d>o,p=h>a;if(g&&!p){const t=n[a+1],r=void 0===t?null:at.getElementByKey(t);Pt(n,e,h,a,s.withBefore(r))}else p&&!g&&Ct(t,d,o,s.element)}(t,r,a,i,s,n)}ro(t)&&(mt+=Ae),o.__lexicalTextContent=mt,mt=r+mt}(e,t,t.getDOMSlot(n)),It(t,n),i=t,null==_t||_t===i.__textFormat||vt||i.setTextFormat(_t),function(e){""===bt||bt===e.__textStyle||vt||e.setTextStyle(bt)}(t),yt=r}function Mt(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&oe(101),n.push(r),r=e.__next}return n}function Dt(e,t){const n=ht.get(e);let r=gt.get(e);void 0!==n&&void 0!==r||oe(61);const i=kt||dt.has(e)||ut.has(e),s=io(at,e);if(n===r&&!i){if(Ui(n)){const e=s.__lexicalTextContent;void 0!==e&&(mt+=e,xt+=e);const t=s.__lexicalDirTextContent;void 0!==t&&(yt+=t)}else{const e=n.getTextContent();Pr(n)&&!n.isDirectionless()&&(yt+=e),xt+=e,mt+=e}return s}if(n!==r&&i&&Xs(ft,lt,ct,r,"updated"),r.updateDOM(n,s,ot)){const n=Lt(e,null);return null===t&&oe(62),t.replaceChild(n,s),wt(e,null),n}if(Ui(n)&&Ui(r)){const e=r.__indent;e!==n.__indent&&Nt(s,e);const t=r.__format;t!==n.__format&&At(s,t),i&&(Rt(n,r,s),qi(r)||r.isInline()||Ot(n,r,s)),ro(r)&&(mt+=Ae,xt+=Ae)}else{const t=r.getTextContent();if(Ki(r)){const t=r.decorate(at,ot);null!==t&&zt(e,t)}else Pr(r)&&!r.isDirectionless()&&(yt+=t);mt+=t,xt+=t}if(!vt&&qi(r)&&r.__cachedText!==xt){const e=r.getWritable();e.__cachedText=xt,r=e}return s}function zt(e,t){let n=at._pendingDecorators;const r=at._decorators;if(null===n){if(r[e]===t)return;n=Fs(at)}n[e]=t}function Bt(e){let t=e.nextSibling;return null!==t&&t===at._blockCursorElement&&(t=t.nextSibling),t}function $t(e){const t=pt.get(e);return void 0===t&&oe(75,e),t}function Ut(e){return{type:e}}const Wt=Ut("SELECTION_CHANGE_COMMAND"),Ht=Ut("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Kt=Ut("CLICK_COMMAND"),jt=Ut("DELETE_CHARACTER_COMMAND"),qt=Ut("INSERT_LINE_BREAK_COMMAND"),Jt=Ut("INSERT_PARAGRAPH_COMMAND"),Vt=Ut("CONTROLLED_TEXT_INSERTION_COMMAND"),Gt=Ut("PASTE_COMMAND"),Zt=Ut("REMOVE_TEXT_COMMAND"),Yt=Ut("DELETE_WORD_COMMAND"),Xt=Ut("DELETE_LINE_COMMAND"),Qt=Ut("FORMAT_TEXT_COMMAND"),en=Ut("UNDO_COMMAND"),tn=Ut("REDO_COMMAND"),nn=Ut("KEYDOWN_COMMAND"),rn=Ut("KEY_ARROW_RIGHT_COMMAND"),sn=Ut("MOVE_TO_END"),on=Ut("KEY_ARROW_LEFT_COMMAND"),an=Ut("MOVE_TO_START"),ln=Ut("KEY_ARROW_UP_COMMAND"),cn=Ut("KEY_ARROW_DOWN_COMMAND"),un=Ut("KEY_ENTER_COMMAND"),dn=Ut("KEY_SPACE_COMMAND"),hn=Ut("KEY_BACKSPACE_COMMAND"),gn=Ut("KEY_ESCAPE_COMMAND"),pn=Ut("KEY_DELETE_COMMAND"),fn=Ut("KEY_TAB_COMMAND"),mn=Ut("INSERT_TAB_COMMAND"),yn=Ut("INDENT_CONTENT_COMMAND"),_n=Ut("OUTDENT_CONTENT_COMMAND"),bn=Ut("DROP_COMMAND"),xn=Ut("FORMAT_ELEMENT_COMMAND"),kn=Ut("DRAGSTART_COMMAND"),vn=Ut("DRAGOVER_COMMAND"),Sn=Ut("DRAGEND_COMMAND"),wn=Ut("COPY_COMMAND"),Cn=Ut("CUT_COMMAND"),Tn=Ut("SELECT_ALL_COMMAND"),En=Ut("CLEAR_EDITOR_COMMAND"),Nn=Ut("CLEAR_HISTORY_COMMAND"),An=Ut("CAN_REDO_COMMAND"),Ln=Ut("CAN_UNDO_COMMAND"),Pn=Ut("FOCUS_COMMAND"),Fn=Ut("BLUR_COMMAND"),On=Ut("KEY_MODIFIER_COMMAND"),In=Object.freeze({}),Rn=[["keydown",function(e,t){if(!(Mn=e.timeStamp,Dn=e.key,t.isComposing()||no(t,nn,e)||null==e.key)){if(jn&&Gs(e))return Di(t,(()=>{tr(t,qn)})),jn=!1,void(qn="");if(function(e){return qs(e,"ArrowRight",{shiftKey:"any"})}(e))no(t,rn,e);else if(function(e){return qs(e,"ArrowRight",Js)}(e))no(t,sn,e);else if(function(e){return qs(e,"ArrowLeft",{shiftKey:"any"})}(e))no(t,on,e);else if(function(e){return qs(e,"ArrowLeft",Js)}(e))no(t,an,e);else if(function(e){return qs(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))no(t,ln,e);else if(function(e){return qs(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))no(t,cn,e);else if(function(e){return qs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))Hn=!0,no(t,un,e);else if(function(e){return" "===e.key}(e))no(t,dn,e);else if(function(e){return ce&&qs(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),Hn=!0,no(t,qt,!0);else if(function(e){return qs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))Hn=!1,no(t,un,e);else if(function(e){return qs(e,"Backspace",{shiftKey:"any"})||ce&&qs(e,"h",{ctrlKey:!0})}(e))Gs(e)?no(t,hn,e):(e.preventDefault(),no(t,jt,!0));else if(function(e){return"Escape"===e.key}(e))no(t,gn,e);else if(function(e){return qs(e,"Delete",{})||ce&&qs(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),no(t,jt,!1)):no(t,pn,e);else if(function(e){return qs(e,"Backspace",Vs)}(e))e.preventDefault(),no(t,Yt,!0);else if(function(e){return qs(e,"Delete",Vs)}(e))e.preventDefault(),no(t,Yt,!1);else if(function(e){return ce&&qs(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),no(t,Xt,!0);else if(function(e){return ce&&(qs(e,"Delete",{metaKey:!0})||qs(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),no(t,Xt,!1);else if(function(e){return qs(e,"b",Js)}(e))e.preventDefault(),no(t,Qt,"bold");else if(function(e){return qs(e,"u",Js)}(e))e.preventDefault(),no(t,Qt,"underline");else if(function(e){return qs(e,"i",Js)}(e))e.preventDefault(),no(t,Qt,"italic");else if(function(e){return qs(e,"Tab",{shiftKey:"any"})}(e))no(t,fn,e);else if(function(e){return qs(e,"z",Js)}(e))e.preventDefault(),no(t,en,void 0);else if(function(e){return ce?qs(e,"z",{metaKey:!0,shiftKey:!0}):qs(e,"y",{ctrlKey:!0})||qs(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),no(t,tn,void 0);else{const n=t._editorState._selection;null===n||Ur(n)?Zs(e)&&(e.preventDefault(),no(t,Tn,e)):function(e){return qs(e,"c",Js)}(e)?(e.preventDefault(),no(t,wn,e)):function(e){return qs(e,"x",Js)}(e)?(e.preventDefault(),no(t,Cn,e)):Zs(e)&&(e.preventDefault(),no(t,Tn,e))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(e)&&no(t,On,e)}}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;xo(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Di(t,(()=>{hs(n)||(Wn=!0)}))}],["compositionstart",function(e,t){Di(t,(()=>{const n=ii();if(Ur(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();Ts(r.key),(e.timeStamp{tr(t,e.data)})):(jn=!0,qn=e.data)}],["input",function(e,t){e.stopPropagation(),Di(t,(()=>{if(bo(e.target)&&hs(e.target))return;const n=ii(),r=e.data,i=er(e);if(null!=r&&Ur(n)&&Gn(n,i,r,e.timeStamp,!1)){Kn&&(tr(t,r),Kn=!1);const i=n.anchor.getNode(),s=yo(uo(t));if(null===s)return;const o=n.isBackward(),a=o?n.anchor.offset:n.focus.offset,l=o?n.focus.offset:n.anchor.offset;de&&!n.isCollapsed()&&Pr(i)&&null!==s.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===Ws(s.anchorNode)||no(t,Vt,r);const c=r.length;ue&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),he||ge||ye||!t.isComposing()||(Mn=0,Ts(null))}else Hs(!1,t,null!==r?r:void 0),Kn&&(tr(t,r||void 0),Kn=!1);!function(){vi();Ye(Ci())}()}),{event:e}),Bn=null}],["click",function(e,t){Di(t,(()=>{const n=ii(),r=yo(uo(t)),i=si();if(r)if(Ur(n)){const t=n.anchor,s=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!qi(s)&&1===Is().getChildrenSize()&&s.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&s!==n.focus.getNode()){const e=function(e,t){let n=e;for(;n!==Is()&&null!=n;){if(t(n))return n;n=n.getParent()}return null}(s,(e=>Ui(e)&&!e.isInline()));Ui(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(bo(n)||xs(n))&&Ms(ri(i,r,t,e))}no(t,Kt,e)}))}],["cut",In],["copy",In],["dragstart",In],["dragover",In],["dragend",In],["paste",In],["focus",In],["blur",In],["drop",In]];de&&Rn.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType,r=er(e);"deleteCompositionText"===n||ue&&to(t)||"insertCompositionText"!==n&&Di(t,(()=>{const i=ii();if("deleteContentBackward"===n){if(null===i){const e=si();if(!Ur(e))return;Ms(e.clone())}if(Ur(i)){const n=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===Dn&&s{Di(t,(()=>{Ts(null)}))}),30),Ur(i)){const e=i.anchor.getNode();e.markDirty(),Pr(e)||oe(142),Qn(i,e)}}else{Ts(null),e.preventDefault();const r=i.anchor.getNode(),s=r.getTextContent(),o=r.canInsertTextAfter(),a=0===i.anchor.offset&&i.focus.offset===s.length;let l=me&&n&&!a&&o;if(l&&i.isCollapsed()&&(l=!Ki(eo(i.anchor,!0))),!l){no(t,jt,!0);const e=ii();me&&Ur(e)&&e.isCollapsed()&&(Jn=e,setTimeout((()=>Jn=null)))}}return}}var s;if(!Ur(i))return;const o=e.data;null!==Bn&&Hs(!1,t,Bn),i.dirty&&null===Bn||!i.isCollapsed()||qi(i.anchor.getNode())||null===r||i.applyDOMRange(r),Bn=null;const a=i.anchor,l=i.focus,c=a.getNode(),u=l.getNode();if("insertText"!==n&&"insertTranspose"!==n)switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":no(t,Vt,e);break;case"insertFromComposition":Ts(null),no(t,Vt,e);break;case"insertLineBreak":Ts(null),no(t,qt,!1);break;case"insertParagraph":Ts(null),Hn&&!ge?(Hn=!1,no(t,qt,!1)):no(t,Jt,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":no(t,Gt,e);break;case"deleteByComposition":(function(e,t){return e!==t||Ui(e)||Ui(t)||!_s(e)||!_s(t)})(c,u)&&no(t,Zt,e);break;case"deleteByDrag":case"deleteByCut":no(t,Zt,e);break;case"deleteContent":no(t,jt,!1);break;case"deleteWordBackward":no(t,Yt,!0);break;case"deleteWordForward":no(t,Yt,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":no(t,Xt,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":no(t,Xt,!1);break;case"formatStrikeThrough":no(t,Qt,"strikethrough");break;case"formatBold":no(t,Qt,"bold");break;case"formatItalic":no(t,Qt,"italic");break;case"formatUnderline":no(t,Qt,"underline");break;case"historyUndo":no(t,en,void 0);break;case"historyRedo":no(t,tn,void 0)}else{if("\n"===o)e.preventDefault(),no(t,qt,!1);else if(o===Ae)e.preventDefault(),no(t,Jt,void 0);else if(null==o&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=o&&Gn(i,r,o,e.timeStamp,!0)?(e.preventDefault(),no(t,Vt,o)):Bn=o;zn=e.timeStamp}}))}(e,t)]);let Mn=0,Dn=null,zn=0,Bn=null;const $n=new WeakMap;let Un=!1,Wn=!1,Hn=!1,Kn=!1,jn=!1,qn="",Jn=null,Vn=[0,"",0,"root",0];function Gn(e,t,n,r,i){const s=e.anchor,o=e.focus,a=s.getNode(),l=Ci(),c=yo(uo(l)),u=null!==c?c.anchorNode:null,d=s.key,h=l.getElementByKey(d),g=n.length;return d!==o.key||!Pr(a)||(!i&&(!de||zn1||(i||!de)&&null!==h&&!a.isComposing()&&u!==ks(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||a.getFormat()!==e.format||a.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=_s(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(Pr(t)||Ui(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,a)}function Zn(e,t){return xs(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function Yn(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=e;Un&&(Un=!1,Zn(r,i)&&Zn(s,o)&&!Jn)||Di(t,(()=>{if(!n)return void Ms(null);if(!ps(t,r,s))return;let a=ii();if(Jn&&Ur(a)&&a.isCollapsed()){const e=a.anchor,t=Jn.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(a=Jn.clone(),Ms(a))}if(Jn=null,Ur(a)){const n=a.anchor,r=n.getNode();if(a.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(a.dirty=!0);const i=uo(t).event,s=i?i.timeStamp:performance.now(),[o,l,c,u,d]=Vn,h=Is(),g=!1===t.isComposing()&&""===h.getTextContent();if(s{const r=si(),i=t.anchorNode;(bo(i)||xs(i))&&Ms(ri(r,t,n,e))})));const r=$s(n),i=r[r.length-1],s=i._key,o=rr.get(s),a=o||i;a!==n&&Yn(t,a,!1),Yn(t,n,!0),n!==i?rr.set(s,n):o&&rr.delete(s)}function sr(e){e._lexicalHandled=!0}function or(e){return!0===e._lexicalHandled}function ar(e){const t=e.ownerDocument,n=$n.get(t);if(void 0===n)return;const r=n-1;r>=0||oe(164),$n.set(t,r),0===r&&t.removeEventListener("selectionchange",ir);const i=ys(e);fs(i)?(function(e){if(null!==e._parentEditor){const t=$s(e),n=t[t.length-1]._key;rr.get(n)===e&&rr.delete(n)}else rr.delete(e._key)}(i),e.__lexicalEditor=null):i&&oe(198);const s=nr(e);for(let e=0;ee.__key===this.__key));if(Pr(this))return n;if(Ur(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Ki(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:Ns(e)}getParentOrThrow(){const e=this.getParent();return null===e&&oe(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(ho(t))return Ui(e)||e===this&&Ki(e)||oe(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&oe(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:Ns(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:Ns(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=Ui(this)?this:this.getParent(),n=Ui(e)?e:e.getParent(),r=t&&n?la(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=la(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===sa(t):("same"!==t.type&&"ancestor"!==t.type&&oe(279),!1)))}isParentOf(e){const t=la(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 s=i.__key;if(r.has(s)||(r.add(s),n.push(i)),i===e)break;const o=Ui(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==o){i=o;continue}const a=t?i.getNextSibling():i.getPreviousSibling();if(null!==a){i=a;continue}const l=i.getParentOrThrow();if(r.has(l.__key)||n.push(l),l===e)break;let c=null,u=l;do{if(null===u&&oe(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=Ci()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){const e=Ns(this.__key);return null===e&&oe(113),e}getWritable(){vi();const e=wi(),t=Ci(),n=e._nodeMap,r=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,o=ii();if(null!==o&&o.setCachedNodes(null),s.has(r))return Cs(i),i;const a=Lo(i);return s.add(r),Cs(a),n.set(r,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){oe(70)}updateDOM(e,t,n){oe(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){oe(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable();return(t||n.__state)&&function(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Qe(t);return t.__state=n,n}(e).updateFromJSON(t),n}(this,e.$)}static transform(){return null}remove(e){lr(this,!0,e)}replace(e,t){vi();let n=ii();null!==n&&(n=n.clone()),po(this,e);const r=this.getLatest(),i=this.__key,s=e.__key,o=e.getWritable(),a=this.getParentOrThrow().getWritable(),l=a.__size;ws(o);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(lr(r,!1,!0),null===c?a.__first=s:c.getWritable().__next=s,o.__prev=d,null===u?a.__last=s:u.getWritable().__prev=s,o.__next=h,o.__parent=g,a.__size=l,t&&(Ui(this)&&Ui(o)||oe(139),this.getChildren().forEach((e=>{o.append(e)}))),Ur(n)){Ms(n);const e=n.anchor,t=n.focus;e.key===i&&Br(e,o),t.key===i&&Br(t,o)}return Es()===i&&Ts(s),o}insertAfter(e,t=!0){vi(),po(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=ii();let o=!1,a=!1;if(null!==i){const t=e.getIndexWithinParent();if(ws(r),Ur(s)){const e=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===e&&n.offset===t+1,a="element"===r.type&&r.key===e&&r.offset===t+1}}const l=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===l?c.__last=u:l.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&Ur(s)){const e=this.getIndexWithinParent();oi(s,c,e+1);const t=c.__key;o&&s.anchor.set(t,e+2,"element"),a&&s.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){vi(),po(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;ws(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),a=n.__prev,l=this.getIndexWithinParent();null===s?o.__first=i:s.getWritable().__next=i,o.__size++,n.__prev=i,r.__prev=a,r.__next=n.__key,r.__parent=n.__parent;const c=ii();return t&&Ur(c)&&oi(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return ss()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){vi();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Ui(n))return n.select();if(!Pr(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){vi();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Ui(n))return n.select(0,0);if(!Pr(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class ur extends cr{static getType(){return"linebreak"}static clone(e){return new ur(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&&So(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&pr(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&pr(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&So(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&pr(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&pr(r))return!0}return!1}(e)?null:{conversion:dr,priority:0}}}static importJSON(e){return hr().updateFromJSON(e)}}function dr(e){return{node:hr()}}function hr(){return go(new ur)}function gr(e){return e instanceof ur}function pr(e){return xs(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function fr(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function mr(e,t){return 1&t?"strong":2&t?"em":"span"}function yr(e,t,n,r,i){const s=r.classList;let o=Ys(i,"base");void 0!==o&&s.add(...o),o=Ys(i,"underlineStrikethrough");let a=!1;const l=8&t&&4&t;void 0!==o&&(8&n&&4&n?(a=!0,l||s.add(...o)):l&&s.remove(...o));for(const e in Re){const r=Re[e];if(o=Ys(i,e),void 0!==o)if(n&r){if(a&&("underline"===e||"strikethrough"===e)){t&r&&s.remove(...o);continue}t&r&&(!l||"underline"!==e)&&"strikethrough"!==e||s.add(...o)}else t&r&&s.remove(...o)}}function _r(e,t,n){const r=t.firstChild,i=n.isComposing(),s=e+(i?Ne:"");if(null==r)t.textContent=s;else{const e=r.nodeValue;if(e!==s)if(i||ue){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,s=0;for(;i({conversion:Tr,priority:0}),b:()=>({conversion:Sr,priority:0}),code:()=>({conversion:Ar,priority:0}),em:()=>({conversion:Ar,priority:0}),i:()=>({conversion:Ar,priority:0}),mark:()=>({conversion:Ar,priority:0}),s:()=>({conversion:Ar,priority:0}),span:()=>({conversion:vr,priority:0}),strong:()=>({conversion:Ar,priority:0}),sub:()=>({conversion:Ar,priority:0}),sup:()=>({conversion:Ar,priority:0}),u:()=>({conversion:Ar,priority:0})}}static importJSON(e){return Lr().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 bo(t)||oe(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=xr(t,"b")),this.hasFormat("italic")&&(t=xr(t,"i")),this.hasFormat("strikethrough")&&(t=xr(t,"s")),this.hasFormat("underline")&&(t=xr(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?Re[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Me[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=vs(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=Be[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){vi();let n=e,r=t;const i=ii(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const e=s.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!Ur(i))return ei(o,n,o,r,"text","text");{const e=Es();e!==i.anchor.key&&e!==i.focus.key||Ts(o),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(),s=i.__text,o=n.length;let a=e;a<0&&(a=o+a,a<0&&(a=0));const l=ii();if(r&&Ur(l)){const t=e+o;l.setTextNodeRange(i,t,i,t)}const c=s.slice(0,a)+n+s.slice(a+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){vi();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=Es(),s=n.length;e.sort(((e,t)=>e-t)),e.push(s);const o=[],a=e.length;for(let t=0,r=0;tt&&(o.push(n.slice(t,i)),t=i)}const l=o.length;if(1===l)return[t];const c=o[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const _=ii();if(Ur(_)){const[e,t]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=Lr(c),d.__format=h,d.__style=g,d.__detail=p,f=!0):d=t.setTextContent(c);const b=[d];for(let e=1;e=v&&(m.set(e.getKey(),x-v,"text"),x=v){y.set(e.getKey(),k-v,"text");break}v=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&Cs(t),null!==n&&Cs(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,b),this.remove()):e.splice(t,1,b),Ur(_)&&oi(_,u,t,l-1)}return b}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||oe(50);const n=this.__key,r=e.__key,i=this.__text,s=i.length;Es()===r&&Ts(n);const o=ii();if(Ur(o)){const i=o.anchor,a=o.focus;null!==i&&i.key===r&&ci(i,t,n,e,s),null!==a&&a.key===r&&ci(a,t,n,e,s)}const a=e.__text,l=t?a+i:i+a;this.setTextContent(l);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function vr(e){return{forChild:Fr(e.style),node:null}}function Sr(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:Fr(t.style,n?void 0:"bold"),node:null}}const wr=new WeakMap;function Cr(e){if(!bo(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function Tr(e){const t=e;null===e.parentElement&&oe(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=wr.get(n))&&!Cr(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e0){/[ \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=Er(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:Lr(n)}}function Er(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,bo(n)){const e=n.style.display;if(""===e&&!vo(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(xs(n))return n;if("BR"===n.nodeName)return null}}const Nr={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ar(e){const t=Nr[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:Fr(e.style,t),node:null}}function Lr(e=""){return go(new kr(e))}function Pr(e){return e instanceof kr}function Fr(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===e.fontStyle,a=r.includes("underline"),l=e.verticalAlign;return e=>Pr(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),o&&!e.hasFormat("italic")&&e.toggleFormat("italic"),a&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class Or extends kr{static getType(){return"tab"}static clone(e){return new Or(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=Ys(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return Ir().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&oe(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||oe(286),this}setDetail(e){return 2!==e&&oe(127),this}setMode(e){return"normal"!==e&&oe(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ir(){return go(new Or)}function Rr(e){return e instanceof Or}class Mr{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.offsete&&(r=e)}else if(!Ui(t)){const e=t.getNextSibling();if(Pr(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 Br(e,t){if(Ui(t)){const n=t.getLastDescendant();Ui(n)||Pr(n)?zr(e,n):zr(e,t)}else zr(e,t)}class $r{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Hr(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 $r(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(Pr(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e1;){const e=t[t.length-1];if(!Ui(e)||s.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=_a(e.anchor),r=_a(e.anchor.getFlipped()),i=e=>Uo(e)?e.origin:e.getNodeAtCaret(),s=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(s)}return t}(ka(ga(this),"next"));return ki()||(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,s=r.isBefore(i),[o,a]=jr(this);let l="",c=!0;for(let u=0;u=0;e--){const t=s[e];if(t.is(d)||Ui(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(_s(d))if(a===h)d.select();else{const t=Lr(e);t.select(),d.replace(t)}else d=d.spliceText(a,h-a,e,!0),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach((n=>{if(Ui(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},s=r.length;if(0===s)return this.toggleFormat(e),Ts(null),void i(t);const o=this.anchor,a=this.focus,l=this.isBackward(),c=l?a:o,u=l?o:a;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=s-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(bs(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||bs(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const _=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||bs(m)||([m]=m.splitText(y)),m.setFormat(_));for(let t=d+1;t(Ui(e)||Ki(e))&&!e.isInline()))){Ui(n)||oe(211,t.constructor.name,t.getType());const i=hi(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=ss();let n=null;for(let r=0;rl?l:a,t=a>l?a:l,n=s.splitText(e,t),r=0===e?n[0]:n[1];return null!=r?[r]:[]}return[s]}const c=r.isBefore(i);if(Pr(s)){const t=c?a:l;t===s.getTextContentSize()?e.shift():0!==t&&([,s]=s.splitText(t),e[0]=s)}if(Pr(o)){const t=o.getTextContent().length,r=c?l:a;0===r?e.pop():r!==t&&([o]=o.splitText(r),e[n]=o)}return e}modify(e,t,n){if(pi(this,e,t,n))return;const r="move"===e,i=Ci(),s=yo(uo(i));if(!s)return;const o=i._blockCursorElement,a=i._rootElement,l=this.focus.getNode();if(null===a||null===o||!Ui(l)||l.isInline()||l.canBeEmpty()||mo(o,i,a),this.dirty){let e=io(i,this.anchor.key),t=io(i,this.focus.key);"text"===this.anchor.type&&(e=ks(e)),"text"===this.focus.type&&(t=ks(t)),e&&t&&ui(s,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(s,e,t?"backward":"forward",n),s.rangeCount>0){const e=s.getRangeAt(0),n=this.anchor.getNode(),i=qi(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t;){if(ho(t))return t;t=t.getParentOrThrow()}return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let o=!1;for(let e=0;e0)if(t){const e=r[0];Ui(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];Ui(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}s.anchorNode===e.startContainer&&s.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,s=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,s,!0)}(this)}}"lineboundary"===n&&pi(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Ui(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(Ui(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=ta(ca(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(Ho(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Ui(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=_a(t);ha(this,na(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(Wo(t)){if(Ui(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(Ki(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Ui(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=ni();e.add(t.origin.getKey()),Ms(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return ha(this,na(!t.origin.isEmpty()&&n.isEmpty()?pa(Jo(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&&qr(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,s=r.getTextContentSize();if(r.is(n)||e&&t!==s||!e&&0!==t)return void Vr(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,s=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==s)return void Vr(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,s=r.offset,o=e{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Vr(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,a=0;for(let e=0;en||r){i.splice(e,1),r&&(a=void 0);break}}const l=i.join("").trim();""===l?r.remove():(r.setTextContent(l),r.select(a,a))}function Gr(e,t,n,r){let i,s=t;if(bo(e)){let o=!1;const a=e.childNodes,l=a.length,c=r._blockCursorElement;s===l&&(o=!0,s=l-1);let u=a[s],d=!1;if(u===c)u=a[s+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&s--}if(i=Ds(u),Pr(i))s=zs(i,o);else{let a=Ds(e);if(null===a)return null;if(Ui(a)){const l=r.getElementByKey(a.getKey());null===l&&oe(214);const c=a.getDOMSlot(l);[a,s]=c.resolveChildIndex(a,l,e,t),Ui(a)||oe(215),o&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let u=a.getChildAtIndex(s);if(Ui(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=o?u.getLastDescendant():u.getFirstDescendant();null===e?a=u:(u=e,a=Ui(u)?u:u.getParentOrThrow()),s=0}Pr(u)?(i=u,a=null,s=zs(u,o)):u!==a&&o&&!d&&(Ui(a)||oe(216),s=Math.min(a.getChildrenSize(),s+1))}else{const n=a.getIndexWithinParent();s=0===t&&Ki(a)&&Ds(e)===a?n:n+1,a=a.getParentOrThrow()}if(Ui(a))return Dr(a.__key,s,"element")}}else i=Ds(e);return Pr(i)?Dr(i.__key,s,"text"):null}function Zr(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(t){if((n||!t)&&null===r&&Ui(s)&&s.isInline()){const t=s.getPreviousSibling();Pr(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Ui(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Pr(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(t&&Ui(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Ui(s)&&s.isInline()&&!s.canInsertTextAfter()){const t=s.getNextSibling();Pr(t)&&e.set(t.__key,0,"text")}}}function Yr(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),i=e.is(t);Zr(e,r,i),Zr(t,!r,i),i&&t.set(e.key,e.offset,e.type);const s=Ci();if(s.isComposing()&&s._compositionKey!==e.key&&Ur(n)){const r=n.anchor,i=n.focus;e.set(r.key,r.offset,r.type,!0),t.set(i.key,i.offset,i.type,!0)}}}function Xr(e,t,n,r,i,s){if(null===e||null===n||!ps(i,e,n))return null;const o=Gr(e,t,Ur(s)?s.anchor:null,i);if(null===o)return null;const a=Gr(n,r,Ur(s)?s.focus:null,i);if(null===a)return null;if("element"===o.type&&"element"===a.type){const t=Ds(e),r=Ds(n);if(Ki(t)&&Ki(r))return null}return Yr(o,a,s),[o,a]}function Qr(e){return Ui(e)&&!e.isInline()}function ei(e,t,n,r,i,s){const o=wi(),a=new Wr(Dr(e,t,i),Dr(n,r,s),0,"");return a.dirty=!0,o._selection=a,a}function ti(){const e=Dr("root",0,"element"),t=Dr("root",0,"element");return new Wr(e,t,0,"")}function ni(){return new $r(new Set)}function ri(e,t,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,a="selectionchange"===o,l=!He&&(a||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let c,u,d,h;if(Ur(e)&&!l)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,a&&Ur(e)&&!ps(n,c,u))return e.clone();const g=Xr(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;return new Wr(p,f,Ur(e)?e.format:0,Ur(e)?e.style:"")}function ii(){return wi()._selection}function si(){return Ci()._editorState._selection}function oi(e,t,n,r=1){const i=e.anchor,s=e.focus,o=i.getNode(),a=s.getNode();if(!t.is(o)&&!t.is(a))return;const l=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n0||n0||n=e,o=i?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Pr(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,"text"),r.set(o.__key,e,"text")}}else{if(Ui(s)){const e=s.getChildrenSize(),r=n>=e,i=r?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Pr(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(Ui(o)){const e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(Pr(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function li(e,t,n,r,i){let s=null,o=0,a=null;null!==r?(s=r.__key,Pr(r)?(o=r.getTextContentSize(),a="text"):Ui(r)&&(o=r.getChildrenSize(),a="element")):null!==i&&(s=i.__key,Pr(i)?a="text":Ui(i)&&(a="element")),null!==s&&null!==a?e.set(s,o,a):(o=t.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),e.set(n.__key,o,"element"))}function ci(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 ui(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function di(e){let t=ii()||si();null===t&&(t=Is().selectEnd()),t.insertNodes(e)}function hi(e){let t=e;e.isCollapsed()||t.removeText();const n=ii();Ur(n)&&(t=n),Ur(t)||oe(161);const r=t.anchor;let i=r.getNode(),s=r.offset;for(;!wo(i);){const e=i;if([i,s]=gi(i,s),e.is(i))break}return s}function gi(e,t){const n=e.getParent();if(!n){const e=ss();return Is().append(e),e.select(),[Is(),0]}if(Pr(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(!Ui(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new Wr(Dr(e.__key,t,"element"),Dr(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function pi(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 s=ca(e.focus,n?"previous":"next"),o="lineboundary"===r,a="move"===t;let l=s,c="decorators-and-blocks"===i;if(!ba(l)){for(const e of l){c=!1;const{origin:t}=e;if(!Ki(t)||t.isIsolated()||(l=e,!o||!t.isInline()))break}if(c)for(const e of ta(s).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Ho(e))e.origin.isInline()||(l=e);else{if(Ui(e.origin))continue;Ki(e.origin)&&!e.origin.isInline()&&(l=e)}break}}if(l===s)return!1;if(a&&!o&&Ki(l.origin)&&l.origin.isKeyboardSelectable()){const e=ni();return e.add(l.origin.getKey()),Ms(e),!0}return l=_a(l),a&&ua(e.anchor,l),ua(e.focus,l),c||!o}let fi=null,mi=null,yi=!1,_i=!1,bi=0;const xi={characterData:!0,childList:!0,subtree:!0};function ki(){return yi||null!==fi&&fi._readOnly}function vi(){yi&&oe(13)}function Si(){bi>99&&oe(14)}function wi(){return null===fi&&oe(195,Ti()),fi}function Ci(){return null===mi&&oe(196,Ti()),mi}function Ti(){let e=0;const t=new Set,n=cs.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=ys(r);if(fs(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 Ei(e,t,n){const r=t.__type,i=function(e,t){const n=e._nodes.get(t);return void 0===n&&oe(30,t),n}(e,r);let s=n.get(r);void 0===s&&(s=Array.from(i.transforms),n.set(r,s));const o=s.length;for(let e=0;e0?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=oo(n),i=co(r);if(null===r||null===i)return;let{top:s,bottom:o}=t,a=0,l=0,c=n;for(;null!==c;){const t=c===r.body;if(t)a=0,l=uo(e).innerHeight;else{const e=c.getBoundingClientRect();a=e.top,l=e.bottom}let n=0;if(sl&&(n=o-l),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;s-=t,o-=t}if(t)break;c=so(c)}}(n,t,s)}}Un=!0}}(o,a,e,x,_,r)}!function(e,t,n){let r=e._blockCursorElement;if(Ur(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,s=i.getNode(),o=i.offset;let a=!1,l=null;if(o===s.getChildrenSize())fo(s.getChildAtIndex(o-1))&&(a=!0);else{const t=s.getChildAtIndex(o);if(null!==t&&fo(t)){const n=t.getPreviousSibling();(null===n||fo(n))&&(a=!0,l=e.getElementByKey(t.__key))}}if(a){const n=e.getElementByKey(s.__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=_e(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===l?n.appendChild(r):n.insertBefore(r,l))}}null!==r&&mo(r,e,t)}(e,r,a)}finally{null!==g&&g.observe(r,xi),mi=d,fi=c}}null!==p&&function(e,t,n,r,i){const s=Array.from(e._listeners.mutation),o=s.length;for(let e=0;e0||u>0;){if(l>0){t._dirtyLeaves=new Set;for(const e of a){const r=i.get(e);Pr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&rt(r),void 0!==r&&Ni(r,s)&&Ei(t,r,o),n.add(e)}if(a=t._dirtyLeaves,l=a.size,l>0){bi++;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],a=e[1];if(r.set(n,a),!a)continue;const l=i.get(n);void 0!==l&&Ni(l,s)&&Ei(t,l,o)}a=t._dirtyLeaves,l=a.size,c=t._dirtyElements,u=c.size,bi++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Ri(e),function(e,t,n,r){const i=e._nodeMap,s=t._nodeMap,o=[];for(const[e]of r){const t=s.get(e);void 0!==t&&(t.isAttached()||(Ui(t)&&We(t,e,i,s,o,r),i.has(e)||r.delete(e),o.push(e)))}for(const e of o)s.delete(e);for(const e of n){const t=s.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),s.delete(e))}}(a,l,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(l._flushSync=!0);const i=l._selection;if(Ur(i)){const e=l._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||oe(19)}else Hr(i)&&0===i._nodes.size&&(l._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Oi(e)}finally{fi=u,yi=d,mi=h,e._updating=g,bi=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}(l,e);f?l._flushSync?(l._flushSync=!1,Oi(e)):c&&ds((()=>{Oi(e)})):(l._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Di(e,t,n){mi===e&&void 0===n?t():Mi(e,t,n)}class zi{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new zi(this.element,e,this.after)}withAfter(e){return new zi(this.element,this.before,e)}withElement(e){return this.element===e?this:new zi(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&oe(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&oe(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&oe(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&&(ge||he);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=Bi(t,n);i.push(r);const s=Bi(t,this.element);let o=e.getIndexWithinParent();for(let e=0;en){o+=1;break}}return[e.getParentOrThrow(),o]}}function Bi(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&&oe(225),n.reverse()}class $i extends cr{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.__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 ze[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=Ci()._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(Pr(t)&&e.push(t),Ui(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Ui(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Ui(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 Ui(e)&&e.getLastDescendant()||e||null}const r=t[e];return Ui(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Ns(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&oe(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Ns(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&oe(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e=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;re.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?De[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){const r=n.length,i=this.getChildrenSize(),s=this.getWritable();e+t<=i||oe(226,String(e),String(t),String(i));const o=s.__key,a=[],l=[],c=this.getChildAtIndex(e+t);let u=null,d=i-t+r;if(0!==e)if(e===i)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(t>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let n=0;n0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function Ui(e){return e instanceof $i}function Wi(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 Hi extends cr{decorate(e,t){oe(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ki(e){return e instanceof Hi}class ji extends $i{static getType(){return"root"}static clone(){return new ji}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){oe(51)}getTextContent(){const e=this.__cachedText;return!ki()&&0!==Ci()._dirtyType||null===e?super.getTextContent():e}remove(){oe(52)}replace(e){oe(53)}insertBefore(e){oe(54)}insertAfter(e){oe(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)Ui(e)||Ki(e)||oe(282);return super.splice(e,t,n)}static importJSON(e){return Is().updateFromJSON(e)}collapseAtStart(){return!0}}function qi(e){return e instanceof ji}function Ji(e){return new Zi(new Map(e._nodeMap))}function Vi(){return new Zi(new Map([["root",new ji]]))}function Gi(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&oe(130,n.name),Ui(e)){const r=t.children;Array.isArray(r)||oe(59,n.name);const i=e.getChildren();for(let e=0;e({root:Gi(Is())})))}}const Yi="historic",Xi="history-merge",Qi="collaboration",es="skip-scroll-into-view",ts="skip-dom-selection";class ns extends $i{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class rs extends $i{static getType(){return"paragraph"}static clone(e){return new rs(e.__key)}createDOM(e){const t=document.createElement("p"),n=Ys(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:is,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(bo(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return ss().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,t){const n=ss();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||Pr(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 is(e){const t=ss();return e.style&&(t.setFormat(e.style.textAlign),Po(e,t)),{node:t}}function ss(){return go(new rs)}function os(e){return e instanceof rs}function as(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Vi(),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 s=e._observer;null!==s&&(s.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function ls(e){const t=e||{},n=mi,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,s=t.disableEvents||!1,o=Vi(),a=t.namespace||(null!==i?i._config.namespace:Us()),l=t.editorState,c=[ji,kr,ur,Or,rs,ns,...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{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!==l&&(p._pendingEditorState=l,p._dirtyType=2),p}class cs{constructor(e,t,n,r,i,s,o,a){this._createEditorArgs=a,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=Us(),this._onError=i,this._htmlConversions=s,this._editable=o,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&&oe(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&&oe(36,String(e));const s=i[n];return s.add(t),()=>{s.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;i.set(t,r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&oe(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Ao(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=Ao(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=Ns(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:Xi}: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 no(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=Ys(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,as(this,t,e,r),null!==t&&(this._config.disableEvents||ar(t),null!=n&&t.classList.remove(...n)),null!==e){const t=co(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,Xe(this),this._updateTags.add(Xi),Oi(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument,r=$n.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",ir),$n.set(n,(r||0)+1),e.__lexicalEditor=t;const i=nr(e);for(let n=0;n{or(e)||(sr(e),(t.isEditable()||"click"===r)&&s(e,t))}:e=>{if(or(e))return;sr(e);const n=t.isEditable();switch(r){case"cut":return n&&no(t,Cn,e);case"copy":return no(t,wn,e);case"paste":return n&&no(t,Gt,e);case"dragstart":return n&&no(t,kn,e);case"dragover":return n&&no(t,vn,e);case"dragend":return n&&no(t,Sn,e);case"focus":return n&&no(t,Pn,e);case"blur":return n&&no(t,Fn,e);case"drop":return n&&no(t,bn,e)}};e.addEventListener(r,o),i.push((()=>{e.removeEventListener(r,o)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Xi),Oi(this);Ii("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&oe(38);let n=e;n._readOnly&&(n=Ji(e),n._selection=e._selection?e._selection.clone():null),Ye(this);const r=this._pendingEditorState,i=this._updateTags,s=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=s&&i.add(s),Oi(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||Oi(this)}parseEditorState(e,t){return function(e,t,n){const r=Vi(),i=fi,s=yi,o=mi,a=t._dirtyElements,l=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,fi=r,yi=!1,mi=t;try{const i=t._nodes;Pi(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=a,t._dirtyLeaves=l,t._cloneNotNeeded=c,t._dirtyType=u,fi=i,yi=s,mi=o}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Oi(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):Mi(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Di(this,(()=>{const r=ii(),i=Is();null!==r?r.dirty||Ms(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),ao("focus"),function(e){vi(),Ci()._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=yo(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ii("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}cs.version="0.32.1+prod.esm";let us=1;const ds="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function hs(e){return Ki(Ps(e))}function gs(e){const t=document.activeElement;if(!bo(t))return!1;const n=t.nodeName;return Ki(Ps(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==ys(t))}function ps(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!gs(t)&&ms(t)===e}catch(e){return!1}}function fs(e){return e instanceof cs}function ms(e){let t=e;for(;null!=t;){const e=ys(t);if(fs(e))return e;t=so(t)}return null}function ys(e){return e?e.__lexicalEditor:null}function _s(e){return Rr(e)||e.isToken()}function bs(e){return _s(e)||e.isSegmented()}function xs(e){return xo(e)&&3===e.nodeType}function ks(e){let t=e;for(;null!=t;){if(xs(t))return t;t=t.firstChild}return null}function vs(e,t,n){const r=Re[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 Ss(e){return Pr(e)||gr(e)||Ki(e)}function ws(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),s=e.getNextSibling(),o=null!==s?s.__key:null,a=null!==i?i.__key:null,l=null!==i?i.getWritable():null,c=null!==s?s.getWritable():null;null===i&&(r.__first=o),null===s&&(r.__last=a),null!==l&&(l.__next=o),null!==c&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Cs(e){Si();const t=e.getLatest(),n=t.__parent,r=wi(),i=Ci(),s=r._nodeMap,o=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,s,o);const a=t.__key;i._dirtyType=1,Ui(e)?o.set(a,!0):i._dirtyLeaves.add(a)}function Ts(e){vi();const t=Ci(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Ns(n);null!==e&&e.getWritable()}if(null!==e){const t=Ns(e);null!==t&&t.getWritable()}}}function Es(){return ki()?null:Ci()._compositionKey}function Ns(e,t){const n=(t||wi())._nodeMap.get(e);return void 0===n?null:n}function As(e,t){const n=Ls(e,Ci());return void 0!==n?Ns(n,t):null}function Ls(e,t){return e[`__lexicalKey_${t._key}`]}function Ps(e,t){let n=e;for(;null!=n;){const e=As(n,t);if(null!==e)return e;n=so(n)}return null}function Fs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Os(e){return e.read((()=>Is().getTextContent()))}function Is(){return Rs(wi())}function Rs(e){return e._nodeMap.get("root")}function Ms(e){vi();const t=wi();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Ds(e){const t=Ci(),n=function(e,t){let n=e;for(;null!=n;){const e=Ls(n,t);if(void 0!==e)return e;n=so(n)}return null}(e,t);return null===n?e===t.getRootElement()?Ns("root"):null:Ns(n)}function zs(e,t){return t?e.getTextContentSize():0}function Bs(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function $s(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function Us(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ws(e){return xs(e)?e.nodeValue:null}function Hs(e,t,n){const r=yo(uo(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let t=Ws(i);const r=Ps(i);if(null!==t&&Pr(r)){if(t===Ne&&n){const e=n.length;t=n,s=e,o=e}null!==t&&Ks(r,t,s,o,e)}}}function Ks(e,t,n,r,i){let s=e;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let a=t;(o||i)&&t[t.length-1]===Ne&&(a=t.slice(0,-1));const l=s.getTextContent();if(i||a!==l){if(""===a){if(Ts(null),he||ge||ye)s.remove();else{const e=Ci();setTimeout((()=>{e.update((()=>{s.isAttached()&&s.remove()}))}),20)}return}const t=s.getParent(),i=si(),l=s.getTextContentSize(),c=Es(),u=s.getKey();if(s.isToken()||null!==c&&u===c&&!o||Ur(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===l&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const d=ii();if(!Ur(d)||null===n||null===r)return void s.setTextContent(a);if(d.setTextNodeRange(s,n,s,r),s.isSegmented()){const e=Lr(s.getTextContent());s.replace(e),s=e}s.setTextContent(a)}}}function js(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function qs(e,t,n){return function(e,t){return js(e,t,"altKey")&&js(e,t,"ctrlKey")&&js(e,t,"shiftKey")&&js(e,t,"metaKey")}(e,n)&&e.key.toLowerCase()===t.toLowerCase()}const Js={ctrlKey:!ce,metaKey:ce},Vs={altKey:ce,ctrlKey:!ce};function Gs(e){return"Backspace"===e.key}function Zs(e){return qs(e,"a",Js)}function Ys(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=_e(i);return n[t]=e,e}return i}function Xs(e,t,n,r,i){if(0===n.size)return;const s=r.__type,o=r.__key,a=t.get(s);void 0===a&&oe(33,s);const l=a.klass;let c=e.get(l);void 0===c&&(c=new Map,e.set(l,c));const u=c.get(o),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(o,d?"updated":i)}function Qs(e,t,n){const r=e.getParent();let i=n,s=e;return null!==r&&(t&&0===n?(i=s.getIndexWithinParent(),s=r):t||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(t?i-1:i)}function eo(e,t){const n=e.offset;if("element"===e.type)return Qs(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?Qs(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function to(e){const t=uo(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function no(e,t,n){return function(e,t,n){const r=$s(e);for(let i=4;i>=0;i--)for(let s=0;s{for(let t=0;te,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Jo(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Jo(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 s=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();null!==t&&o.size0){const t=i.getNodeAtCaret();if(t)if(o.delete(t.getKey()),o.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(s)&&e.remove(),t.replace(e)}else null===t&&oe(263,Array.from(o).join(" "))}else i.insert(e);i=Jo(e,this.direction)}for(const e of o.values())e.remove();return this}}class Ro extends Io{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Yo(e,this.direction)}getParentCaret(e="root"){return Jo(zo(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Do(this.direction);return Jo(this.getNodeAtCaret(),e)||Yo(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Ro&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Mo={root:qi,shadowRoot:ho};function Do(e){return Oo[e]}function zo(e,t="root"){return Mo[t](e)?null:e}class Bo extends Io{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Jo(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Ui(this.origin)?Yo(this.origin,this.direction):null}getParentCaret(e="root"){return Jo(zo(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Do(this.direction);return Jo(this.getNodeAtCaret(),e)||Yo(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Bo&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Bo||e instanceof $o)&&this.direction===e.direction&&this.origin.is(e.origin)}}class $o extends Io{type="text";constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Vo(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Jo(zo(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Vo(this.origin,Do(this.direction),this.offset)}isSamePointCaret(e){return e instanceof $o&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Bo||e instanceof $o)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Jo(this.origin,this.direction)}}function Uo(e){return e instanceof $o}function Wo(e){return e instanceof Bo}function Ho(e){return e instanceof Ro}const Ko={next:class extends $o{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends $o{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},jo={next:class extends Bo{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Bo{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},qo={next:class extends Ro{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Ro{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Jo(e,t){return e?new jo[t](e):null}function Vo(e,t,n){return e?new Ko[t](e,Go(e,n)):null}function Go(e,t){const n=e.getTextContentSize();let r="next"===t?n:"previous"===t?0:t;return(r<0||r>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);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.`)}(284,String(t),String(n),e.getKey()),r=r<0?0:n),r}function Zo(e,t){return new ea(e,t)}function Yo(e,t){return Ui(e)?new qo[t](e):null}function Xo(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class Qo{type="node-caret-range";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 Qo(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Uo(t)?function(e,t){const{direction:n,origin:r}=e;return Zo(e,Go(r,"focus"===t?Do(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[Zo(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Uo(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Uo(n),i=t=>t.isSameNodeCaret(n)?null:Xo(t)||t.getParentCaret(e);return ra({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 ea{type="slice";constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n{let n;for(let r=l;rn.has(e.getKey())&&wo(e)));return u&&d?[u,d]:null}(u,d,l);if(h){const[e,t]=h;Yo(e,"previous").splice(0,t.getChildren()),t.remove()}const g=[u,d,...o,...a].find(ma);if(g)return function(e){return na(e,e)}(xa(_a(g),e.direction));oe(269,JSON.stringify(o.map((e=>e.origin.__key))))}function _a(e){const t=function(e){let t=e;for(;Ho(t);){const e=Xo(t);if(!Ho(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Pr(t.origin))return Uo(t)?t:Vo(t.origin,n,n);const r=t.getAdjacentCaret();return Wo(r)&&Pr(r.origin)?Vo(r.origin,n,Do(n)):t}function ba(e){return Uo(e)&&e.offset!==Go(e.origin,e.direction)}function xa(e,t){return e.direction===t?e:e.getFlipped()}function ka(e,t){return e.direction===t?e:na(xa(e.focus,t),xa(e.anchor,t))}const va=()=>{const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content},Sa=new Map;function wa(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 Ca(e){let t=Sa.get(e);return void 0===t&&(t=wa(e),Sa.set(e,t)),t}function Ta(e,t){const n=e.getStartEndPoints();if(t.isSelected(e)&&!bs(t)&&null!==n){const[r,i]=n,s=e.isBackward(),o=r.getNode(),a=i.getNode(),l=t.is(o),c=t.is(a);if(l||c){const[n,r]=jr(e),i=o.is(a),l=t.is(s?a:o),c=t.is(s?o:a);let u,d=0;i?(d=n>r?r:n,u=n>r?n:r):l?(d=s?r:n,u=void 0):c&&(d=0,u=s?n:r),t.__text=t.__text.slice(d,u)}}return t}function Ea(e){const t=e.getStyle(),n=wa(t);Sa.set(t,n)}function Na(e){const t=e.anchor.getNode(),n=qi(t)?t:t.getParentOrThrow(),r=To().getElementByKey(n.getKey());if(null===r)return!1;const i=r.ownerDocument.defaultView;return null!==i&&"vertical-rl"===i.getComputedStyle(r).writingMode}function Aa(e,t){const n=Na(e)?!t:t,r=ca(e.focus,n?"previous":"next");if(ba(r))return!1;for(const e of ta(r)){if(Ho(e))return!e.origin.isInline();if(!Ui(e.origin)){if(Ki(e.origin))return!0;break}}return!1}function La(e,t,n){const r=function(e){const t=e.anchor.getNode();return"rtl"===(qi(t)?t:t.getParentOrThrow()).getDirection()}(e);let i;i=Na(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}const Pa="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Fa=Pa&&"documentMode"in document?document.documentMode:null;function Oa(...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 Ia(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Ra(e,...t){const n=Oa(...t);n.length>0&&e.classList.add(...n)}function Ma(e,...t){const n=Oa(...t);n.length>0&&e.classList.remove(...n)}function Da(e){return e?e.getAdjacentCaret():null}function za(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function Ba(e){const t=$a(e,(e=>Ui(e)&&!e.isInline()));return Ui(t)||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.`)}(4,e.__key),t}Pa&&"InputEvent"in window&&!Fa&&new window.InputEvent("input");const $a=(e,t)=>{let n=e;for(;n!==Is()&&null!=n;){if(t(n))return n;n=n.getParent()}return null};function Ua(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Wa(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 Ha(e){let t=e.getParent();hl(t)||Wa(40);let n=t;for(;null!==n;)n=n.getParent(),hl(n)&&(t=n);return t}function Ka(e){let t=[];const n=e.getChildren().filter(sl);for(let e=0;e0&&e.append(...i),t.remove()}function Xa(e){const t=new Set;if(ja(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(ja(r)&&ja(i)){const n=i.getFirstChild();if(hl(n)){n.append(e);const i=r.getFirstChild();hl(i)&&(Ga(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(ja(r)){const t=r.getFirstChild();if(hl(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(ja(i)){const t=i.getFirstChild();hl(t)&&t.append(e)}else if(hl(n)){const t=il().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),s=dl(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());t.append(s),s.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Qa(e){if(ja(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(hl(n?n.getParent():void 0)&&sl(n)&&hl(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=il(),s=dl(r);i.append(s),e.getPreviousSiblings().forEach((e=>s.append(e)));const o=il(),a=dl(r);o.append(a),Ga(a,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(e)}}}function el(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}let tl=class e extends $i{static getType(){return"listitem"}static clone(t){return new e(t.__value,t.__checked,t.__key)}constructor(e,t,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){const r=this.getParent();hl(r)&&"check"===r.getListType()&&function(e,t,n){hl(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=[],s=t.list,o=s?s.listitem:void 0;let a;if(s&&s.nested&&(a=s.nested.listitem),void 0!==o&&r.push(...el(o)),s){const e=n.getParent(),t=hl(e)&&"check"===e.getListType(),o=n.getChecked();t&&!o||i.push(s.listitemUnchecked),t&&o||i.push(s.listitemChecked),t&&r.push(o?s.listitemChecked:s.listitemUnchecked)}if(void 0!==a){const e=el(a);n.getChildren().some((e=>hl(e)))?r.push(...e):i.push(...e)}i.length>0&&Ma(e,...i),r.length>0&&Ra(e,...r)}(t,n.theme,this);const i=e?e.__style:"",s=this.__style;i!==s&&(""===s?t.removeAttribute("style"):t.style.cssText=s),function(e,t,n){const r=Ca(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in Ca(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}static transform(){return e=>{if(sl(e)||Wa(144),null==e.__checked)return;const t=e.getParent();hl(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:nl,priority:0})}}static importJSON(e){return il().updateFromJSON(e)}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.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(hl(n)||Wa(39),sl(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=dl(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&&ja(t)&&ja(n)&&(Ya(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=il().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ss();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=sl(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,s=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(s,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(s,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 hl(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(;sl(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&Wa(117),(e=Math.floor(e))>=0||Wa(199);let t=this.getIndent();for(;t!==e;)t{hl(e)||Wa(163),function(e){const t=e.getNextSibling();hl(t)&&e.getListType()===t.getListType()&&Ya(e,t)}(e),function(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())sl(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),hl(r.getFirstChild())||n++)}(e)}}static importDOM(){return{ol:()=>({conversion:cl,priority:0}),ul:()=>({conversion:cl,priority:0})}}static importJSON(e){return dl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return bo(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;e1?r.push(...e):i.push(...e)}}i.length>0&&Ma(e,...i),r.length>0&&Ra(e,...r)}function ll(e){const t=[];for(let n=0;n1&&e.forEach((e=>{hl(e)&&t.push(qa(e))}))}else t.push(qa(r))}return t}function cl(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=dl("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list"))return!0;for(const t of e.childNodes)if(bo(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?dl("check"):dl("bullet")),{after:ll,node:n}}const ul={ol:"number",ul:"bullet"};function dl(e="number",t=1){return go(new ol(e,t))}function hl(e){return e instanceof ol}const gl=Ut("INSERT_UNORDERED_LIST_COMMAND"),pl=Ut("INSERT_ORDERED_LIST_COMMAND"),fl=Ut("REMOVE_LIST_COMMAND");function ml(e){return Ia(e.registerCommand(pl,(()=>(Va("number"),!0)),1),e.registerCommand(gl,(()=>(Va("bullet"),!0)),1),e.registerCommand(fl,(()=>(function(){const e=ii();if(Ur(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Ja(r,n))t.add(Ha(r));else for(let e=0;efunction(){const e=ii();if(!Ur(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!sl(t)||0!==t.getChildrenSize())return!1;const n=Ha(t),r=t.getParent();hl(r)||Wa(40);const i=r.getParent();let s;if(ho(i))s=ss(),n.insertAfter(s);else{if(!sl(i))return!1;s=il(),i.insertAfter(s)}s.setTextStyle(e.style).setTextFormat(e.format).select();const o=t.getNextSiblings();if(o.length>0){const e=dl(r.getListType());if(sl(s)){const t=il();t.append(e),s.insertAfter(t)}else s.insertAfter(e);e.append(...o)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!sl(e)&&!hl(e))break;t=e}t.remove()}(t),!0}()),1),e.registerNodeTransform(tl,(e=>{const t=e.getFirstChild();if(t){if(Pr(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=ii();Ur(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(kr,(e=>{const t=e.getParent();if(sl(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}function yl(e,t){const n=t.body?t.body.childNodes:[];let r=[];const i=[];for(let t=0;t{const e=new ns;return n.push(e),e}:ss)),null==a?h.length>0?o=o.concat(h):So(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(vo(e.nextSibling)&&vo(e.previousSibling))}(e)&&(o=o.concat(hr())):Ui(a)&&a.append(...h),o}function vl(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 Sl(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 wl(n,function(e){const t=[];for(let n=0;ne}).createHTML(e):e}(i),"text/html")),t)}catch(e){}const o=s||e.getData("text/uri-list");if(null!=o)if(Ur(t)){const e=o.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t0?l.text=e:i=!1}for(let r=0;r{e.update((()=>{r(Nl(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,s=window.document,o=yo(i);if(null===r||null===o)return!1;const a=s.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(s.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),o.removeAllRanges(),o.addRange(l),new Promise(((t,r)=>{const i=e.registerCommand(wn,(r=>(Ua(r,ClipboardEvent)&&(i(),null!==Tl&&(window.clearTimeout(Tl),Tl=null),t(Nl(e,r,n))),!0)),4);Tl=window.setTimeout((()=>{i(),Tl=null,t(!1)}),50),s.execCommand("copy"),a.remove()}))}function Nl(e,t,n){if(void 0===n){const t=yo(e._window);if(!t)return!1;const r=t.anchorNode,i=t.focusNode;if(null!==r&&null!==i&&!ps(e,r,i))return!1;const s=ii();if(null===s)return!1;n=function(e=ii()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=To();for(const[r,i]of Al){const s=i(n,e);null!==s&&(t[r]=s)}}return t}(s)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Al=[["text/html",function(e,t=ii()){return null==t&&vl(166),Ur(t)&&t.isCollapsed()||0===t.getNodes().length?"":_l(e,t)}],["application/x-lexical-editor",function(e,t=ii()){return null==t&&vl(166),Ur(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=Is().getChildren();for(let i=0;i({conversion:jl,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(bo(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 $l().updateFromJSON(e)}insertNewAfter(e,t){const n=ss(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=ss();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function $l(){return go(new Bl)}function Ul(e){return e instanceof Bl}let Wl=class e extends $i{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){Ra(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Kl,priority:0}),h2:e=>({conversion:Kl,priority:0}),h3:e=>({conversion:Kl,priority:0}),h4:e=>({conversion:Kl,priority:0}),h5:e=>({conversion:Kl,priority:0}),h6:e=>({conversion:Kl,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Hl(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Hl(e)?{conversion:e=>({node:ql("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(bo(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 ql(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?ss():ql(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=ss();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?ss():ql(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function Hl(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Kl(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=ql(t),null!==e.style&&(Po(e,n),n.setFormat(e.style.textAlign))),{node:n}}function jl(e){const t=$l();return null!==e.style&&(t.setFormat(e.style.textAlign),Po(e,t)),{node:t}}function ql(e="h1"){return go(new Wl(e))}function Jl(e){return e instanceof Wl}function Vl(e){let t=null;if(Ua(e,DragEvent)?t=e.dataTransfer:Ua(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 Gl(e){const t=ii();if(!Ur(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;tUi(e)&&!e.isInline()));if(null===o)continue;const a=o.getKey();o.canIndent()&&!n.has(a)&&(n.add(a),e(o))}return n.size>0}function Zl(e){return Ki(Ps(e))}function Yl(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function Xl(e){return Ia(e.registerCommand(Kt,(e=>{const t=ii();return!!Hr(t)&&(t.clear(),!0)}),0),e.registerCommand(jt,(e=>{const t=ii();return Ur(t)?(t.deleteCharacter(e),!0):!!Hr(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(Yt,(e=>{const t=ii();return!!Ur(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(Xt,(e=>{const t=ii();return!!Ur(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Vt,(t=>{const n=ii();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Sl(r,n,e);else if(Ur(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(Zt,(()=>{const e=ii();return!!Ur(e)&&(e.removeText(),!0)}),0),e.registerCommand(Qt,(e=>{const t=ii();return!!Ur(t)&&(t.formatText(e),!0)}),0),e.registerCommand(xn,(e=>{const t=ii();if(!Ur(t)&&!Hr(t))return!1;const n=t.getNodes();for(const t of n){const n=$a(t,(e=>Ui(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(qt,(e=>{const t=ii();return!!Ur(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(Jt,(()=>{const e=ii();return!!Ur(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(mn,(()=>(di([Ir()]),!0)),0),e.registerCommand(yn,(()=>Gl((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(_n,(()=>Gl((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(ln,(e=>{const t=ii();if(Hr(t)){const e=t.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(Ur(t)){const n=eo(t.focus,!0);if(!e.shiftKey&&Ki(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(cn,(e=>{const t=ii();if(Hr(t)){const e=t.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(Ur(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===Is().getChildrenSize()}(t))return e.preventDefault(),!0;const n=eo(t.focus,!1);if(!e.shiftKey&&Ki(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(on,(e=>{const t=ii();if(Hr(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!Ur(t))return!1;if(Aa(t,!0)){const n=e.shiftKey;return e.preventDefault(),La(t,n,!0),!0}return!1}),0),e.registerCommand(rn,(e=>{const t=ii();if(Hr(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}if(!Ur(t))return!1;const n=e.shiftKey;return!!Aa(t,!1)&&(e.preventDefault(),La(t,n,!1),!0)}),0),e.registerCommand(hn,(t=>{if(Zl(t.target))return!1;const n=ii();if(Ur(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(qi(n))return!1;const r=Ba(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(_n,void 0);if(Rl&&"ko-KR"===navigator.language)return!1}else if(!Hr(n))return!1;return t.preventDefault(),e.dispatchCommand(jt,!0)}),0),e.registerCommand(pn,(t=>{if(Zl(t.target))return!1;const n=ii();return!(!Ur(n)&&!Hr(n))&&(t.preventDefault(),e.dispatchCommand(jt,!1))}),0),e.registerCommand(un,(t=>{const n=ii();if(!Ur(n))return!1;if(Yl(n),null!==t){if((Rl||Il||Dl)&&Ol)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(qt,!1)}return e.dispatchCommand(Jt,void 0)}),0),e.registerCommand(gn,(()=>!!Ur(ii())&&(e.blur(),!0)),0),e.registerCommand(bn,(t=>{const[,n]=Vl(t);if(n.length>0){const r=Ll(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,s=Ps(i);if(null!==s){const e=ti();if(Pr(s))e.anchor.set(s.getKey(),t,"text"),e.focus.set(s.getKey(),t,"text");else{const t=s.getParentOrThrow().getKey(),n=s.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Ms(it(e))}e.dispatchCommand(zl,n)}return t.preventDefault(),!0}return!!Ur(ii())}),0),e.registerCommand(kn,(e=>{const[t]=Vl(e),n=ii();return!(t&&!Ur(n))}),0),e.registerCommand(vn,(e=>{const[t]=Vl(e),n=ii();if(t&&!Ur(n))return!1;const r=Ll(e.clientX,e.clientY);if(null!==r){Ki(Ps(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Tn,(()=>(function(e){const t=Is();if(Ur(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"),it(e),e}{const e=t.select(0,t.getChildrenSize());Ms(it(e))}}(),!0)),0),e.registerCommand(wn,(t=>(El(e,Ua(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Cn,(t=>(async function(e,t){await El(t,Ua(e,ClipboardEvent)?e:null),t.update((()=>{const e=ii();Ur(e)?e.removeText():Hr(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(Gt,(t=>{const[,n,r]=Vl(t);return n.length>0&&!r?(e.dispatchCommand(zl,n),!0):(!xo(t.target)||!gs(t.target))&&(null!==ii()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=ii(),r=Ua(e,InputEvent)||Ua(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Sl(r,n,t)}),{tag:"paste"})}(t,e),!0))}),0),e.registerCommand(dn,(e=>{const t=ii();return Ur(t)&&Yl(t),!1}),0),e.registerCommand(fn,(e=>{const t=ii();return Ur(t)&&Yl(t),!1}),0))}var Ql=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 s?new s(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);S+=v.value.length,v=v.next){var w=v.value;if(t.length>e.length)return;if(!(w instanceof s)){var C,T=1;if(_){if(!(C=o(k,S,e,y))||C.index>=e.length)break;var E=C.index,N=C.index+C[0].length,A=S;for(A+=v.value.length;E>=A;)A+=(v=v.next).value.length;if(S=A-=v.value.length,v.value instanceof s)continue;for(var L=v;L!==t.tail&&(Ad.reach&&(d.reach=I);var R=v.prev;if(F&&(R=c(t,R,F),S+=F.length),u(t,R,T),v=c(t,R,new s(h,m?i.tokenize(P,m):P,b,P)),O&&c(t,v,O),T>1){var M={cause:h+","+p,reach:I};a(e,t,n,v.prev,S,M),d&&M.reach>d.reach&&(d.reach=M.reach)}}}}}}function l(){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"+s.content+""},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,s=n.code,o=n.immediateClose;e.postMessage(i.highlight(s,i.languages[r],r)),o&&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:{}); +/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:t,setPrototypeOf:n,isFrozen:r,getPrototypeOf:i,getOwnPropertyDescriptor:s}=Object;let{freeze:o,seal:a,create:l}=Object,{apply:c,construct:u}="undefined"!=typeof Reflect&&Reflect;o||(o=function(e){return e}),a||(a=function(e){return e}),c||(c=function(e,t,n){return e.apply(t,n)}),u||(u=function(e,t){return new e(...t)});const d=T(Array.prototype.forEach),h=T(Array.prototype.lastIndexOf),g=T(Array.prototype.pop),p=T(Array.prototype.push),f=T(Array.prototype.splice),m=T(String.prototype.toLowerCase),y=T(String.prototype.toString),_=T(String.prototype.match),b=T(String.prototype.replace),x=T(String.prototype.indexOf),k=T(String.prototype.trim),v=T(Object.prototype.hasOwnProperty),S=T(RegExp.prototype.test),w=(C=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:m;n&&n(e,null);let s=t.length;for(;s--;){let n=t[s];if("string"==typeof n){const e=i(n);e!==n&&(r(t)||(t[s]=e),n=e)}e[n]=!0}return e}function N(e){for(let t=0;t/gm),K=a(/\$\{[\w\W]*/gm),j=a(/^data-[\-\w.\u00B7-\uFFFF]+$/),q=a(/^aria-[\-\w]+$/),J=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),V=a(/^(?:\w+script|data):/i),G=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=a(/^html$/i),Y=a(/^[a-z][.\w]*(-[.\w]+)+$/i);var X=Object.freeze({__proto__:null,ARIA_ATTR:q,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:Y,DATA_ATTR:j,DOCTYPE_NAME:Z,ERB_EXPR:H,IS_ALLOWED_URI:J,IS_SCRIPT_OR_DATA:V,MUSTACHE_EXPR:W,TMPLIT_EXPR:K});const Q=1,ee=3,te=7,ne=8,re=9,ie=function(){return"undefined"==typeof window?null:window};var se=function e(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ie();const r=t=>e(t);if(r.version="3.2.6",r.removed=[],!n||!n.document||n.document.nodeType!==re||!n.Element)return r.isSupported=!1,r;let{document:i}=n;const s=i,a=s.currentScript,{DocumentFragment:c,HTMLTemplateElement:u,Node:C,Element:T,NodeFilter:N,NamedNodeMap:W=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:H,DOMParser:K,trustedTypes:j}=n,q=T.prototype,V=L(q,"cloneNode"),G=L(q,"remove"),Y=L(q,"nextSibling"),se=L(q,"childNodes"),oe=L(q,"parentNode");if("function"==typeof u){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let ae,le="";const{implementation:ce,createNodeIterator:ue,createDocumentFragment:de,getElementsByTagName:he}=i,{importNode:ge}=s;let pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};r.isSupported="function"==typeof t&&"function"==typeof oe&&ce&&void 0!==ce.createHTMLDocument;const{MUSTACHE_EXPR:fe,ERB_EXPR:me,TMPLIT_EXPR:ye,DATA_ATTR:_e,ARIA_ATTR:be,IS_SCRIPT_OR_DATA:xe,ATTR_WHITESPACE:ke,CUSTOM_ELEMENT:ve}=X;let{IS_ALLOWED_URI:Se}=X,we=null;const Ce=E({},[...P,...F,...O,...R,...D]);let Te=null;const Ee=E({},[...z,...B,...$,...U]);let Ne=Object.seal(l(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,Pe=!0,Fe=!0,Oe=!1,Ie=!0,Re=!1,Me=!0,De=!1,ze=!1,Be=!1,$e=!1,Ue=!1,We=!1,He=!0,Ke=!1,je=!0,qe=!1,Je={},Ve=null;const Ge=E({},["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 Ze=null;const Ye=E({},["audio","video","img","source","image","track"]);let Xe=null;const Qe=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),et="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let rt=nt,it=!1,st=null;const ot=E({},[et,tt,nt],y);let at=E({},["mi","mo","mn","ms","mtext"]),lt=E({},["annotation-xml"]);const ct=E({},["title","style","font","a","script"]);let ut=null;const dt=["application/xhtml+xml","text/html"];let ht=null,gt=null;const pt=i.createElement("form"),ft=function(e){return e instanceof RegExp||e instanceof Function},mt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!gt||gt!==e){if(e&&"object"==typeof e||(e={}),e=A(e),ut=-1===dt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ht="application/xhtml+xml"===ut?y:m,we=v(e,"ALLOWED_TAGS")?E({},e.ALLOWED_TAGS,ht):Ce,Te=v(e,"ALLOWED_ATTR")?E({},e.ALLOWED_ATTR,ht):Ee,st=v(e,"ALLOWED_NAMESPACES")?E({},e.ALLOWED_NAMESPACES,y):ot,Xe=v(e,"ADD_URI_SAFE_ATTR")?E(A(Qe),e.ADD_URI_SAFE_ATTR,ht):Qe,Ze=v(e,"ADD_DATA_URI_TAGS")?E(A(Ye),e.ADD_DATA_URI_TAGS,ht):Ye,Ve=v(e,"FORBID_CONTENTS")?E({},e.FORBID_CONTENTS,ht):Ge,Ae=v(e,"FORBID_TAGS")?E({},e.FORBID_TAGS,ht):A({}),Le=v(e,"FORBID_ATTR")?E({},e.FORBID_ATTR,ht):A({}),Je=!!v(e,"USE_PROFILES")&&e.USE_PROFILES,Pe=!1!==e.ALLOW_ARIA_ATTR,Fe=!1!==e.ALLOW_DATA_ATTR,Oe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Re=e.SAFE_FOR_TEMPLATES||!1,Me=!1!==e.SAFE_FOR_XML,De=e.WHOLE_DOCUMENT||!1,$e=e.RETURN_DOM||!1,Ue=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Be=e.FORCE_BODY||!1,He=!1!==e.SANITIZE_DOM,Ke=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,qe=e.IN_PLACE||!1,Se=e.ALLOWED_URI_REGEXP||J,rt=e.NAMESPACE||nt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,lt=e.HTML_INTEGRATION_POINTS||lt,Ne=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ne.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ft(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),Re&&(Fe=!1),Ue&&($e=!0),Je&&(we=E({},D),Te=[],!0===Je.html&&(E(we,P),E(Te,z)),!0===Je.svg&&(E(we,F),E(Te,B),E(Te,U)),!0===Je.svgFilters&&(E(we,O),E(Te,B),E(Te,U)),!0===Je.mathMl&&(E(we,R),E(Te,$),E(Te,U))),e.ADD_TAGS&&(we===Ce&&(we=A(we)),E(we,e.ADD_TAGS,ht)),e.ADD_ATTR&&(Te===Ee&&(Te=A(Te)),E(Te,e.ADD_ATTR,ht)),e.ADD_URI_SAFE_ATTR&&E(Xe,e.ADD_URI_SAFE_ATTR,ht),e.FORBID_CONTENTS&&(Ve===Ge&&(Ve=A(Ve)),E(Ve,e.FORBID_CONTENTS,ht)),je&&(we["#text"]=!0),De&&E(we,["html","head","body"]),we.table&&(E(we,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw w('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ae=e.TRUSTED_TYPES_POLICY,le=ae.createHTML("")}else void 0===ae&&(ae=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}}(j,a)),null!==ae&&"string"==typeof le&&(le=ae.createHTML(""));o&&o(e),gt=e}},yt=E({},[...F,...O,...I]),_t=E({},[...R,...M]),bt=function(e){p(r.removed,{element:e});try{oe(e).removeChild(e)}catch(t){G(e)}},xt=function(e,t){try{p(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){p(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if($e||Ue)try{bt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},kt=function(e){let t=null,n=null;if(Be)e=""+e;else{const t=_(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ut&&rt===nt&&(e=''+e+"");const r=ae?ae.createHTML(e):e;if(rt===nt)try{t=(new K).parseFromString(r,ut)}catch(e){}if(!t||!t.documentElement){t=ce.createDocument(rt,"template",null);try{t.documentElement.innerHTML=it?le:r}catch(e){}}const s=t.body||t.documentElement;return e&&n&&s.insertBefore(i.createTextNode(n),s.childNodes[0]||null),rt===nt?he.call(t,De?"html":"body")[0]:De?t.documentElement:s},vt=function(e){return ue.call(e.ownerDocument||e,e,N.SHOW_ELEMENT|N.SHOW_COMMENT|N.SHOW_TEXT|N.SHOW_PROCESSING_INSTRUCTION|N.SHOW_CDATA_SECTION,null)},St=function(e){return e instanceof H&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof W)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},wt=function(e){return"function"==typeof C&&e instanceof C};function Ct(e,t,n){d(e,(e=>{e.call(r,t,n,gt)}))}const Tt=function(e){let t=null;if(Ct(pe.beforeSanitizeElements,e,null),St(e))return bt(e),!0;const n=ht(e.nodeName);if(Ct(pe.uponSanitizeElement,e,{tagName:n,allowedTags:we}),Me&&e.hasChildNodes()&&!wt(e.firstElementChild)&&S(/<[/\w!]/g,e.innerHTML)&&S(/<[/\w!]/g,e.textContent))return bt(e),!0;if(e.nodeType===te)return bt(e),!0;if(Me&&e.nodeType===ne&&S(/<[/\w]/g,e.data))return bt(e),!0;if(!we[n]||Ae[n]){if(!Ae[n]&&Nt(n)){if(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,n))return!1;if(Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))return!1}if(je&&!Ve[n]){const t=oe(e)||e.parentNode,n=se(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r){const i=V(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,Y(e))}}}return bt(e),!0}return e instanceof T&&!function(e){let t=oe(e);t&&t.tagName||(t={namespaceURI:rt,tagName:"template"});const n=m(e.tagName),r=m(t.tagName);return!!st[e.namespaceURI]&&(e.namespaceURI===tt?t.namespaceURI===nt?"svg"===n:t.namespaceURI===et?"svg"===n&&("annotation-xml"===r||at[r]):Boolean(yt[n]):e.namespaceURI===et?t.namespaceURI===nt?"math"===n:t.namespaceURI===tt?"math"===n&<[r]:Boolean(_t[n]):e.namespaceURI===nt?!(t.namespaceURI===tt&&!lt[r])&&!(t.namespaceURI===et&&!at[r])&&!_t[n]&&(ct[n]||!yt[n]):!("application/xhtml+xml"!==ut||!st[e.namespaceURI]))}(e)?(bt(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!S(/<\/no(script|embed|frames)/i,e.innerHTML)?(Re&&e.nodeType===ee&&(t=e.textContent,d([fe,me,ye],(e=>{t=b(t,e," ")})),e.textContent!==t&&(p(r.removed,{element:e.cloneNode()}),e.textContent=t)),Ct(pe.afterSanitizeElements,e,null),!1):(bt(e),!0)},Et=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in i||n in pt))return!1;if(Fe&&!Le[t]&&S(_e,t));else if(Pe&&S(be,t));else if(!Te[t]||Le[t]){if(!(Nt(e)&&(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,e)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(e))&&(Ne.attributeNameCheck instanceof RegExp&&S(Ne.attributeNameCheck,t)||Ne.attributeNameCheck instanceof Function&&Ne.attributeNameCheck(t))||"is"===t&&Ne.allowCustomizedBuiltInElements&&(Ne.tagNameCheck instanceof RegExp&&S(Ne.tagNameCheck,n)||Ne.tagNameCheck instanceof Function&&Ne.tagNameCheck(n))))return!1}else if(Xe[t]);else if(S(Se,b(n,ke,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==x(n,"data:")||!Ze[e]){if(Oe&&!S(xe,b(n,ke,"")));else if(n)return!1}else;return!0},Nt=function(e){return"annotation-xml"!==e&&_(e,ve)},At=function(e){Ct(pe.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||St(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Te,forceKeepAttr:void 0};let i=t.length;for(;i--;){const s=t[i],{name:o,namespaceURI:a,value:l}=s,c=ht(o),u=l;let h="value"===o?u:k(u);if(n.attrName=c,n.attrValue=h,n.keepAttr=!0,n.forceKeepAttr=void 0,Ct(pe.uponSanitizeAttribute,e,n),h=n.attrValue,!Ke||"id"!==c&&"name"!==c||(xt(o,e),h="user-content-"+h),Me&&S(/((--!?|])>)|<\/(style|title)/i,h)){xt(o,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){xt(o,e);continue}if(!Ie&&S(/\/>/i,h)){xt(o,e);continue}Re&&d([fe,me,ye],(e=>{h=b(h,e," ")}));const p=ht(e.nodeName);if(Et(p,c,h)){if(ae&&"object"==typeof j&&"function"==typeof j.getAttributeType)if(a);else switch(j.getAttributeType(p,c)){case"TrustedHTML":h=ae.createHTML(h);break;case"TrustedScriptURL":h=ae.createScriptURL(h)}if(h!==u)try{a?e.setAttributeNS(a,o,h):e.setAttribute(o,h),St(e)?bt(e):g(r.removed)}catch(t){xt(o,e)}}else xt(o,e)}Ct(pe.afterSanitizeAttributes,e,null)},Lt=function e(t){let n=null;const r=vt(t);for(Ct(pe.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)Ct(pe.uponSanitizeShadowNode,n,null),Tt(n),At(n),n.content instanceof c&&e(n.content);Ct(pe.afterSanitizeShadowDOM,t,null)};return r.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,i=null,o=null,a=null;if(it=!e,it&&(e="\x3c!--\x3e"),"string"!=typeof e&&!wt(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!r.isSupported)return e;if(ze||mt(t),r.removed=[],"string"==typeof e&&(qe=!1),qe){if(e.nodeName){const t=ht(e.nodeName);if(!we[t]||Ae[t])throw w("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof C)n=kt("\x3c!----\x3e"),i=n.ownerDocument.importNode(e,!0),i.nodeType===Q&&"BODY"===i.nodeName||"HTML"===i.nodeName?n=i:n.appendChild(i);else{if(!$e&&!Re&&!De&&-1===e.indexOf("<"))return ae&&We?ae.createHTML(e):e;if(n=kt(e),!n)return $e?null:We?le:""}n&&Be&&bt(n.firstChild);const l=vt(qe?e:n);for(;o=l.nextNode();)Tt(o),At(o),o.content instanceof c&&Lt(o.content);if(qe)return e;if($e){if(Ue)for(a=de.call(n.ownerDocument);n.firstChild;)a.appendChild(n.firstChild);else a=n;return(Te.shadowroot||Te.shadowrootmode)&&(a=ge.call(s,a,!0)),a}let u=De?n.outerHTML:n.innerHTML;return De&&we["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&S(Z,n.ownerDocument.doctype.name)&&(u="\n"+u),Re&&d([fe,me,ye],(e=>{u=b(u,e," ")})),ae&&We?ae.createHTML(u):u},r.setConfig=function(){mt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ze=!0},r.clearConfig=function(){gt=null,ze=!1},r.isValidAttribute=function(e,t,n){gt||mt({});const r=ht(e),i=ht(t);return Et(r,i,n)},r.addHook=function(e,t){"function"==typeof t&&p(pe[e],t)},r.removeHook=function(e,t){if(void 0!==t){const n=h(pe[e],t);return-1===n?void 0:f(pe[e],n,1)[0]}return g(pe[e])},r.removeHooks=function(e){pe[e]=[]},r.removeAllHooks=function(){pe={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},r}();function oe(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.`)}se.addHook("uponSanitizeElement",((e,t)=>{"strong"!==t.tagName&&"em"!==t.tagName||e.removeAttribute("class")}));const ae="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,le=ae&&"documentMode"in document?document.documentMode:null,ce=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ue=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),de=!(!ae||!("InputEvent"in window)||le)&&"getTargetRanges"in new window.InputEvent("input"),he=ae&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ge=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,pe=ae&&/Android/.test(navigator.userAgent),fe=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),me=ae&&pe&&fe,ye=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!fe;function _e(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const be=0,xe=1,ke=2,ve=1,Se=2,we=3,Ce=4,Te=5,Ee=6,Ne=he||ge||ye?" ":"​",Ae="\n\n",Le=ue?" ":Ne,Pe="֑-߿יִ-﷽ﹰ-ﻼ",Fe="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Oe=new RegExp("^[^"+Fe+"]*["+Pe+"]"),Ie=new RegExp("^[^"+Pe+"]*["+Fe+"]"),Re={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Me={directionless:1,unmergeable:2},De={center:2,end:6,justify:4,left:1,right:3,start:5},ze={[Se]:"center",[Ee]:"end",[Ce]:"justify",[ve]:"left",[we]:"right",[Te]:"start"},Be={normal:0,segmented:2,token:1},$e={[be]:"normal",[ke]:"segmented",[xe]:"token"},Ue="$";function We(e,t,n,r,i,s){let o=e.getFirstChild();for(;null!==o;){const e=o.__key;o.__parent===t&&(Ui(o)&&We(o,e,n,r,i,s),n.has(e)||s.delete(e),i.push(e)),o=o.getNextSibling()}}let He=!1,Ke=0;function je(e){Ke=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!==Ls(e,n)}function Je(e,t,n){const r=yo(uo(n));let i=null,s=null;null!==r&&r.anchorNode===e&&(i=r.anchorOffset,s=r.focusOffset);const o=e.nodeValue;null!==o&&Ks(t,o,i,s,!1)}function Ve(e,t,n){if(Ur(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return xs(t)&&n.isAttached()}function Ge(e,t,n,r){for(let i=e;i&&!Fo(i);i=so(i)){const e=Ls(i,t);if(void 0!==e){const t=Ns(e,n);if(t)return Ki(t)||!bo(i)?void 0:[i,t]}else if(i===r)return[r,Rs(n)]}}function Ze(e,t,n){He=!0;const r=performance.now()-Ke>100;try{Di(e,(()=>{const i=ii()||function(e){return e.getEditorState().read((()=>{const e=ii();return null!==e?e.clone():null}))}(e),s=new Map,o=e.getRootElement(),a=e._editorState,l=e._blockCursorElement;let c=!1,u="";for(let n=0;n0){let t=0;for(let i=0;i0)for(const[t,n]of s)n.reconcileObservedMutation(t,e);const d=n.takeRecords();if(d.length>0){for(let t=0;t{Ze(e,t,n)}))}let Qe=class e{constructor(e,t=new Map,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedConfigMap=t,this.unknownState=n,this.knownState=r;const 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}(t,n,r);this.size=s}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.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};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);return et(e)?{[Ue]:e}:{}}getWritable(t){if(this.node===t)return this;const n=new Map(this.knownState),r=et(i=this.unknownState)&&{...i};var i;if(r)for(const e of n.keys())delete r[e.key];return new e(t,this.sharedConfigMap,et(r),n,this.size)}updateFromKnown(e,t){const n=e.key;this.sharedConfigMap.set(n,e);const{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||this.size++,r.set(e,t)}updateFromUnknown(e,t){const n=this.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={},e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n);this.unknownState=et(this.unknownState)}};function et(e){if(e)for(const t in e)return e}function tt(e,t){const n=e.__mode,r=e.__format,i=e.__style,s=t.__mode,o=t.__format,a=t.__style,l=e.__state,c=t.__state;return(null===n||n===s)&&(null===r||r===o)&&(null===i||i===a)&&(null===e.__state||l===c||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;const n=new Set,r=(e,t)=>{for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const e=t?t.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return!0}return!1},i=(e,t)=>{const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r)for(const[e,t]of Object.entries(r))if(!n.has(e)&&(n.add(e),t!==(i?i[e]:void 0)))return!0;return!1};return!(e&&r(e,t)||t&&r(t,e)||e&&i(e,t)||t&&i(t,e))}(l,c))}function nt(e,t){const n=e.mergeWithSibling(t),r=Ci()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function rt(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Pr(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(tt(t,r)){r=nt(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&Pr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(tt(r,n)){r=nt(r,n);break}break}n.remove()}}else r.remove()}function it(e){return st(e.anchor),st(e.focus),e}function st(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),Pr(r)){e.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!Ui(r))break;e.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let ot,at,lt,ct,ut,dt,ht,gt,pt,ft,mt="",yt="",_t=null,bt="",xt="",kt=!1,vt=!1,St=null;function wt(e,t){const n=ht.get(e);if(null!==t){const n=$t(e);n.parentNode===t&&t.removeChild(n)}if(gt.has(e)||at._keyToDOMMap.delete(e),Ui(n)){const e=Mt(n,ht);Ct(e,0,e.length-1,null)}void 0!==n&&Xs(ft,lt,ct,n,"destroyed")}function Ct(e,t,n,r){let i=t;for(;i<=n;++i){const t=e[i];void 0!==t&&wt(t,r)}}function Tt(e,t){e.setProperty("text-align",t)}const Et="40px";function Nt(e,t){const n=ot.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||Et;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function At(e,t){const n=e.style;0===t?Tt(n,""):1===t?Tt(n,"left"):2===t?Tt(n,"center"):3===t?Tt(n,"right"):4===t?Tt(n,"justify"):5===t?Tt(n,"start"):6===t&&Tt(n,"end")}function Lt(e,t){const n=gt.get(e);void 0===n&&oe(60);const r=n.createDOM(ot,at);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,at),Pr(n)?r.setAttribute("data-lexical-text","true"):Ki(n)&&r.setAttribute("data-lexical-decorator","true"),Ui(n)){const e=n.__indent,t=n.__size;if(0!==e&&Nt(r,e),0!==t){const e=t-1;!function(e,t,n,r){const i=yt;yt="",Pt(e,n,0,t,n.getDOMSlot(r)),It(n,r),yt=i}(Mt(n,gt),e,n,r)}const i=n.__format;0!==i&&At(r,i),n.isInline()||Ot(null,n,r),ro(n)&&(mt+=Ae,xt+=Ae)}else{const t=n.getTextContent();if(Ki(n)){const t=n.decorate(at,ot);null!==t&&zt(e,t),r.contentEditable="false"}else Pr(n)&&(n.isDirectionless()||(yt+=t));mt+=t,xt+=t}return null!==t&&t.insertChild(r),Xs(ft,lt,ct,n,"created"),r}function Pt(e,t,n,r,i){const s=mt;mt="";let o=n;for(;o<=r;++o){Lt(e[o],i);const t=gt.get(e[o]);null!==t&&Pr(t)&&(null===_t&&(_t=t.getFormat()),""===bt&&(bt=t.getStyle()))}ro(t)&&(mt+=Ae),i.element.__lexicalTextContent=mt,mt=s+mt}function Ft(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return gr(e)?"line-break":Ki(e)&&e.isInline()?"decorator":null}return"empty"}return null}function Ot(e,t,n){const r=Ft(e,ht),i=Ft(t,gt);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function It(e,t){const n=t.__lexicalDirTextContent||"",r=t.__lexicalDir||"";if(n!==yt||r!==St){const n=""===yt,i=n?St:function(e){return Oe.test(e)?"rtl":Ie.test(e)?"ltr":null}(yt);if(i!==r){const s=t.classList,o=ot.theme;let a=null!==r?o[r]:void 0,l=null!==i?o[i]:void 0;if(void 0!==a){if("string"==typeof a){const e=_e(a);a=o[r]=e}s.remove(...a)}if(null===i||n&&"ltr"===i)t.removeAttribute("dir");else{if(void 0!==l){if("string"==typeof l){const e=_e(l);l=o[i]=e}void 0!==l&&s.add(...l)}t.dir=i}vt||(e.getWritable().__dir=i)}St=i,t.__lexicalDirTextContent=yt,t.__lexicalDir=i}}function Rt(e,t,n){const r=yt;var i;yt="",_t=null,bt="",function(e,t,n){const r=mt,i=e.__size,s=t.__size;mt="";const o=n.element;if(1===i&&1===s){const n=e.__first,i=t.__first;if(n===i)Dt(n,o);else{const e=$t(n),t=Lt(i,null);try{o.replaceChild(t,e)}catch(r){if("object"==typeof r&&null!=r){const s=`${r.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw new Error(s)}throw r}wt(n,null)}const s=gt.get(i);Pr(s)&&(null===_t&&(_t=s.getFormat()),""===bt&&(bt=s.getStyle()))}else{const r=Mt(e,ht),a=Mt(t,gt);if(r.length!==i&&oe(227),a.length!==s&&oe(228),0===i)0!==s&&Pt(a,t,0,s-1,n);else if(0===s){if(0!==i){const e=null==n.after&&null==n.before&&null==n.element.__lexicalLineBreak;Ct(r,0,i-1,e?null:o),e&&(o.textContent="")}}else!function(e,t,n,r,i,s){const o=r-1,a=i-1;let l,c,u=s.getFirstChild(),d=0,h=0;for(;d<=o&&h<=a;){const e=t[d],r=n[h];if(e===r)u=Bt(Dt(r,s.element)),d++,h++;else{void 0===l&&(l=new Set(t)),void 0===c&&(c=new Set(n));const i=c.has(e),o=l.has(r);if(i)if(o){const e=io(at,r);e===u?u=Bt(Dt(r,s.element)):(s.withBefore(u).insertChild(e),Dt(r,s.element)),d++,h++}else Lt(r,s.withBefore(u)),h++;else u=Bt($t(e)),wt(e,s.element),d++}const i=gt.get(r);null!==i&&Pr(i)&&(null===_t&&(_t=i.getFormat()),""===bt&&(bt=i.getStyle()))}const g=d>o,p=h>a;if(g&&!p){const t=n[a+1],r=void 0===t?null:at.getElementByKey(t);Pt(n,e,h,a,s.withBefore(r))}else p&&!g&&Ct(t,d,o,s.element)}(t,r,a,i,s,n)}ro(t)&&(mt+=Ae),o.__lexicalTextContent=mt,mt=r+mt}(e,t,t.getDOMSlot(n)),It(t,n),i=t,null==_t||_t===i.__textFormat||vt||i.setTextFormat(_t),function(e){""===bt||bt===e.__textStyle||vt||e.setTextStyle(bt)}(t),yt=r}function Mt(e,t){const n=[];let r=e.__first;for(;null!==r;){const e=t.get(r);void 0===e&&oe(101),n.push(r),r=e.__next}return n}function Dt(e,t){const n=ht.get(e);let r=gt.get(e);void 0!==n&&void 0!==r||oe(61);const i=kt||dt.has(e)||ut.has(e),s=io(at,e);if(n===r&&!i){if(Ui(n)){const e=s.__lexicalTextContent;void 0!==e&&(mt+=e,xt+=e);const t=s.__lexicalDirTextContent;void 0!==t&&(yt+=t)}else{const e=n.getTextContent();Pr(n)&&!n.isDirectionless()&&(yt+=e),xt+=e,mt+=e}return s}if(n!==r&&i&&Xs(ft,lt,ct,r,"updated"),r.updateDOM(n,s,ot)){const n=Lt(e,null);return null===t&&oe(62),t.replaceChild(n,s),wt(e,null),n}if(Ui(n)&&Ui(r)){const e=r.__indent;e!==n.__indent&&Nt(s,e);const t=r.__format;t!==n.__format&&At(s,t),i&&(Rt(n,r,s),qi(r)||r.isInline()||Ot(n,r,s)),ro(r)&&(mt+=Ae,xt+=Ae)}else{const t=r.getTextContent();if(Ki(r)){const t=r.decorate(at,ot);null!==t&&zt(e,t)}else Pr(r)&&!r.isDirectionless()&&(yt+=t);mt+=t,xt+=t}if(!vt&&qi(r)&&r.__cachedText!==xt){const e=r.getWritable();e.__cachedText=xt,r=e}return s}function zt(e,t){let n=at._pendingDecorators;const r=at._decorators;if(null===n){if(r[e]===t)return;n=Fs(at)}n[e]=t}function Bt(e){let t=e.nextSibling;return null!==t&&t===at._blockCursorElement&&(t=t.nextSibling),t}function $t(e){const t=pt.get(e);return void 0===t&&oe(75,e),t}function Ut(e){return{type:e}}const Wt=Ut("SELECTION_CHANGE_COMMAND"),Ht=Ut("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Kt=Ut("CLICK_COMMAND"),jt=Ut("DELETE_CHARACTER_COMMAND"),qt=Ut("INSERT_LINE_BREAK_COMMAND"),Jt=Ut("INSERT_PARAGRAPH_COMMAND"),Vt=Ut("CONTROLLED_TEXT_INSERTION_COMMAND"),Gt=Ut("PASTE_COMMAND"),Zt=Ut("REMOVE_TEXT_COMMAND"),Yt=Ut("DELETE_WORD_COMMAND"),Xt=Ut("DELETE_LINE_COMMAND"),Qt=Ut("FORMAT_TEXT_COMMAND"),en=Ut("UNDO_COMMAND"),tn=Ut("REDO_COMMAND"),nn=Ut("KEYDOWN_COMMAND"),rn=Ut("KEY_ARROW_RIGHT_COMMAND"),sn=Ut("MOVE_TO_END"),on=Ut("KEY_ARROW_LEFT_COMMAND"),an=Ut("MOVE_TO_START"),ln=Ut("KEY_ARROW_UP_COMMAND"),cn=Ut("KEY_ARROW_DOWN_COMMAND"),un=Ut("KEY_ENTER_COMMAND"),dn=Ut("KEY_SPACE_COMMAND"),hn=Ut("KEY_BACKSPACE_COMMAND"),gn=Ut("KEY_ESCAPE_COMMAND"),pn=Ut("KEY_DELETE_COMMAND"),fn=Ut("KEY_TAB_COMMAND"),mn=Ut("INSERT_TAB_COMMAND"),yn=Ut("INDENT_CONTENT_COMMAND"),_n=Ut("OUTDENT_CONTENT_COMMAND"),bn=Ut("DROP_COMMAND"),xn=Ut("FORMAT_ELEMENT_COMMAND"),kn=Ut("DRAGSTART_COMMAND"),vn=Ut("DRAGOVER_COMMAND"),Sn=Ut("DRAGEND_COMMAND"),wn=Ut("COPY_COMMAND"),Cn=Ut("CUT_COMMAND"),Tn=Ut("SELECT_ALL_COMMAND"),En=Ut("CLEAR_EDITOR_COMMAND"),Nn=Ut("CLEAR_HISTORY_COMMAND"),An=Ut("CAN_REDO_COMMAND"),Ln=Ut("CAN_UNDO_COMMAND"),Pn=Ut("FOCUS_COMMAND"),Fn=Ut("BLUR_COMMAND"),On=Ut("KEY_MODIFIER_COMMAND"),In=Object.freeze({}),Rn=[["keydown",function(e,t){if(!(Mn=e.timeStamp,Dn=e.key,t.isComposing()||no(t,nn,e)||null==e.key)){if(jn&&Gs(e))return Di(t,(()=>{tr(t,qn)})),jn=!1,void(qn="");if(function(e){return qs(e,"ArrowRight",{shiftKey:"any"})}(e))no(t,rn,e);else if(function(e){return qs(e,"ArrowRight",Js)}(e))no(t,sn,e);else if(function(e){return qs(e,"ArrowLeft",{shiftKey:"any"})}(e))no(t,on,e);else if(function(e){return qs(e,"ArrowLeft",Js)}(e))no(t,an,e);else if(function(e){return qs(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))no(t,ln,e);else if(function(e){return qs(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))no(t,cn,e);else if(function(e){return qs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))Hn=!0,no(t,un,e);else if(function(e){return" "===e.key}(e))no(t,dn,e);else if(function(e){return ce&&qs(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),Hn=!0,no(t,qt,!0);else if(function(e){return qs(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))Hn=!1,no(t,un,e);else if(function(e){return qs(e,"Backspace",{shiftKey:"any"})||ce&&qs(e,"h",{ctrlKey:!0})}(e))Gs(e)?no(t,hn,e):(e.preventDefault(),no(t,jt,!0));else if(function(e){return"Escape"===e.key}(e))no(t,gn,e);else if(function(e){return qs(e,"Delete",{})||ce&&qs(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),no(t,jt,!1)):no(t,pn,e);else if(function(e){return qs(e,"Backspace",Vs)}(e))e.preventDefault(),no(t,Yt,!0);else if(function(e){return qs(e,"Delete",Vs)}(e))e.preventDefault(),no(t,Yt,!1);else if(function(e){return ce&&qs(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),no(t,Xt,!0);else if(function(e){return ce&&(qs(e,"Delete",{metaKey:!0})||qs(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),no(t,Xt,!1);else if(function(e){return qs(e,"b",Js)}(e))e.preventDefault(),no(t,Qt,"bold");else if(function(e){return qs(e,"u",Js)}(e))e.preventDefault(),no(t,Qt,"underline");else if(function(e){return qs(e,"i",Js)}(e))e.preventDefault(),no(t,Qt,"italic");else if(function(e){return qs(e,"Tab",{shiftKey:"any"})}(e))no(t,fn,e);else if(function(e){return qs(e,"z",Js)}(e))e.preventDefault(),no(t,en,void 0);else if(function(e){return ce?qs(e,"z",{metaKey:!0,shiftKey:!0}):qs(e,"y",{ctrlKey:!0})||qs(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),no(t,tn,void 0);else{const n=t._editorState._selection;null===n||Ur(n)?Zs(e)&&(e.preventDefault(),no(t,Tn,e)):function(e){return qs(e,"c",Js)}(e)?(e.preventDefault(),no(t,wn,e)):function(e){return qs(e,"x",Js)}(e)?(e.preventDefault(),no(t,Cn,e)):Zs(e)&&(e.preventDefault(),no(t,Tn,e))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(e)&&no(t,On,e)}}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;xo(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Di(t,(()=>{hs(n)||(Wn=!0)}))}],["compositionstart",function(e,t){Di(t,(()=>{const n=ii();if(Ur(n)&&!t.isComposing()){const r=n.anchor,i=n.anchor.getNode();Ts(r.key),(e.timeStamp{tr(t,e.data)})):(jn=!0,qn=e.data)}],["input",function(e,t){e.stopPropagation(),Di(t,(()=>{if(bo(e.target)&&hs(e.target))return;const n=ii(),r=e.data,i=er(e);if(null!=r&&Ur(n)&&Gn(n,i,r,e.timeStamp,!1)){Kn&&(tr(t,r),Kn=!1);const i=n.anchor.getNode(),s=yo(uo(t));if(null===s)return;const o=n.isBackward(),a=o?n.anchor.offset:n.focus.offset,l=o?n.focus.offset:n.anchor.offset;de&&!n.isCollapsed()&&Pr(i)&&null!==s.anchorNode&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===Ws(s.anchorNode)||no(t,Vt,r);const c=r.length;ue&&c>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=c),he||ge||ye||!t.isComposing()||(Mn=0,Ts(null))}else Hs(!1,t,null!==r?r:void 0),Kn&&(tr(t,r||void 0),Kn=!1);!function(){vi();Ye(Ci())}()}),{event:e}),Bn=null}],["click",function(e,t){Di(t,(()=>{const n=ii(),r=yo(uo(t)),i=si();if(r)if(Ur(n)){const t=n.anchor,s=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!qi(s)&&1===Is().getChildrenSize()&&s.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&s!==n.focus.getNode()){const e=function(e,t){let n=e;for(;n!==Is()&&null!=n;){if(t(n))return n;n=n.getParent()}return null}(s,(e=>Ui(e)&&!e.isInline()));Ui(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(bo(n)||xs(n))&&Ms(ri(i,r,t,e))}no(t,Kt,e)}))}],["cut",In],["copy",In],["dragstart",In],["dragover",In],["dragend",In],["paste",In],["focus",In],["blur",In],["drop",In]];de&&Rn.push(["beforeinput",(e,t)=>function(e,t){const n=e.inputType,r=er(e);"deleteCompositionText"===n||ue&&to(t)||"insertCompositionText"!==n&&Di(t,(()=>{const i=ii();if("deleteContentBackward"===n){if(null===i){const e=si();if(!Ur(e))return;Ms(e.clone())}if(Ur(i)){const n=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===Dn&&s{Di(t,(()=>{Ts(null)}))}),30),Ur(i)){const e=i.anchor.getNode();e.markDirty(),Pr(e)||oe(142),Qn(i,e)}}else{Ts(null),e.preventDefault();const r=i.anchor.getNode(),s=r.getTextContent(),o=r.canInsertTextAfter(),a=0===i.anchor.offset&&i.focus.offset===s.length;let l=me&&n&&!a&&o;if(l&&i.isCollapsed()&&(l=!Ki(eo(i.anchor,!0))),!l){no(t,jt,!0);const e=ii();me&&Ur(e)&&e.isCollapsed()&&(Jn=e,setTimeout((()=>Jn=null)))}}return}}var s;if(!Ur(i))return;const o=e.data;null!==Bn&&Hs(!1,t,Bn),i.dirty&&null===Bn||!i.isCollapsed()||qi(i.anchor.getNode())||null===r||i.applyDOMRange(r),Bn=null;const a=i.anchor,l=i.focus,c=a.getNode(),u=l.getNode();if("insertText"!==n&&"insertTranspose"!==n)switch(e.preventDefault(),n){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":no(t,Vt,e);break;case"insertFromComposition":Ts(null),no(t,Vt,e);break;case"insertLineBreak":Ts(null),no(t,qt,!1);break;case"insertParagraph":Ts(null),Hn&&!ge?(Hn=!1,no(t,qt,!1)):no(t,Jt,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":no(t,Gt,e);break;case"deleteByComposition":(function(e,t){return e!==t||Ui(e)||Ui(t)||!_s(e)||!_s(t)})(c,u)&&no(t,Zt,e);break;case"deleteByDrag":case"deleteByCut":no(t,Zt,e);break;case"deleteContent":no(t,jt,!1);break;case"deleteWordBackward":no(t,Yt,!0);break;case"deleteWordForward":no(t,Yt,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":no(t,Xt,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":no(t,Xt,!1);break;case"formatStrikeThrough":no(t,Qt,"strikethrough");break;case"formatBold":no(t,Qt,"bold");break;case"formatItalic":no(t,Qt,"italic");break;case"formatUnderline":no(t,Qt,"underline");break;case"historyUndo":no(t,en,void 0);break;case"historyRedo":no(t,tn,void 0)}else{if("\n"===o)e.preventDefault(),no(t,qt,!1);else if(o===Ae)e.preventDefault(),no(t,Jt,void 0);else if(null==o&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=o&&Gn(i,r,o,e.timeStamp,!0)?(e.preventDefault(),no(t,Vt,o)):Bn=o;zn=e.timeStamp}}))}(e,t)]);let Mn=0,Dn=null,zn=0,Bn=null;const $n=new WeakMap;let Un=!1,Wn=!1,Hn=!1,Kn=!1,jn=!1,qn="",Jn=null,Vn=[0,"",0,"root",0];function Gn(e,t,n,r,i){const s=e.anchor,o=e.focus,a=s.getNode(),l=Ci(),c=yo(uo(l)),u=null!==c?c.anchorNode:null,d=s.key,h=l.getElementByKey(d),g=n.length;return d!==o.key||!Pr(a)||(!i&&(!de||zn1||(i||!de)&&null!==h&&!a.isComposing()&&u!==ks(h)||null!==c&&null!==t&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||a.getFormat()!==e.format||a.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=_s(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){const t=e.getPreviousSibling();return(Pr(t)||Ui(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,a)}function Zn(e,t){return xs(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function Yn(e,t,n){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=e;Un&&(Un=!1,Zn(r,i)&&Zn(s,o)&&!Jn)||Di(t,(()=>{if(!n)return void Ms(null);if(!ps(t,r,s))return;let a=ii();if(Jn&&Ur(a)&&a.isCollapsed()){const e=a.anchor,t=Jn.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(a=Jn.clone(),Ms(a))}if(Jn=null,Ur(a)){const n=a.anchor,r=n.getNode();if(a.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(a.dirty=!0);const i=uo(t).event,s=i?i.timeStamp:performance.now(),[o,l,c,u,d]=Vn,h=Is(),g=!1===t.isComposing()&&""===h.getTextContent();if(s{const r=si(),i=t.anchorNode;(bo(i)||xs(i))&&Ms(ri(r,t,n,e))})));const r=$s(n),i=r[r.length-1],s=i._key,o=rr.get(s),a=o||i;a!==n&&Yn(t,a,!1),Yn(t,n,!0),n!==i?rr.set(s,n):o&&rr.delete(s)}function sr(e){e._lexicalHandled=!0}function or(e){return!0===e._lexicalHandled}function ar(e){const t=e.ownerDocument,n=$n.get(t);if(void 0===n)return;const r=n-1;r>=0||oe(164),$n.set(t,r),0===r&&t.removeEventListener("selectionchange",ir);const i=ys(e);fs(i)?(function(e){if(null!==e._parentEditor){const t=$s(e),n=t[t.length-1]._key;rr.get(n)===e&&rr.delete(n)}else rr.delete(e._key)}(i),e.__lexicalEditor=null):i&&oe(198);const s=nr(e);for(let e=0;ee.__key===this.__key));if(Pr(this))return n;if(Ur(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Ki(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:Ns(e)}getParentOrThrow(){const e=this.getParent();return null===e&&oe(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const t=e.getParent();if(ho(t))return Ui(e)||e===this&&Ki(e)||oe(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&oe(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:Ns(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:Ns(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=Ui(this)?this:this.getParent(),n=Ui(e)?e:e.getParent(),r=t&&n?la(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const t=la(this,e);return null!==t&&("descendant"===t.type||("branch"===t.type?-1===sa(t):("same"!==t.type&&"ancestor"!==t.type&&oe(279),!1)))}isParentOf(e){const t=la(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 s=i.__key;if(r.has(s)||(r.add(s),n.push(i)),i===e)break;const o=Ui(i)?t?i.getFirstChild():i.getLastChild():null;if(null!==o){i=o;continue}const a=t?i.getNextSibling():i.getPreviousSibling();if(null!==a){i=a;continue}const l=i.getParentOrThrow();if(r.has(l.__key)||n.push(l),l===e)break;let c=null,u=l;do{if(null===u&&oe(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=Ci()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){const e=Ns(this.__key);return null===e&&oe(113),e}getWritable(){vi();const e=wi(),t=Ci(),n=e._nodeMap,r=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,o=ii();if(null!==o&&o.setCachedNodes(null),s.has(r))return Cs(i),i;const a=Lo(i);return s.add(r),Cs(a),n.set(r,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){oe(70)}updateDOM(e,t,n){oe(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){oe(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable();return(t||n.__state)&&function(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Qe(t);return t.__state=n,n}(e).updateFromJSON(t),n}(this,e.$)}static transform(){return null}remove(e){lr(this,!0,e)}replace(e,t){vi();let n=ii();null!==n&&(n=n.clone()),po(this,e);const r=this.getLatest(),i=this.__key,s=e.__key,o=e.getWritable(),a=this.getParentOrThrow().getWritable(),l=a.__size;ws(o);const c=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,h=r.__next,g=r.__parent;if(lr(r,!1,!0),null===c?a.__first=s:c.getWritable().__next=s,o.__prev=d,null===u?a.__last=s:u.getWritable().__prev=s,o.__next=h,o.__parent=g,a.__size=l,t&&(Ui(this)&&Ui(o)||oe(139),this.getChildren().forEach((e=>{o.append(e)}))),Ur(n)){Ms(n);const e=n.anchor,t=n.focus;e.key===i&&Br(e,o),t.key===i&&Br(t,o)}return Es()===i&&Ts(s),o}insertAfter(e,t=!0){vi(),po(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.getParent(),s=ii();let o=!1,a=!1;if(null!==i){const t=e.getIndexWithinParent();if(ws(r),Ur(s)){const e=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===e&&n.offset===t+1,a="element"===r.type&&r.key===e&&r.offset===t+1}}const l=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===l?c.__last=u:l.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&Ur(s)){const e=this.getIndexWithinParent();oi(s,c,e+1);const t=c.__key;o&&s.anchor.set(t,e+2,"element"),a&&s.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){vi(),po(this,e);const n=this.getWritable(),r=e.getWritable(),i=r.__key;ws(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),a=n.__prev,l=this.getIndexWithinParent();null===s?o.__first=i:s.getWritable().__next=i,o.__size++,n.__prev=i,r.__prev=a,r.__next=n.__key,r.__parent=n.__parent;const c=ii();return t&&Ur(c)&&oi(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return ss()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){vi();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Ui(n))return n.select();if(!Pr(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){vi();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Ui(n))return n.select(0,0);if(!Pr(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class ur extends cr{static getType(){return"linebreak"}static clone(e){return new ur(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&&So(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&pr(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&pr(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&So(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&pr(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&pr(r))return!0}return!1}(e)?null:{conversion:dr,priority:0}}}static importJSON(e){return hr().updateFromJSON(e)}}function dr(e){return{node:hr()}}function hr(){return go(new ur)}function gr(e){return e instanceof ur}function pr(e){return xs(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function fr(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function mr(e,t){return 1&t?"strong":2&t?"em":"span"}function yr(e,t,n,r,i){const s=r.classList;let o=Ys(i,"base");void 0!==o&&s.add(...o),o=Ys(i,"underlineStrikethrough");let a=!1;const l=8&t&&4&t;void 0!==o&&(8&n&&4&n?(a=!0,l||s.add(...o)):l&&s.remove(...o));for(const e in Re){const r=Re[e];if(o=Ys(i,e),void 0!==o)if(n&r){if(a&&("underline"===e||"strikethrough"===e)){t&r&&s.remove(...o);continue}t&r&&(!l||"underline"!==e)&&"strikethrough"!==e||s.add(...o)}else t&r&&s.remove(...o)}}function _r(e,t,n){const r=t.firstChild,i=n.isComposing(),s=e+(i?Ne:"");if(null==r)t.textContent=s;else{const e=r.nodeValue;if(e!==s)if(i||ue){const[t,n,i]=function(e,t){const n=e.length,r=t.length;let i=0,s=0;for(;i({conversion:Tr,priority:0}),b:()=>({conversion:Sr,priority:0}),code:()=>({conversion:Ar,priority:0}),em:()=>({conversion:Ar,priority:0}),i:()=>({conversion:Ar,priority:0}),mark:()=>({conversion:Ar,priority:0}),s:()=>({conversion:Ar,priority:0}),span:()=>({conversion:vr,priority:0}),strong:()=>({conversion:Ar,priority:0}),sub:()=>({conversion:Ar,priority:0}),sup:()=>({conversion:Ar,priority:0}),u:()=>({conversion:Ar,priority:0})}}static importJSON(e){return Lr().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 bo(t)||oe(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=xr(t,"b")),this.hasFormat("italic")&&(t=xr(t,"i")),this.hasFormat("strikethrough")&&(t=xr(t,"s")),this.hasFormat("underline")&&(t=xr(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?Re[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?Me[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=vs(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=Be[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){vi();let n=e,r=t;const i=ii(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const e=s.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!Ur(i))return ei(o,n,o,r,"text","text");{const e=Es();e!==i.anchor.key&&e!==i.focus.key||Ts(o),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(),s=i.__text,o=n.length;let a=e;a<0&&(a=o+a,a<0&&(a=0));const l=ii();if(r&&Ur(l)){const t=e+o;l.setTextNodeRange(i,t,i,t)}const c=s.slice(0,a)+n+s.slice(a+t);return i.__text=c,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){vi();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,i=Es(),s=n.length;e.sort(((e,t)=>e-t)),e.push(s);const o=[],a=e.length;for(let t=0,r=0;tt&&(o.push(n.slice(t,i)),t=i)}const l=o.length;if(1===l)return[t];const c=o[0],u=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let f=!1,m=null,y=null;const _=ii();if(Ur(_)){const[e,t]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(y=t)}t.isSegmented()?(d=Lr(c),d.__format=h,d.__style=g,d.__detail=p,f=!0):d=t.setTextContent(c);const b=[d];for(let e=1;e=v&&(m.set(e.getKey(),x-v,"text"),x=v){y.set(e.getKey(),k-v,"text");break}v=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&Cs(t),null!==n&&Cs(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();f?(e.splice(t,0,b),this.remove()):e.splice(t,1,b),Ur(_)&&oi(_,u,t,l-1)}return b}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||oe(50);const n=this.__key,r=e.__key,i=this.__text,s=i.length;Es()===r&&Ts(n);const o=ii();if(Ur(o)){const i=o.anchor,a=o.focus;null!==i&&i.key===r&&ci(i,t,n,e,s),null!==a&&a.key===r&&ci(a,t,n,e,s)}const a=e.__text,l=t?a+i:i+a;this.setTextContent(l);const c=this.getWritable();return e.remove(),c}isTextEntity(){return!1}}function vr(e){return{forChild:Fr(e.style),node:null}}function Sr(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:Fr(t.style,n?void 0:"bold"),node:null}}const wr=new WeakMap;function Cr(e){if(!bo(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function Tr(e){const t=e;null===e.parentElement&&oe(129);let n=t.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=wr.get(n))&&!Cr(n);)r.push(n),n=n.parentNode;const i=void 0===t?n:t;for(let e=0;e0){/[ \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=Er(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:Lr(n)}}function Er(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,bo(n)){const e=n.style.display;if(""===e&&!vo(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(xs(n))return n;if("BR"===n.nodeName)return null}}const Nr={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Ar(e){const t=Nr[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:Fr(e.style,t),node:null}}function Lr(e=""){return go(new kr(e))}function Pr(e){return e instanceof kr}function Fr(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===e.fontStyle,a=r.includes("underline"),l=e.verticalAlign;return e=>Pr(e)?(i&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),o&&!e.hasFormat("italic")&&e.toggleFormat("italic"),a&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class Or extends kr{static getType(){return"tab"}static clone(e){return new Or(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=Ys(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return Ir().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&oe(126),super.setTextContent("\t")}spliceText(e,t,n,r){return""===n&&0===t||"\t"===n&&1===t||oe(286),this}setDetail(e){return 2!==e&&oe(127),this}setMode(e){return"normal"!==e&&oe(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ir(){return go(new Or)}function Rr(e){return e instanceof Or}class Mr{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.offsete&&(r=e)}else if(!Ui(t)){const e=t.getNextSibling();if(Pr(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 Br(e,t){if(Ui(t)){const n=t.getLastDescendant();Ui(n)||Pr(n)?zr(e,n):zr(e,t)}else zr(e,t)}class $r{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Hr(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 $r(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(Pr(r))i=r.select();else{const e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e1;){const e=t[t.length-1];if(!Ui(e)||s.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=_a(e.anchor),r=_a(e.anchor.getFlipped()),i=e=>Uo(e)?e.origin:e.getNodeAtCaret(),s=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(s)}return t}(ka(ga(this),"next"));return ki()||(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,s=r.isBefore(i),[o,a]=jr(this);let l="",c=!0;for(let u=0;u=0;e--){const t=s[e];if(t.is(d)||Ui(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(_s(d))if(a===h)d.select();else{const t=Lr(e);t.select(),d.replace(t)}else d=d.spliceText(a,h-a,e,!0),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach((n=>{if(Ui(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},s=r.length;if(0===s)return this.toggleFormat(e),Ts(null),void i(t);const o=this.anchor,a=this.focus,l=this.isBackward(),c=l?a:o,u=l?o:a;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=s-1;let m=r[f];const y="text"===u.type?u.offset:m.getTextContentSize();if(h.is(m)){if(g===y)return;if(bs(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||bs(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const _=m.getFormatFlags(e,p);y>0&&(y===m.getTextContentSize()||bs(m)||([m]=m.splitText(y)),m.setFormat(_));for(let t=d+1;t(Ui(e)||Ki(e))&&!e.isInline()))){Ui(n)||oe(211,t.constructor.name,t.getType());const i=hi(this);return n.splice(i,0,e),void r.selectEnd()}const i=function(e){const t=ss();let n=null;for(let r=0;rl?l:a,t=a>l?a:l,n=s.splitText(e,t),r=0===e?n[0]:n[1];return null!=r?[r]:[]}return[s]}const c=r.isBefore(i);if(Pr(s)){const t=c?a:l;t===s.getTextContentSize()?e.shift():0!==t&&([,s]=s.splitText(t),e[0]=s)}if(Pr(o)){const t=o.getTextContent().length,r=c?l:a;0===r?e.pop():r!==t&&([o]=o.splitText(r),e[n]=o)}return e}modify(e,t,n){if(pi(this,e,t,n))return;const r="move"===e,i=Ci(),s=yo(uo(i));if(!s)return;const o=i._blockCursorElement,a=i._rootElement,l=this.focus.getNode();if(null===a||null===o||!Ui(l)||l.isInline()||l.canBeEmpty()||mo(o,i,a),this.dirty){let e=io(i,this.anchor.key),t=io(i,this.focus.key);"text"===this.anchor.type&&(e=ks(e)),"text"===this.focus.type&&(t=ks(t)),e&&t&&ui(s,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(s,e,t?"backward":"forward",n),s.rangeCount>0){const e=s.getRangeAt(0),n=this.anchor.getNode(),i=qi(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t;){if(ho(t))return t;t=t.getParentOrThrow()}return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let o=!1;for(let e=0;e0)if(t){const e=r[0];Ui(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];Ui(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}s.anchorNode===e.startContainer&&s.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,i=n.offset,s=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,s,!0)}(this)}}"lineboundary"===n&&pi(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Ui(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(Ui(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=ta(ca(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(Ho(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Ui(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=_a(t);ha(this,na(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(Wo(t)){if(Ui(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(Ki(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Ui(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=ni();e.add(t.origin.getKey()),Ms(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return ha(this,na(!t.origin.isEmpty()&&n.isEmpty()?pa(Jo(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&&qr(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,s=r.getTextContentSize();if(r.is(n)||e&&t!==s||!e&&0!==t)return void Vr(r,e,t)}else if(null!==n&&n.isSegmented()){const i=t.offset,s=n.getTextContentSize();if(n.is(r)||e&&0!==i||!e&&i!==s)return void Vr(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,s=r.offset,o=e{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Vr(e,t,n){const r=e,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,a=0;for(let e=0;en||r){i.splice(e,1),r&&(a=void 0);break}}const l=i.join("").trim();""===l?r.remove():(r.setTextContent(l),r.select(a,a))}function Gr(e,t,n,r){let i,s=t;if(bo(e)){let o=!1;const a=e.childNodes,l=a.length,c=r._blockCursorElement;s===l&&(o=!0,s=l-1);let u=a[s],d=!1;if(u===c)u=a[s+1],d=!0;else if(null!==c){const n=c.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,c)&&s--}if(i=Ds(u),Pr(i))s=zs(i,o);else{let a=Ds(e);if(null===a)return null;if(Ui(a)){const l=r.getElementByKey(a.getKey());null===l&&oe(214);const c=a.getDOMSlot(l);[a,s]=c.resolveChildIndex(a,l,e,t),Ui(a)||oe(215),o&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let u=a.getChildAtIndex(s);if(Ui(u)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){const e=o?u.getLastDescendant():u.getFirstDescendant();null===e?a=u:(u=e,a=Ui(u)?u:u.getParentOrThrow()),s=0}Pr(u)?(i=u,a=null,s=zs(u,o)):u!==a&&o&&!d&&(Ui(a)||oe(216),s=Math.min(a.getChildrenSize(),s+1))}else{const n=a.getIndexWithinParent();s=0===t&&Ki(a)&&Ds(e)===a?n:n+1,a=a.getParentOrThrow()}if(Ui(a))return Dr(a.__key,s,"element")}}else i=Ds(e);return Pr(i)?Dr(i.__key,s,"text"):null}function Zr(e,t,n){const r=e.offset,i=e.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(t){if((n||!t)&&null===r&&Ui(s)&&s.isInline()){const t=s.getPreviousSibling();Pr(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Ui(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Pr(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(t&&Ui(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Ui(s)&&s.isInline()&&!s.canInsertTextAfter()){const t=s.getNextSibling();Pr(t)&&e.set(t.__key,0,"text")}}}function Yr(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),i=e.is(t);Zr(e,r,i),Zr(t,!r,i),i&&t.set(e.key,e.offset,e.type);const s=Ci();if(s.isComposing()&&s._compositionKey!==e.key&&Ur(n)){const r=n.anchor,i=n.focus;e.set(r.key,r.offset,r.type,!0),t.set(i.key,i.offset,i.type,!0)}}}function Xr(e,t,n,r,i,s){if(null===e||null===n||!ps(i,e,n))return null;const o=Gr(e,t,Ur(s)?s.anchor:null,i);if(null===o)return null;const a=Gr(n,r,Ur(s)?s.focus:null,i);if(null===a)return null;if("element"===o.type&&"element"===a.type){const t=Ds(e),r=Ds(n);if(Ki(t)&&Ki(r))return null}return Yr(o,a,s),[o,a]}function Qr(e){return Ui(e)&&!e.isInline()}function ei(e,t,n,r,i,s){const o=wi(),a=new Wr(Dr(e,t,i),Dr(n,r,s),0,"");return a.dirty=!0,o._selection=a,a}function ti(){const e=Dr("root",0,"element"),t=Dr("root",0,"element");return new Wr(e,t,0,"")}function ni(){return new $r(new Set)}function ri(e,t,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,a="selectionchange"===o,l=!He&&(a||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let c,u,d,h;if(Ur(e)&&!l)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,h=t.focusOffset,a&&Ur(e)&&!ps(n,c,u))return e.clone();const g=Xr(c,d,u,h,n,e);if(null===g)return null;const[p,f]=g;return new Wr(p,f,Ur(e)?e.format:0,Ur(e)?e.style:"")}function ii(){return wi()._selection}function si(){return Ci()._editorState._selection}function oi(e,t,n,r=1){const i=e.anchor,s=e.focus,o=i.getNode(),a=s.getNode();if(!t.is(o)&&!t.is(a))return;const l=t.__key;if(e.isCollapsed()){const t=i.offset;if(n<=t&&r>0||n0||n0||n=e,o=i?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Pr(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,"text"),r.set(o.__key,e,"text")}}else{if(Ui(s)){const e=s.getChildrenSize(),r=n>=e,i=r?s.getChildAtIndex(e-1):s.getChildAtIndex(n);if(Pr(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,"text")}}if(Ui(o)){const e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(Pr(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function li(e,t,n,r,i){let s=null,o=0,a=null;null!==r?(s=r.__key,Pr(r)?(o=r.getTextContentSize(),a="text"):Ui(r)&&(o=r.getChildrenSize(),a="element")):null!==i&&(s=i.__key,Pr(i)?a="text":Ui(i)&&(a="element")),null!==s&&null!==a?e.set(s,o,a):(o=t.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),e.set(n.__key,o,"element"))}function ci(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 ui(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch(e){}}function di(e){let t=ii()||si();null===t&&(t=Is().selectEnd()),t.insertNodes(e)}function hi(e){let t=e;e.isCollapsed()||t.removeText();const n=ii();Ur(n)&&(t=n),Ur(t)||oe(161);const r=t.anchor;let i=r.getNode(),s=r.offset;for(;!wo(i);){const e=i;if([i,s]=gi(i,s),e.is(i))break}return s}function gi(e,t){const n=e.getParent();if(!n){const e=ss();return Is().append(e),e.select(),[Is(),0]}if(Pr(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(!Ui(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new Wr(Dr(e.__key,t,"element"),Dr(e.__key,t,"element"),0,""),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function pi(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 s=ca(e.focus,n?"previous":"next"),o="lineboundary"===r,a="move"===t;let l=s,c="decorators-and-blocks"===i;if(!ba(l)){for(const e of l){c=!1;const{origin:t}=e;if(!Ki(t)||t.isIsolated()||(l=e,!o||!t.isInline()))break}if(c)for(const e of ta(s).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Ho(e))e.origin.isInline()||(l=e);else{if(Ui(e.origin))continue;Ki(e.origin)&&!e.origin.isInline()&&(l=e)}break}}if(l===s)return!1;if(a&&!o&&Ki(l.origin)&&l.origin.isKeyboardSelectable()){const e=ni();return e.add(l.origin.getKey()),Ms(e),!0}return l=_a(l),a&&ua(e.anchor,l),ua(e.focus,l),c||!o}let fi=null,mi=null,yi=!1,_i=!1,bi=0;const xi={characterData:!0,childList:!0,subtree:!0};function ki(){return yi||null!==fi&&fi._readOnly}function vi(){yi&&oe(13)}function Si(){bi>99&&oe(14)}function wi(){return null===fi&&oe(195,Ti()),fi}function Ci(){return null===mi&&oe(196,Ti()),mi}function Ti(){let e=0;const t=new Set,n=cs.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=ys(r);if(fs(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 Ei(e,t,n){const r=t.__type,i=function(e,t){const n=e._nodes.get(t);return void 0===n&&oe(30,t),n}(e,r);let s=n.get(r);void 0===s&&(s=Array.from(i.transforms),n.set(r,s));const o=s.length;for(let e=0;e0?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=oo(n),i=co(r);if(null===r||null===i)return;let{top:s,bottom:o}=t,a=0,l=0,c=n;for(;null!==c;){const t=c===r.body;if(t)a=0,l=uo(e).innerHeight;else{const e=c.getBoundingClientRect();a=e.top,l=e.bottom}let n=0;if(sl&&(n=o-l),0!==n)if(t)i.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;s-=t,o-=t}if(t)break;c=so(c)}}(n,t,s)}}Un=!0}}(o,a,e,x,_,r)}!function(e,t,n){let r=e._blockCursorElement;if(Ur(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const i=n.anchor,s=i.getNode(),o=i.offset;let a=!1,l=null;if(o===s.getChildrenSize())fo(s.getChildAtIndex(o-1))&&(a=!0);else{const t=s.getChildAtIndex(o);if(null!==t&&fo(t)){const n=t.getPreviousSibling();(null===n||fo(n))&&(a=!0,l=e.getElementByKey(t.__key))}}if(a){const n=e.getElementByKey(s.__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=_e(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===l?n.appendChild(r):n.insertBefore(r,l))}}null!==r&&mo(r,e,t)}(e,r,a)}finally{null!==g&&g.observe(r,xi),mi=d,fi=c}}null!==p&&function(e,t,n,r,i){const s=Array.from(e._listeners.mutation),o=s.length;for(let e=0;e0||u>0;){if(l>0){t._dirtyLeaves=new Set;for(const e of a){const r=i.get(e);Pr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&rt(r),void 0!==r&&Ni(r,s)&&Ei(t,r,o),n.add(e)}if(a=t._dirtyLeaves,l=a.size,l>0){bi++;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],a=e[1];if(r.set(n,a),!a)continue;const l=i.get(n);void 0!==l&&Ni(l,s)&&Ei(t,l,o)}a=t._dirtyLeaves,l=a.size,c=t._dirtyElements,u=c.size,bi++}t._dirtyLeaves=n,t._dirtyElements=r}(l,e),Ri(e),function(e,t,n,r){const i=e._nodeMap,s=t._nodeMap,o=[];for(const[e]of r){const t=s.get(e);void 0!==t&&(t.isAttached()||(Ui(t)&&We(t,e,i,s,o,r),i.has(e)||r.delete(e),o.push(e)))}for(const e of o)s.delete(e);for(const e of n){const t=s.get(e);void 0===t||t.isAttached()||(i.has(e)||n.delete(e),s.delete(e))}}(a,l,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(l._flushSync=!0);const i=l._selection;if(Ur(i)){const e=l._nodeMap,t=i.anchor.key,n=i.focus.key;void 0!==e.get(t)&&void 0!==e.get(n)||oe(19)}else Hr(i)&&0===i._nodes.size&&(l._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Oi(e)}finally{fi=u,yi=d,mi=h,e._updating=g,bi=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}(l,e);f?l._flushSync?(l._flushSync=!1,Oi(e)):c&&ds((()=>{Oi(e)})):(l._flushSync=!1,c&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Di(e,t,n){mi===e&&void 0===n?t():Mi(e,t,n)}class zi{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new zi(this.element,e,this.after)}withAfter(e){return new zi(this.element,this.before,e)}withElement(e){return this.element===e?this:new zi(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return null!==t&&t.parentElement!==this.element&&oe(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&oe(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&oe(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&&(ge||he);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=Bi(t,n);i.push(r);const s=Bi(t,this.element);let o=e.getIndexWithinParent();for(let e=0;en){o+=1;break}}return[e.getParentOrThrow(),o]}}function Bi(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&&oe(225),n.reverse()}class $i extends cr{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.__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 ze[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=Ci()._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(Pr(t)&&e.push(t),Ui(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Ui(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Ui(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 Ui(e)&&e.getLastDescendant()||e||null}const r=t[e];return Ui(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:Ns(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&oe(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:Ns(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&oe(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e=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;re.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?De[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){const r=n.length,i=this.getChildrenSize(),s=this.getWritable();e+t<=i||oe(226,String(e),String(t),String(i));const o=s.__key,a=[],l=[],c=this.getChildAtIndex(e+t);let u=null,d=i-t+r;if(0!==e)if(e===i)u=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling())}if(t>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let n=0;n0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const i=t.getElementByKey(e.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}}function Ui(e){return e instanceof $i}function Wi(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 Hi extends cr{decorate(e,t){oe(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Ki(e){return e instanceof Hi}class ji extends $i{static getType(){return"root"}static clone(){return new ji}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){oe(51)}getTextContent(){const e=this.__cachedText;return!ki()&&0!==Ci()._dirtyType||null===e?super.getTextContent():e}remove(){oe(52)}replace(e){oe(53)}insertBefore(e){oe(54)}insertAfter(e){oe(55)}updateDOM(e,t){return!1}splice(e,t,n){for(const e of n)Ui(e)||Ki(e)||oe(282);return super.splice(e,t,n)}static importJSON(e){return Is().updateFromJSON(e)}collapseAtStart(){return!0}}function qi(e){return e instanceof ji}function Ji(e){return new Zi(new Map(e._nodeMap))}function Vi(){return new Zi(new Map([["root",new ji]]))}function Gi(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&oe(130,n.name),Ui(e)){const r=t.children;Array.isArray(r)||oe(59,n.name);const i=e.getChildren();for(let e=0;e({root:Gi(Is())})))}}const Yi="historic",Xi="history-merge",Qi="collaboration",es="skip-scroll-into-view",ts="skip-dom-selection";class ns extends $i{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class rs extends $i{static getType(){return"paragraph"}static clone(e){return new rs(e.__key)}createDOM(e){const t=document.createElement("p"),n=Ys(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:is,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(bo(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return ss().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,t){const n=ss();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||Pr(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 is(e){const t=ss();return e.style&&(t.setFormat(e.style.textAlign),Po(e,t)),{node:t}}function ss(){return go(new rs)}function os(e){return e instanceof rs}function as(e,t,n,r){const i=e._keyToDOMMap;i.clear(),e._editorState=Vi(),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 s=e._observer;null!==s&&(s.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",i.set("root",n))}function ls(e){const t=e||{},n=mi,r=t.theme||{},i=void 0===e?n:t.parentEditor||null,s=t.disableEvents||!1,o=Vi(),a=t.namespace||(null!==i?i._config.namespace:Us()),l=t.editorState,c=[ji,kr,ur,Or,rs,ns,...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{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!==l&&(p._pendingEditorState=l,p._dirtyType=2),p}class cs{constructor(e,t,n,r,i,s,o,a){this._createEditorArgs=a,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=Us(),this._onError=i,this._htmlConversions=s,this._editable=o,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&&oe(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&&oe(36,String(e));const s=i[n];return s.add(t),()=>{s.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;i.set(t,r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return void 0===t&&oe(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Ao(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=Ao(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=Ns(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:Xi}: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 no(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=Ys(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,as(this,t,e,r),null!==t&&(this._config.disableEvents||ar(t),null!=n&&t.classList.remove(...n)),null!==e){const t=co(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,Xe(this),this._updateTags.add(Xi),Oi(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument,r=$n.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",ir),$n.set(n,(r||0)+1),e.__lexicalEditor=t;const i=nr(e);for(let n=0;n{or(e)||(sr(e),(t.isEditable()||"click"===r)&&s(e,t))}:e=>{if(or(e))return;sr(e);const n=t.isEditable();switch(r){case"cut":return n&&no(t,Cn,e);case"copy":return no(t,wn,e);case"paste":return n&&no(t,Gt,e);case"dragstart":return n&&no(t,kn,e);case"dragover":return n&&no(t,vn,e);case"dragend":return n&&no(t,Sn,e);case"focus":return n&&no(t,Pn,e);case"blur":return n&&no(t,Fn,e);case"drop":return n&&no(t,bn,e)}};e.addEventListener(r,o),i.push((()=>{e.removeEventListener(r,o)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Xi),Oi(this);Ii("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&oe(38);let n=e;n._readOnly&&(n=Ji(e),n._selection=e._selection?e._selection.clone():null),Ye(this);const r=this._pendingEditorState,i=this._updateTags,s=void 0!==t?t.tag:null;null===r||r.isEmpty()||(null!=s&&i.add(s),Oi(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||Oi(this)}parseEditorState(e,t){return function(e,t,n){const r=Vi(),i=fi,s=yi,o=mi,a=t._dirtyElements,l=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,fi=r,yi=!1,mi=t;try{const i=t._nodes;Pi(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=a,t._dirtyLeaves=l,t._cloneNotNeeded=c,t._dirtyType=u,fi=i,yi=s,mi=o}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Oi(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):Mi(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Di(this,(()=>{const r=ii(),i=Is();null!==r?r.dirty||Ms(r.clone()):0!==i.getChildrenSize()&&("rootStart"===t.defaultSelection?i.selectStart():i.selectEnd()),ao("focus"),function(e){vi(),Ci()._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=yo(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ii("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}cs.version="0.32.1+prod.esm";let us=1;const ds="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function hs(e){return Ki(Ps(e))}function gs(e){const t=document.activeElement;if(!bo(t))return!1;const n=t.nodeName;return Ki(Ps(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==ys(t))}function ps(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!gs(t)&&ms(t)===e}catch(e){return!1}}function fs(e){return e instanceof cs}function ms(e){let t=e;for(;null!=t;){const e=ys(t);if(fs(e))return e;t=so(t)}return null}function ys(e){return e?e.__lexicalEditor:null}function _s(e){return Rr(e)||e.isToken()}function bs(e){return _s(e)||e.isSegmented()}function xs(e){return xo(e)&&3===e.nodeType}function ks(e){let t=e;for(;null!=t;){if(xs(t))return t;t=t.firstChild}return null}function vs(e,t,n){const r=Re[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 Ss(e){return Pr(e)||gr(e)||Ki(e)}function ws(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),s=e.getNextSibling(),o=null!==s?s.__key:null,a=null!==i?i.__key:null,l=null!==i?i.getWritable():null,c=null!==s?s.getWritable():null;null===i&&(r.__first=o),null===s&&(r.__last=a),null!==l&&(l.__next=o),null!==c&&(c.__prev=a),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Cs(e){Si();const t=e.getLatest(),n=t.__parent,r=wi(),i=Ci(),s=r._nodeMap,o=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,s,o);const a=t.__key;i._dirtyType=1,Ui(e)?o.set(a,!0):i._dirtyLeaves.add(a)}function Ts(e){vi();const t=Ci(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=Ns(n);null!==e&&e.getWritable()}if(null!==e){const t=Ns(e);null!==t&&t.getWritable()}}}function Es(){return ki()?null:Ci()._compositionKey}function Ns(e,t){const n=(t||wi())._nodeMap.get(e);return void 0===n?null:n}function As(e,t){const n=Ls(e,Ci());return void 0!==n?Ns(n,t):null}function Ls(e,t){return e[`__lexicalKey_${t._key}`]}function Ps(e,t){let n=e;for(;null!=n;){const e=As(n,t);if(null!==e)return e;n=so(n)}return null}function Fs(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Os(e){return e.read((()=>Is().getTextContent()))}function Is(){return Rs(wi())}function Rs(e){return e._nodeMap.get("root")}function Ms(e){vi();const t=wi();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Ds(e){const t=Ci(),n=function(e,t){let n=e;for(;null!=n;){const e=Ls(n,t);if(void 0!==e)return e;n=so(n)}return null}(e,t);return null===n?e===t.getRootElement()?Ns("root"):null:Ns(n)}function zs(e,t){return t?e.getTextContentSize():0}function Bs(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function $s(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function Us(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ws(e){return xs(e)?e.nodeValue:null}function Hs(e,t,n){const r=yo(uo(t));if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let t=Ws(i);const r=Ps(i);if(null!==t&&Pr(r)){if(t===Ne&&n){const e=n.length;t=n,s=e,o=e}null!==t&&Ks(r,t,s,o,e)}}}function Ks(e,t,n,r,i){let s=e;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let a=t;(o||i)&&t[t.length-1]===Ne&&(a=t.slice(0,-1));const l=s.getTextContent();if(i||a!==l){if(""===a){if(Ts(null),he||ge||ye)s.remove();else{const e=Ci();setTimeout((()=>{e.update((()=>{s.isAttached()&&s.remove()}))}),20)}return}const t=s.getParent(),i=si(),l=s.getTextContentSize(),c=Es(),u=s.getKey();if(s.isToken()||null!==c&&u===c&&!o||Ur(i)&&(null!==t&&!t.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===e.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===l&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const d=ii();if(!Ur(d)||null===n||null===r)return void s.setTextContent(a);if(d.setTextNodeRange(s,n,s,r),s.isSegmented()){const e=Lr(s.getTextContent());s.replace(e),s=e}s.setTextContent(a)}}}function js(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function qs(e,t,n){return function(e,t){return js(e,t,"altKey")&&js(e,t,"ctrlKey")&&js(e,t,"shiftKey")&&js(e,t,"metaKey")}(e,n)&&e.key.toLowerCase()===t.toLowerCase()}const Js={ctrlKey:!ce,metaKey:ce},Vs={altKey:ce,ctrlKey:!ce};function Gs(e){return"Backspace"===e.key}function Zs(e){return qs(e,"a",Js)}function Ys(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=_e(i);return n[t]=e,e}return i}function Xs(e,t,n,r,i){if(0===n.size)return;const s=r.__type,o=r.__key,a=t.get(s);void 0===a&&oe(33,s);const l=a.klass;let c=e.get(l);void 0===c&&(c=new Map,e.set(l,c));const u=c.get(o),d="destroyed"===u&&"created"===i;(void 0===u||d)&&c.set(o,d?"updated":i)}function Qs(e,t,n){const r=e.getParent();let i=n,s=e;return null!==r&&(t&&0===n?(i=s.getIndexWithinParent(),s=r):t||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(t?i-1:i)}function eo(e,t){const n=e.offset;if("element"===e.type)return Qs(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?Qs(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function to(e){const t=uo(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function no(e,t,n){return function(e,t,n){const r=$s(e);for(let i=4;i>=0;i--)for(let s=0;s{for(let t=0;te,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Jo(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Jo(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 s=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();null!==t&&o.size0){const t=i.getNodeAtCaret();if(t)if(o.delete(t.getKey()),o.delete(e.getKey()),t.is(e)||i.origin.is(e));else{const n=e.getParent();n&&n.is(s)&&e.remove(),t.replace(e)}else null===t&&oe(263,Array.from(o).join(" "))}else i.insert(e);i=Jo(e,this.direction)}for(const e of o.values())e.remove();return this}}class Ro extends Io{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Yo(e,this.direction)}getParentCaret(e="root"){return Jo(zo(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Do(this.direction);return Jo(this.getNodeAtCaret(),e)||Yo(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Ro&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Mo={root:qi,shadowRoot:ho};function Do(e){return Oo[e]}function zo(e,t="root"){return Mo[t](e)?null:e}class Bo extends Io{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Jo(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Ui(this.origin)?Yo(this.origin,this.direction):null}getParentCaret(e="root"){return Jo(zo(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Do(this.direction);return Jo(this.getNodeAtCaret(),e)||Yo(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Bo&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Bo||e instanceof $o)&&this.direction===e.direction&&this.origin.is(e.origin)}}class $o extends Io{type="text";constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Vo(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Jo(zo(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Vo(this.origin,Do(this.direction),this.offset)}isSamePointCaret(e){return e instanceof $o&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Bo||e instanceof $o)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Jo(this.origin,this.direction)}}function Uo(e){return e instanceof $o}function Wo(e){return e instanceof Bo}function Ho(e){return e instanceof Ro}const Ko={next:class extends $o{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends $o{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},jo={next:class extends Bo{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Bo{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},qo={next:class extends Ro{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Ro{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Jo(e,t){return e?new jo[t](e):null}function Vo(e,t,n){return e?new Ko[t](e,Go(e,n)):null}function Go(e,t){const n=e.getTextContentSize();let r="next"===t?n:"previous"===t?0:t;return(r<0||r>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);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.`)}(284,String(t),String(n),e.getKey()),r=r<0?0:n),r}function Zo(e,t){return new ea(e,t)}function Yo(e,t){return Ui(e)?new qo[t](e):null}function Xo(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class Qo{type="node-caret-range";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 Qo(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Uo(t)?function(e,t){const{direction:n,origin:r}=e;return Zo(e,Go(r,"focus"===t?Do(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[Zo(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Uo(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Uo(n),i=t=>t.isSameNodeCaret(n)?null:Xo(t)||t.getParentCaret(e);return ra({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 ea{type="slice";constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n{let n;for(let r=l;rn.has(e.getKey())&&wo(e)));return u&&d?[u,d]:null}(u,d,l);if(h){const[e,t]=h;Yo(e,"previous").splice(0,t.getChildren()),t.remove()}const g=[u,d,...o,...a].find(ma);if(g)return function(e){return na(e,e)}(xa(_a(g),e.direction));oe(269,JSON.stringify(o.map((e=>e.origin.__key))))}function _a(e){const t=function(e){let t=e;for(;Ho(t);){const e=Xo(t);if(!Ho(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Pr(t.origin))return Uo(t)?t:Vo(t.origin,n,n);const r=t.getAdjacentCaret();return Wo(r)&&Pr(r.origin)?Vo(r.origin,n,Do(n)):t}function ba(e){return Uo(e)&&e.offset!==Go(e.origin,e.direction)}function xa(e,t){return e.direction===t?e:e.getFlipped()}function ka(e,t){return e.direction===t?e:na(xa(e.focus,t),xa(e.anchor,t))}function va(){const e=document.head.querySelector("meta[name=csp-nonce]");return e?.content}const Sa=new Map;function wa(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 Ca(e){let t=Sa.get(e);return void 0===t&&(t=wa(e),Sa.set(e,t)),t}function Ta(e,t){const n=e.getStartEndPoints();if(t.isSelected(e)&&!bs(t)&&null!==n){const[r,i]=n,s=e.isBackward(),o=r.getNode(),a=i.getNode(),l=t.is(o),c=t.is(a);if(l||c){const[n,r]=jr(e),i=o.is(a),l=t.is(s?a:o),c=t.is(s?o:a);let u,d=0;i?(d=n>r?r:n,u=n>r?n:r):l?(d=s?r:n,u=void 0):c&&(d=0,u=s?n:r),t.__text=t.__text.slice(d,u)}}return t}function Ea(e){const t=e.getStyle(),n=wa(t);Sa.set(t,n)}function Na(e){const t=e.anchor.getNode(),n=qi(t)?t:t.getParentOrThrow(),r=To().getElementByKey(n.getKey());if(null===r)return!1;const i=r.ownerDocument.defaultView;return null!==i&&"vertical-rl"===i.getComputedStyle(r).writingMode}function Aa(e,t){const n=Na(e)?!t:t,r=ca(e.focus,n?"previous":"next");if(ba(r))return!1;for(const e of ta(r)){if(Ho(e))return!e.origin.isInline();if(!Ui(e.origin)){if(Ki(e.origin))return!0;break}}return!1}function La(e,t,n){const r=function(e){const t=e.anchor.getNode();return"rtl"===(qi(t)?t:t.getParentOrThrow()).getDirection()}(e);let i;i=Na(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,i,"character")}const Pa="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Fa=Pa&&"documentMode"in document?document.documentMode:null;function Oa(...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 Ia(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Ra(e,...t){const n=Oa(...t);n.length>0&&e.classList.add(...n)}function Ma(e,...t){const n=Oa(...t);n.length>0&&e.classList.remove(...n)}function Da(e){return e?e.getAdjacentCaret():null}function za(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function Ba(e){const t=$a(e,(e=>Ui(e)&&!e.isInline()));return Ui(t)||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.`)}(4,e.__key),t}Pa&&"InputEvent"in window&&!Fa&&new window.InputEvent("input");const $a=(e,t)=>{let n=e;for(;n!==Is()&&null!=n;){if(t(n))return n;n=n.getParent()}return null};function Ua(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Wa(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 Ha(e){let t=e.getParent();hl(t)||Wa(40);let n=t;for(;null!==n;)n=n.getParent(),hl(n)&&(t=n);return t}function Ka(e){let t=[];const n=e.getChildren().filter(sl);for(let e=0;e0&&e.append(...i),t.remove()}function Xa(e){const t=new Set;if(ja(e)||t.has(e.getKey()))return;const n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(ja(r)&&ja(i)){const n=i.getFirstChild();if(hl(n)){n.append(e);const i=r.getFirstChild();hl(i)&&(Ga(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(ja(r)){const t=r.getFirstChild();if(hl(t)){const n=t.getFirstChild();null!==n&&n.insertBefore(e)}}else if(ja(i)){const t=i.getFirstChild();hl(t)&&t.append(e)}else if(hl(n)){const t=il().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),s=dl(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());t.append(s),s.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Qa(e){if(ja(e))return;const t=e.getParent(),n=t?t.getParent():void 0;if(hl(n?n.getParent():void 0)&&sl(n)&&hl(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=il(),s=dl(r);i.append(s),e.getPreviousSiblings().forEach((e=>s.append(e)));const o=il(),a=dl(r);o.append(a),Ga(a,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(e)}}}function el(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}let tl=class e extends $i{static getType(){return"listitem"}static clone(t){return new e(t.__value,t.__checked,t.__key)}constructor(e,t,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){const r=this.getParent();hl(r)&&"check"===r.getListType()&&function(e,t,n){hl(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=[],s=t.list,o=s?s.listitem:void 0;let a;if(s&&s.nested&&(a=s.nested.listitem),void 0!==o&&r.push(...el(o)),s){const e=n.getParent(),t=hl(e)&&"check"===e.getListType(),o=n.getChecked();t&&!o||i.push(s.listitemUnchecked),t&&o||i.push(s.listitemChecked),t&&r.push(o?s.listitemChecked:s.listitemUnchecked)}if(void 0!==a){const e=el(a);n.getChildren().some((e=>hl(e)))?r.push(...e):i.push(...e)}i.length>0&&Ma(e,...i),r.length>0&&Ra(e,...r)}(t,n.theme,this);const i=e?e.__style:"",s=this.__style;i!==s&&(""===s?t.removeAttribute("style"):t.style.cssText=s),function(e,t,n){const r=Ca(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in Ca(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}static transform(){return e=>{if(sl(e)||Wa(144),null==e.__checked)return;const t=e.getParent();hl(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:nl,priority:0})}}static importJSON(e){return il().updateFromJSON(e)}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.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(hl(n)||Wa(39),sl(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const i=dl(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&&ja(t)&&ja(n)&&(Ya(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=il().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=ss();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=sl(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,i=e.focus,s=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(s,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(s,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 hl(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(;sl(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&Wa(117),(e=Math.floor(e))>=0||Wa(199);let t=this.getIndent();for(;t!==e;)t{hl(e)||Wa(163),function(e){const t=e.getNextSibling();hl(t)&&e.getListType()===t.getListType()&&Ya(e,t)}(e),function(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())sl(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),hl(r.getFirstChild())||n++)}(e)}}static importDOM(){return{ol:()=>({conversion:cl,priority:0}),ul:()=>({conversion:cl,priority:0})}}static importJSON(e){return dl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return bo(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;e1?r.push(...e):i.push(...e)}}i.length>0&&Ma(e,...i),r.length>0&&Ra(e,...r)}function ll(e){const t=[];for(let n=0;n1&&e.forEach((e=>{hl(e)&&t.push(qa(e))}))}else t.push(qa(r))}return t}function cl(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=dl("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list"))return!0;for(const t of e.childNodes)if(bo(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?dl("check"):dl("bullet")),{after:ll,node:n}}const ul={ol:"number",ul:"bullet"};function dl(e="number",t=1){return go(new ol(e,t))}function hl(e){return e instanceof ol}const gl=Ut("INSERT_UNORDERED_LIST_COMMAND"),pl=Ut("INSERT_ORDERED_LIST_COMMAND"),fl=Ut("REMOVE_LIST_COMMAND");function ml(e){return Ia(e.registerCommand(pl,(()=>(Va("number"),!0)),1),e.registerCommand(gl,(()=>(Va("bullet"),!0)),1),e.registerCommand(fl,(()=>(function(){const e=ii();if(Ur(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(Ja(r,n))t.add(Ha(r));else for(let e=0;efunction(){const e=ii();if(!Ur(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!sl(t)||0!==t.getChildrenSize())return!1;const n=Ha(t),r=t.getParent();hl(r)||Wa(40);const i=r.getParent();let s;if(ho(i))s=ss(),n.insertAfter(s);else{if(!sl(i))return!1;s=il(),i.insertAfter(s)}s.setTextStyle(e.style).setTextFormat(e.format).select();const o=t.getNextSiblings();if(o.length>0){const e=dl(r.getListType());if(sl(s)){const t=il();t.append(e),s.insertAfter(t)}else s.insertAfter(e);e.append(...o)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!sl(e)&&!hl(e))break;t=e}t.remove()}(t),!0}()),1),e.registerNodeTransform(tl,(e=>{const t=e.getFirstChild();if(t){if(Pr(t)){const n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{const t=ii();Ur(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(kr,(e=>{const t=e.getParent();if(sl(t)&&e.is(t.getFirstChild())){const n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}function yl(e,t){const n=t.body?t.body.childNodes:[];let r=[];const i=[];for(let t=0;t{const e=new ns;return n.push(e),e}:ss)),null==a?h.length>0?o=o.concat(h):So(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(vo(e.nextSibling)&&vo(e.previousSibling))}(e)&&(o=o.concat(hr())):Ui(a)&&a.append(...h),o}function vl(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 Sl(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 wl(n,function(e){const t=[];for(let n=0;ne}).createHTML(e):e}(i),"text/html")),t)}catch(e){}const o=s||e.getData("text/uri-list");if(null!=o)if(Ur(t)){const e=o.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t0?l.text=e:i=!1}for(let r=0;r{e.update((()=>{r(Nl(e,t,n))}))}));const r=e.getRootElement(),i=e._window||window,s=window.document,o=yo(i);if(null===r||null===o)return!1;const a=s.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(s.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),o.removeAllRanges(),o.addRange(l),new Promise(((t,r)=>{const i=e.registerCommand(wn,(r=>(Ua(r,ClipboardEvent)&&(i(),null!==Tl&&(window.clearTimeout(Tl),Tl=null),t(Nl(e,r,n))),!0)),4);Tl=window.setTimeout((()=>{i(),Tl=null,t(!1)}),50),s.execCommand("copy"),a.remove()}))}function Nl(e,t,n){if(void 0===n){const t=yo(e._window);if(!t)return!1;const r=t.anchorNode,i=t.focusNode;if(null!==r&&null!==i&&!ps(e,r,i))return!1;const s=ii();if(null===s)return!1;n=function(e=ii()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=To();for(const[r,i]of Al){const s=i(n,e);null!==s&&(t[r]=s)}}return t}(s)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Al=[["text/html",function(e,t=ii()){return null==t&&vl(166),Ur(t)&&t.isCollapsed()||0===t.getNodes().length?"":_l(e,t)}],["application/x-lexical-editor",function(e,t=ii()){return null==t&&vl(166),Ur(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=Is().getChildren();for(let i=0;i({conversion:jl,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(bo(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 $l().updateFromJSON(e)}insertNewAfter(e,t){const n=ss(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=ss();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function $l(){return go(new Bl)}function Ul(e){return e instanceof Bl}let Wl=class e extends $i{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){Ra(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Kl,priority:0}),h2:e=>({conversion:Kl,priority:0}),h3:e=>({conversion:Kl,priority:0}),h4:e=>({conversion:Kl,priority:0}),h5:e=>({conversion:Kl,priority:0}),h6:e=>({conversion:Kl,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Hl(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Hl(e)?{conversion:e=>({node:ql("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(bo(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 ql(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?ss():ql(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,t),0===n&&!this.isEmpty()&&e){const e=ss();e.select(),this.replace(e,!0)}return i}collapseAtStart(){const e=this.isEmpty()?ss():ql(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function Hl(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function Kl(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=ql(t),null!==e.style&&(Po(e,n),n.setFormat(e.style.textAlign))),{node:n}}function jl(e){const t=$l();return null!==e.style&&(t.setFormat(e.style.textAlign),Po(e,t)),{node:t}}function ql(e="h1"){return go(new Wl(e))}function Jl(e){return e instanceof Wl}function Vl(e){let t=null;if(Ua(e,DragEvent)?t=e.dataTransfer:Ua(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 Gl(e){const t=ii();if(!Ur(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;tUi(e)&&!e.isInline()));if(null===o)continue;const a=o.getKey();o.canIndent()&&!n.has(a)&&(n.add(a),e(o))}return n.size>0}function Zl(e){return Ki(Ps(e))}function Yl(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function Xl(e){return Ia(e.registerCommand(Kt,(e=>{const t=ii();return!!Hr(t)&&(t.clear(),!0)}),0),e.registerCommand(jt,(e=>{const t=ii();return Ur(t)?(t.deleteCharacter(e),!0):!!Hr(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(Yt,(e=>{const t=ii();return!!Ur(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(Xt,(e=>{const t=ii();return!!Ur(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Vt,(t=>{const n=ii();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Sl(r,n,e);else if(Ur(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(Zt,(()=>{const e=ii();return!!Ur(e)&&(e.removeText(),!0)}),0),e.registerCommand(Qt,(e=>{const t=ii();return!!Ur(t)&&(t.formatText(e),!0)}),0),e.registerCommand(xn,(e=>{const t=ii();if(!Ur(t)&&!Hr(t))return!1;const n=t.getNodes();for(const t of n){const n=$a(t,(e=>Ui(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(qt,(e=>{const t=ii();return!!Ur(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(Jt,(()=>{const e=ii();return!!Ur(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(mn,(()=>(di([Ir()]),!0)),0),e.registerCommand(yn,(()=>Gl((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(_n,(()=>Gl((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(ln,(e=>{const t=ii();if(Hr(t)){const e=t.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(Ur(t)){const n=eo(t.focus,!0);if(!e.shiftKey&&Ki(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(cn,(e=>{const t=ii();if(Hr(t)){const e=t.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(Ur(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===Is().getChildrenSize()}(t))return e.preventDefault(),!0;const n=eo(t.focus,!1);if(!e.shiftKey&&Ki(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(on,(e=>{const t=ii();if(Hr(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}if(!Ur(t))return!1;if(Aa(t,!0)){const n=e.shiftKey;return e.preventDefault(),La(t,n,!0),!0}return!1}),0),e.registerCommand(rn,(e=>{const t=ii();if(Hr(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}if(!Ur(t))return!1;const n=e.shiftKey;return!!Aa(t,!1)&&(e.preventDefault(),La(t,n,!1),!0)}),0),e.registerCommand(hn,(t=>{if(Zl(t.target))return!1;const n=ii();if(Ur(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(qi(n))return!1;const r=Ba(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(_n,void 0);if(Rl&&"ko-KR"===navigator.language)return!1}else if(!Hr(n))return!1;return t.preventDefault(),e.dispatchCommand(jt,!0)}),0),e.registerCommand(pn,(t=>{if(Zl(t.target))return!1;const n=ii();return!(!Ur(n)&&!Hr(n))&&(t.preventDefault(),e.dispatchCommand(jt,!1))}),0),e.registerCommand(un,(t=>{const n=ii();if(!Ur(n))return!1;if(Yl(n),null!==t){if((Rl||Il||Dl)&&Ol)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(qt,!1)}return e.dispatchCommand(Jt,void 0)}),0),e.registerCommand(gn,(()=>!!Ur(ii())&&(e.blur(),!0)),0),e.registerCommand(bn,(t=>{const[,n]=Vl(t);if(n.length>0){const r=Ll(t.clientX,t.clientY);if(null!==r){const{offset:t,node:i}=r,s=Ps(i);if(null!==s){const e=ti();if(Pr(s))e.anchor.set(s.getKey(),t,"text"),e.focus.set(s.getKey(),t,"text");else{const t=s.getParentOrThrow().getKey(),n=s.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Ms(it(e))}e.dispatchCommand(zl,n)}return t.preventDefault(),!0}return!!Ur(ii())}),0),e.registerCommand(kn,(e=>{const[t]=Vl(e),n=ii();return!(t&&!Ur(n))}),0),e.registerCommand(vn,(e=>{const[t]=Vl(e),n=ii();if(t&&!Ur(n))return!1;const r=Ll(e.clientX,e.clientY);if(null!==r){Ki(Ps(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(Tn,(()=>(function(e){const t=Is();if(Ur(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"),it(e),e}{const e=t.select(0,t.getChildrenSize());Ms(it(e))}}(),!0)),0),e.registerCommand(wn,(t=>(El(e,Ua(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Cn,(t=>(async function(e,t){await El(t,Ua(e,ClipboardEvent)?e:null),t.update((()=>{const e=ii();Ur(e)?e.removeText():Hr(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(Gt,(t=>{const[,n,r]=Vl(t);return n.length>0&&!r?(e.dispatchCommand(zl,n),!0):(!xo(t.target)||!gs(t.target))&&(null!==ii()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=ii(),r=Ua(e,InputEvent)||Ua(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Sl(r,n,t)}),{tag:"paste"})}(t,e),!0))}),0),e.registerCommand(dn,(e=>{const t=ii();return Ur(t)&&Yl(t),!1}),0),e.registerCommand(fn,(e=>{const t=ii();return Ur(t)&&Yl(t),!1}),0))}var Ql=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 s?new s(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);S+=v.value.length,v=v.next){var w=v.value;if(t.length>e.length)return;if(!(w instanceof s)){var C,T=1;if(_){if(!(C=o(k,S,e,y))||C.index>=e.length)break;var E=C.index,N=C.index+C[0].length,A=S;for(A+=v.value.length;E>=A;)A+=(v=v.next).value.length;if(S=A-=v.value.length,v.value instanceof s)continue;for(var L=v;L!==t.tail&&(Ad.reach&&(d.reach=I);var R=v.prev;if(F&&(R=c(t,R,F),S+=F.length),u(t,R,T),v=c(t,R,new s(h,m?i.tokenize(P,m):P,b,P)),O&&c(t,v,O),T>1){var M={cause:h+","+p,reach:I};a(e,t,n,v.prev,S,M),d&&M.reach>d.reach&&(d.reach=M.reach)}}}}}}function l(){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"+s.content+""},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,s=n.code,o=n.immediateClose;e.postMessage(i.highlight(s,i.languages[r],r)),o&&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:{}); /** * Prism: Lightweight, robust, elegant syntax highlighting * @@ -7,4 +7,4 @@ import{DirectUpload as e}from"@rails/activestorage"; * @author Lea Verou * @namespace * @public - */function ec(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.`)}"undefined"!=typeof module&&module.exports&&(module.exports=Ql),"undefined"!=typeof global&&(global.Prism=Ql),Ql.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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]},Ql.languages.markup.tag.inside["attr-value"].inside.entity=Ql.languages.markup.entity,Ql.languages.markup.doctype.inside["internal-subset"].inside=Ql.languages.markup,Ql.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Ql.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Ql.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Ql.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Ql.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Ql.languages.markup.tag,"addAttribute",{value:function(e,t){Ql.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:Ql.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Ql.languages.html=Ql.languages.markup,Ql.languages.mathml=Ql.languages.markup,Ql.languages.svg=Ql.languages.markup,Ql.languages.xml=Ql.languages.extend("markup",{}),Ql.languages.ssml=Ql.languages.xml,Ql.languages.atom=Ql.languages.xml,Ql.languages.rss=Ql.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"))}(Ql),Ql.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:/[{}[\];(),.:]/},Ql.languages.javascript=Ql.languages.extend("clike",{"class-name":[Ql.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}|\?\?=?|\?\.?|[~:]/}),Ql.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Ql.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:Ql.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:Ql.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Ql.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Ql.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:Ql.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Ql.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:Ql.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"}}),Ql.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Ql.languages.markup&&(Ql.languages.markup.tag.addInlined("script","javascript"),Ql.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")),Ql.languages.js=Ql.languages.javascript,function(){if(void 0!==Ql&&"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",n="loading",r="loaded",i="pre[data-src]:not(["+t+'="'+r+'"]):not(['+t+'="'+n+'"])';Ql.hooks.add("before-highlightall",(function(e){e.selector+=", "+i})),Ql.hooks.add("before-sanity-check",(function(s){var o=s.element;if(o.matches(i)){s.code="",o.setAttribute(t,n);var a=o.appendChild(document.createElement("CODE"));a.textContent="Loading…";var l=o.getAttribute("data-src"),c=s.language;if("none"===c){var u=(/\.(\w+)$/.exec(l)||[,"none"])[1];c=e[u]||u}Ql.util.setLanguage(a,c),Ql.util.setLanguage(o,c);var d=Ql.plugins.autoloader;d&&d.loadLanguages(c),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)}(l,(function(e){o.setAttribute(t,r);var n=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]}}(o.getAttribute("data-range"));if(n){var i=e.split(/\r\n?|\n/g),s=n[0],l=null==n[1]?i.length:n[1];s<0&&(s+=i.length),s=Math.max(0,Math.min(s-1,i.length)),l<0&&(l+=i.length),l=Math.max(0,Math.min(l,i.length)),e=i.slice(s,l).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(s+1))}a.textContent=e,Ql.highlightElement(a)}),(function(e){o.setAttribute(t,"failed"),a.textContent=e}))}})),Ql.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(i),r=0;t=n[r++];)Ql.highlightElement(t)}};var s=!1;Ql.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),Ql.plugins.fileHighlight.highlight.apply(this,arguments)}}}(),Prism.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:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.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}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.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:Prism.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:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.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:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.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:Prism.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"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.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")),Prism.languages.js=Prism.languages.javascript,Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.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:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//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})),s=/\|?[ \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+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),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__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\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(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.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",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),Prism.languages.c=Prism.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|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.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},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.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:Prism.languages.c}}}}),Prism.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 Prism.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"))}(Prism),Prism.languages.objectivec=Prism.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 Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec,Prism.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:/[;[\]()`,.]/},function(e){var t=e.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:/[|{}[\];(),.]/};t.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:t},boolean:t.boolean,variable:t.variable}}(Prism),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,n=0;n<2;n++)t=t.replace(//g,(function(){return t}));t=t.replace(//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}(Prism),Prism.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:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=Prism.languages.swift})),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}(Prism),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+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,(function(){return t.source}))),lookbehind:!0,inside:{punctuation:/\./}}})}(Prism),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(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//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+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//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"])}(Prism);const tc=globalThis.Prism||window.Prism,nc=e=>{try{return!!e&&tc.languages.hasOwnProperty(e)}catch(e){return!1}};function rc(e,t){for(const n of e.childNodes){if(bo(n)&&n.tagName===t)return!0;rc(n,t)}return!1}const ic="data-language",sc="data-highlight-language";let oc=class e extends $i{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=nc(e)}createDOM(e){const t=document.createElement("code");Ra(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(ic,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(sc,n)),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;return r?r!==i&&(t.setAttribute(ic,r),this.__isSyntaxHighlightSupported&&t.setAttribute(sc,r)):i&&(t.removeAttribute(ic),e.__isSyntaxHighlightSupported&&t.removeAttribute(sc)),!1}exportDOM(e){const t=document.createElement("pre");Ra(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(ic,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(sc,n)),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||rc(e,"BR"))?{conversion:cc,priority:1}:null,div:()=>({conversion:uc,priority:1}),pre:()=>({conversion:cc,priority:0}),table:e=>pc(e)?{conversion:dc,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&pc(n)?{conversion:hc,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&pc(t)?{conversion:hc,priority:3}:null}}}static importJSON(e){return ac().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}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=ss();return this.insertAfter(e,t),e}const{anchor:i,focus:s}=e,o=(i.isBefore(s)?i:s).getNode();if(Pr(o)){let e=vc(o);const t=[];for(;;)if(Rr(e))t.push(Ir()),e=e.getNextSibling();else{if(!xc(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;ne.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t.__isSyntaxHighlightSupported=nc(e),t}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function ac(e){return go(new oc(e))}function lc(e){return e instanceof oc}function cc(e){return{node:ac(e.getAttribute(ic))}}function uc(e){const t=e,n=gc(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(gc(t))return!0;t=t.parentElement}return!1}(t)?{node:n?ac():null}:{node:null}}function dc(){return{node:ac()}}function hc(){return{node:null}}function gc(e){return null!==e.style.fontFamily.match("monospace")}function pc(e){return e.classList.contains("js-file-line-container")}const fc={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"},mc={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};class yc extends kr{constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(e){return new yc(e.__text,e.__highlightType||void 0,e.__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 Ra(t,_c(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=_c(n.theme,e.__highlightType),s=_c(n.theme,this.__highlightType);return i!==s&&(i&&Ma(t,i),s&&Ra(t,s)),r}static importJSON(e){return bc().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 ac()}}function _c(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function bc(e="",t){return go(new yc(e,t))}function xc(e){return e instanceof yc}function kc(e,t){let n=e;for(let r=Jo(e,t);r&&(xc(r.origin)||Rr(r.origin));r=Da(r))n=r.origin;return n}function vc(e){return kc(e,"previous")}function Sc(e){return kc(e,"next")}const wc={defaultLanguage:"javascript",tokenize(e,t){return tc.tokenize(e,tc.languages[t||""]||tc.languages[this.defaultLanguage])}};function Cc(e,t,n){const r=e.getParent();lc(r)?Nc(r,t,n):xc(e)&&e.replace(Lr(e.__text))}function Tc(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 s="1",o=1;for(let e=0;e{!function(e,t){const n=Ns(e);if(!lc(n)||!n.isAttached())return;const r=ii();if(!Ur(r))return void t();const i=r.anchor,s=i.offset,o="element"===i.type&&gr(n.getChildAtIndex(i.offset-1));let a=0;if(!o){const e=i.getNode();a=s+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(o?i.getNode().select(s,s):n.getChildren().some((e=>{const t=Pr(e);if(t||gr(e)){const n=e.getTextContentSize();if(t&&n>=a)return e.select(a,a),!0;a-=n}return!1})))}(r,(()=>{const t=Ns(r);if(!lc(t)||!t.isAttached())return!1;const i=t.getTextContent(),s=Ac(n.tokenize(i,t.getLanguage()||n.defaultLanguage)),o=function(e,t){let n=0;for(;n{Ec.delete(r)},skipTransforms:!0}))}function Ac(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;r0&&n.push(bc(i,t))}}else{const{content:e}=r;"string"==typeof e?n.push(...Ac([e],r.type)):Array.isArray(e)&&n.push(...Ac(e,r.type))}return n}function Lc(e,t){return xc(e)&&xc(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||Rr(e)&&Rr(t)||gr(e)&&gr(t)}function Pc(e){if(!Ur(e))return!1;const t=e.anchor.getNode(),n=lc(t)?t:t.getParent(),r=e.focus.getNode(),i=lc(r)?r:r.getParent();return lc(n)&&n.is(i)}function Fc(e){const t=e.getNodes(),n=[];if(1===t.length&&lc(t[0]))return n;let r=[];for(let e=0;e0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=Dr(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function Oc(e){const t=ii();if(!Ur(t)||!Pc(t))return!1;const n=Fc(t),r=n.length;if(0===r&&t.isCollapsed())return e===yn&&t.insertNodes([Ir()]),!0;if(0===r&&e===yn&&"\n"===t.getTextContent()){const e=Ir(),n=hr(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),da(ka(na(Vo(e,"next",0),_a(Jo(n,"next"))),r)),!0}for(let i=0;i0){let n=r[0];if(0===i&&(n=vc(n)),e===yn){const e=Ir();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=Dr(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else Rr(n)&&n.remove()}}return!0}function Ic(e,t){const n=ii();if(!Ur(n))return!1;const{anchor:r,focus:i}=n,s=r.offset,o=i.offset,a=r.getNode(),l=i.getNode(),c=e===ln;if(!Pc(n)||!xc(a)&&!Rr(a)||!xc(l)&&!Rr(l))return!1;if(!t.altKey){if(n.isCollapsed()){const e=a.getParentOrThrow();if(c&&0===s&&null===a.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&s===a.getTextContentSize()&&null===a.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(a.isBefore(l)?(u=vc(a),d=Sc(l)):(u=vc(l),d=Sc(a)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;ee.remove())),e===ln?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(a,s,l,o),!0}function Rc(e,t){const n=ii();if(!Ur(n))return!1;const{anchor:r,focus:i}=n,s=r.getNode(),o=i.getNode(),a=e===an;if(!Pc(n)||!xc(s)&&!Rr(s)||!xc(o)&&!Rr(o))return!1;if(a){const e=function(e,t){let n=null,r=null,i=e,s=t,o=e.getTextContent();for(;;){if(0===s){if(i=i.getPreviousSibling(),null===i)break;if(xc(i)||Rr(i)||gr(i)||ec(167),gr(i)){n={node:i,offset:1};break}s=Math.max(0,i.getTextContentSize()-1),o=i.getTextContent()}else s--;const e=o[s];xc(i)&&" "!==e&&(r={node:i,offset:s})}if(null!==r)return r;let a=null;if(t({conversion:zc,priority:1})}}static importJSON(e){return Bc().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=Vc(e);try{const t=new URL(Vc(e));if(!Mc.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=Bc(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(!Ur(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 zc(e){let t=null;if(_o(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=Bc(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Bc(e="",t){return go(new Dc(e,t))}function $c(e){return e instanceof Dc}let Uc=class e extends Dc{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 Wc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(Ui(n)){const e=Wc(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}};function Wc(e="",t){return go(new Uc(e,t))}function Hc(e){return e instanceof Uc}function Kc(e,t){if("element"===e.type){const n=e.getNode();return Ui(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 jc(e,t={}){const{target:n,title:r}=t,i=void 0===t.rel?"noreferrer":t.rel,s=ii();if(null===s||!Ur(s)&&!Hr(s))return;if(Hr(s)){const t=s.getNodes();if(0===t.length)return;return void t.forEach((t=>{if(null===e){const e=$a(t,(e=>!Hc(e)&&$c(e)));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove())}else{const r=$a(t,(e=>!Hc(e)&&$c(e)));if(r)r.setURL(e),void 0!==n&&r.setTarget(n),void 0!==i&&r.setRel(i);else{const r=Bc(e,{rel:i,target:n});t.insertBefore(r),r.append(t)}}}))}const o=s.extract();if(null===e)return void o.forEach((e=>{const t=$a(e,(e=>!Hc(e)&&$c(e)));if(t){const e=t.getChildren();for(let n=0;n{a.has(t.getKey())||(a.add(t.getKey()),t.setURL(e),void 0!==n&&t.setTarget(n),void 0!==i&&t.setRel(i),void 0!==r&&t.setTitle(r))};if(1===o.length){const e=qc(o[0],$c);if(null!==e)return l(e)}!function(e){const t=ii();if(!Ur(t))return e();const n=it(t),r=n.isBackward(),i=Kc(n.anchor,r?-1:0),s=Kc(n.focus,r?0:-1);if(e(),i||s){const e=ii();if(Ur(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(s){const e=s.getParent();e&&t.focus.set(e.getKey(),s.getIndexWithinParent()+(r?0:1),"element")}Ms(it(t))}}}((()=>{let t=null;for(const s of o){if(!s.isAttached())continue;const o=qc(s,$c);if(o){l(o);continue}if(Ui(s)){if(!s.isInline())continue;if($c(s)){if(!(Hc(s)||null!==t&&t.getParentOrThrow().isParentOf(s))){l(s),t=s;continue}for(const e of s.getChildren())s.insertBefore(e);s.remove();continue}}const a=s.getPreviousSibling();$c(a)&&a.is(t)?a.append(s):(t=Bc(e,{rel:i,target:n,title:r}),s.insertAfter(t),t.append(s))}}))}function qc(e,t){let n=e;for(;null!==n&&null!==n.getParent()&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}const Jc=/^\+?[0-9\s()-]{5,}$/;function Vc(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:Jc.test(e)?`tel:${e}`:`https://${e}`}function Gc(e){let t=e;for(;null!==t;){if(sl(t))return t;t=t.getParent()}return null}function Zc(e){let t=e;for(;t;){if(hl(t))return t.getListType();t=t.getParent()}return null}class Yc extends HTMLElement{constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar"}connectedCallback(){requestAnimationFrame((()=>this.#e())),this._resizeObserver=new ResizeObserver((()=>this.#e())),this._resizeObserver.observe(this)}disconnectedCallback(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.#t(),this.#n(),this.#r(),this.#i(),this.#s(),this.#e()}#t(){this.addEventListener("click",this.#o.bind(this))}#o({target:e}){this.#a(e,"[data-command]",this.#l.bind(this)),this.#a(e,"[data-dialog-target]",this.#c.bind(this))}#a(e,t,n){const r=e.closest(t);r&&n(r)}#l(e){const{command:t,payload:n}=e.dataset;this.editor.dispatchCommand(t,n)}#c(e){const t=document.getElementById(e.dataset.dialogTarget).parentNode;t.open?t.close():t.show()}#n(){this.editorElement.addEventListener("keydown",(e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#u(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))}))}#u(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("+")}#r(){const e=parseInt(this.editorElement.editorContentElement.getAttribute("tabindex")??"0");this.#d.forEach(((t,n)=>{t.setAttribute("tabindex",`${e+n+1}`)}))}#i(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#h()}))}))}#s(){this.editor.registerUpdateListener((()=>{this.#g()}))}#g(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#p("undo",0===e.undoStack.length),this.#p("redo",0===e.redoStack.length))}))}#p(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#h(){const e=ii();if(!Ur(e))return;const t=e.anchor.getNode();if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e.hasFormat("bold"),i=e.hasFormat("italic"),s=e.hasFormat("strikethrough"),o=lc(n)||e.hasFormat("code"),a=this.#f(t),l=Zc(t),c=Ul(n),u=Jl(n),d=this.#m(t);this.#y("bold",r),this.#y("italic",i),this.#y("strikethrough",s),this.#y("code",o),this.#y("unordered-list",a&&"bullet"===l),this.#y("ordered-list",a&&"number"===l),this.#y("quote",c),this.#y("heading",u),this.#y("link",d),this.#g()}#_(e){return e.getNodes().some((e=>{if(xc(e))return!0;if(Pr(e)){const t=e.getParent();if(t&&xc(t))return!0}return!1}))}#f(e){let t=e;for(;t;){if(hl(t)||sl(t))return!0;t=t.getParent()}return!1}#m(e){let t=e;for(;t;){if($c(t))return!0;t=t.getParent()}return!1}#y(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#b(){return this.scrollWidth>this.clientWidth}#e=()=>{this.#x(),this.#k(),this.#v.style.display=this.#S.children.length?"block":"none",this.#v.setAttribute("nonce",va())};get#v(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#S(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}#x(){for(;this.#S.children.length>0;)this.insertBefore(this.#S.children[0],this.#v)}#k(){const e=this.#d.reverse();let t=!1;for(const n of e){if(!this.#b()){t&&this.#S.prepend(n);break}this.#S.prepend(n),t=!0}}get#d(){return Array.from(this.querySelectorAll(":scope > button, :scope > [role=separator]"))}static get defaultTemplate(){return'\n \n\n \n\n \n\n \n\n \n \n
\n \n
\n \n \n
\n
\n
\n
\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n\n \n\n
\n •••\n
\n
\n '}}function Xc(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}customElements.define("lexxy-toolbar",Yc);const Qc=/[!-/:-@[-`{-~\s]/;function eu(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 tu(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(nu(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function nu(e,t,n,r,i){for(let s=0;se.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=Xc(n.textFormat,(({tag:e})=>e[e.length-1])),i=Xc(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)||eu(173,n.getType())}}const s=(e,t,s)=>{(function(e,t,n,r){if(!ho(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:s,replace:o}of r){const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,!1))return s.remove(),!0}}return!1})(e,t,s,n.element)||function(e,t,n,r){if(!ho(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExpStart:s,replace:o,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,null,null,!1))return s.remove(),!0}}return!1}(e,t,s,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t1&&!nu(r,a,n,0,o))continue;if(" "===r[a-1])continue;const l=r[i+1];if(!1===t.intraword&&l&&!Qc.test(l))continue;const c=e;let u=c,d=tu(r,a,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!gr(h);)if(Pr(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=tu(e,e.length,n)}if(d<0)continue;if(u===c&&d+o===a)continue;const g=u.getTextContent();if(d>0&&g[d-1]===s)continue;const p=g[d-1];if(!1===t.intraword&&p&&!Qc.test(p))continue;const f=c.getTextContent(),m=f.slice(0,a)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+o));const _=ii(),b=ti();Ms(b);const x=i-o*(u===c?2:1)+1;b.anchor.set(u.__key,d,"text"),b.focus.set(c.__key,x,"text");for(const e of t.format)b.hasFormat(e)||b.formatText(e);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const e of t.format)b.hasFormat(e)&&b.toggleFormat(e);return Ur(_)&&(b.format=_.format),!0}}(t,s,r)};return e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(Qi)||t.has(Yi))return;if(e.isComposing())return;const o=r.read(ii),a=i.read(ii);if(!Ur(a)||!Ur(o)||!o.isCollapsed()||o.is(a))return;const l=o.anchor.key,c=o.anchor.offset,u=r._nodeMap.get(l);!Pr(u)||!n.has(l)||1!==c&&c>a.anchor.offset+1||e.update((()=>{if(!function(e){return Pr(e)&&!e.hasFormat("code")}(u))return;const e=u.getParent();null===e||lc(e)||s(e,u,o.anchor.offset)}))}))}const iu=e=>(t,n,r,i)=>{const s=e(r);s.append(...n),t.replace(s),i||s.select(0,0)},su=e=>(t,n,r,i)=>{const s=t.getPreviousSibling(),o=t.getNextSibling(),a=il("check"===e?"x"===r[3]:void 0);if(hl(o)&&o.getListType()===e){const e=o.getFirstChild();null!==e?e.insertBefore(a):o.append(a),t.remove()}else if(hl(s)&&s.getListType()===e)s.append(a),t.remove();else{const n=dl(e,"number"===e?Number(r[2]):void 0);n.append(a),t.replace(n)}a.append(...n),i||a.select(0,0);const l=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]);l&&a.setIndent(l)},ou=(e,t,n)=>{const r=[],i=e.getChildren();let s=0;for(const o of i)if(sl(o)){if(1===o.getChildrenSize()){const e=o.getFirstChild();if(hl(e)){r.push(ou(e,t,n+1));continue}}const i=" ".repeat(4*n),a=e.getListType(),l="number"===a?`${e.getStart()+s}. `:"check"===a?`- [${o.getChecked()?"x":" "}] `:"- ";r.push(i+l+t(o)),s++}return r.join("\n")},au={dependencies:[Wl],export:(e,t)=>{if(!Jl(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:iu((e=>ql("h"+e[1].length))),type:"element"},lu={dependencies:[Bl],export:(e,t)=>{if(!Ul(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(Ul(n))return n.splice(n.getChildrenSize(),0,[hr(),...t]),void e.remove()}const i=$l();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},cu={dependencies:[oc],export:e=>{if(!lc(e))return null;const t=e.getTextContent();return"```"+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n```"},regExpEnd:{optional:!0,regExp:/[ \t]*```$/},regExpStart:/^[ \t]*```(\w+)?/,replace:(e,t,n,r,i,s)=>{let o,a;if(!t&&i){if(1===i.length)r?(o=ac(),a=n[1]+i[0]):(o=ac(n[1]),a=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{if(o=ac(n[1]),0===i[0].trim().length)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(" ")?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();a=i.join("\n")}const t=Lr(a);o.append(t),e.append(o)}else t&&iu((e=>ac(e?e[1]:void 0)))(e,t,n,s)},type:"multiline-element"},uu={dependencies:[ol,tl],export:(e,t)=>hl(e)?ou(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:su("bullet"),type:"element"},du={dependencies:[ol,tl],export:(e,t)=>hl(e)?ou(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:su("number"),type:"element"},hu={dependencies:[Dc],export:(e,t,n)=>{if(!$c(e)||Hc(e))return null;const r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{const[,n,r,i]=t,s=Bc(r,{title:i}),o=Lr(n);return o.setFormat(e.getFormat()),s.append(o),e.replace(s),o},trigger:")",type:"text-match"},gu=[...[au,lu,uu,du],...[cu],...[{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"}],...[hu]];function pu(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const s=t._selection,o=e._selection;if(i)return 1;if(!(Ur(s)&&Ur(o)&&o.isCollapsed()&&s.isCollapsed()))return 0;const a=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||qi(n)||i.push(n)}return i}(t,n,r);if(0===a.length)return 0;if(a.length>1){const n=t._nodeMap,r=n.get(s.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Pr(r)&&1===r.__text.length&&1===s.anchor.offset?2:0}const l=a[0],c=e._nodeMap.get(l.__key);if(!Pr(c)||!Pr(l)||c.__mode!==l.__mode)return 0;const u=c.__text,d=l.__text;if(u===d)return 0;const h=s.anchor,g=o.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}function fu(e,t){let n=Date.now(),r=0;return(i,s,o,a,l,c)=>{const u=Date.now();if(c.has(Yi))return r=0,n=u,2;const d=pu(i,s,a,l,e.isComposing()),h=(()=>{const h=null===o||o.editor===e,g=c.has("history-push");if(!g&&h&&c.has(Xi))return 0;if(null===i)return 1;const p=s._selection;return a.size>0||l.size>0?!1===g&&0!==d&&d===r&&ur.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(a)[0],i,s)?0:1:null!==p?0:2})();return n=u,r=d,h}}function mu(e){e.undoStack=[],e.redoStack=[],e.current=null}var yu={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline"},codeHighlight:{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__property",decorator:"code-token__function",deleted:"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__variable",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",namespace:"code-token__variable",number:"code-token__property",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation",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",url:"code-token__operator",variable:"code-token__variable"}};function _u(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]}`}const bu=["img","video","audio","iframe","embed","object","picture","source","canvas","svg","math","form","input","textarea","select","button","code","blockquote","hr"].join(","),xu=["a","action-text-attachment","b","blockquote","br","code","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","li","ol","p","pre","q","s","strong","ul"],ku=["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","title","url","width"];function vu(e,t){const n=document.createElement(e);for(const[e,r]of Object.entries(t||{}))e in n?n[e]=r:null!=r&&n.setAttribute(e,r);return n}function Su(e){return(new DOMParser).parseFromString(e,"text/html")}function wu(e,t,n){const r=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(r)}function Cu(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Tu(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}class Eu extends Hi{static getType(){return"action_text_attachment"}static clone(e){return new Eu({...e},e.__key)}static importJSON(e){return new Eu({...e})}static importDOM(){return{"action-text-attachment":e=>({conversion:()=>({node:new Eu({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:e=>({conversion:()=>({node:new Eu({src:e.getAttribute("src"),caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1})}}constructor({sgid:e,src:t,previewable:n,altText:r,caption:i,contentType:s,fileName:o,fileSize:a,width:l,height:c},u){super(u),this.sgid=e,this.src=t,this.previewable=n,this.altText=r||"",this.caption=i||"",this.contentType=s||"",this.fileName=o||"",this.fileSize=a,this.width=l,this.height=c}createDOM(){const e=this.createAttachmentFigure();return e.addEventListener("click",(t=>{this.#w(e)})),this.isPreviewableAttachment?(e.appendChild(this.#C()),e.appendChild(this.#T())):(e.appendChild(this.#E()),e.appendChild(this.#N())),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:vu("action-text-attachment",{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,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){return e=this.contentType,t=this.isPreviewableAttachment,n=this.fileName,vu("figure",{className:`attachment attachment--${t?"preview":"file"} attachment--${n?n.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":e});var e,t,n}get#A(){return(e=this.contentType).startsWith("image/")&&!e.includes("svg");var e}get isPreviewableAttachment(){return this.#A||this.previewable}#C(){return vu("img",{src:this.src,alt:this.altText,...this.#L})}get#L(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#E(){return vu("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#N(){const e=vu("figcaption",{className:"attachment__caption"}),t=vu("strong",{className:"attachment__name",textContent:this.caption||this.fileName}),n=vu("span",{className:"attachment__size",textContent:_u(this.fileSize)});return e.appendChild(t),e.appendChild(n),e}#w(e){wu(e,"lexxy:internal:select-node",{key:this.getKey()})}#T(){const e=vu("figcaption",{className:"attachment__caption"}),t=vu("input",{type:"text",class:"input",value:this.caption,placeholder:this.fileName});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",this.#P.bind(this)),t.addEventListener("keydown",this.#F.bind(this)),e.appendChild(t),e}#O(e){}#P(e){const t=e.target;t.placeholder=this.fileName,this.#I(t)}#I(e){wu(e,"lexxy:internal:invalidate-node",{key:this.getKey(),values:{caption:e.value}})}#F(e){"Enter"===e.key&&(this.#I(e.target),wu(e.target,"lexxy:internal:move-to-next-line"),e.preventDefault()),e.stopPropagation()}}class Nu extends Eu{static getType(){return"action_text_attachment_upload"}static clone(e){return new Nu({...e},e.__key)}constructor({file:e,uploadUrl:t,blobUrlTemplate:n,editor:r,progress:i},s){super({contentType:e.type},s),this.file=e,this.uploadUrl=t,this.blobUrlTemplate=n,this.src=null,this.editor=r,this.progress=i||0}createDOM(){const e=this.createAttachmentFigure();this.isPreviewableAttachment?e.appendChild(this.#C()):e.appendChild(this.#E()),e.appendChild(this.#R());const t=vu("progress",{value:this.progress,max:100});return e.appendChild(t),this.#M(e).then((()=>this.#D(t,e))),e}exportDOM(){const e=document.createElement("img");return this.src&&(e.src=this.src),{element:e}}#C(){return vu("img")}#E(){return vu("span",{className:"attachment__icon",textContent:this.#z()})}#z(){return this.file.name.split(".").pop().toLowerCase()}#R(){const e=vu("figcaption",{className:"attachment__caption"}),t=vu("span",{className:"attachment__name",textContent:this.file.name||""}),n=vu("span",{className:"attachment__size",textContent:_u(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#M(e){const t=e.querySelector("img");return t?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):Promise.resolve()}#D(t,n){const r=new e(this.file,this.uploadUrl,this);r.delegate={directUploadWillStoreFileWithXHR:e=>{e.upload.addEventListener("progress",(e=>{this.editor.update((()=>{t.value=Math.round(e.loaded/e.total*100)}))}))}},r.create(((e,t)=>{e?this.#B(n):this.#$(t,n).then((()=>{this.#U(n,t)}))}))}#B(e){e.innerHTML="",e.classList.add("attachment--error"),e.appendChild(vu("div",{innerText:`Error uploading ${this.file?.name??"image"}`}))}async#U(e,t){this.editor.update((()=>{const n=e.querySelector("img"),r=this.blobUrlTemplate.replace(":signed_id",t.signed_id).replace(":filename",encodeURIComponent(t.filename)),i=Ns(this.getKey());i&&i.replace(new Eu({sgid:t.attachable_sgid,src:t.previewable?t.url:r,altText:t.filename,contentType:t.content_type,fileName:t.filename,fileSize:t.byte_size,width:n?.naturalWidth,previewable:t.previewable,height:n?.naturalHeight}))}),{tag:Xi})}async#$(e,t){return e.previewable?new Promise((n=>{this.editor.update((()=>{const r=this.#C();r.addEventListener("load",(()=>{n()})),r.src=e.url,t.insertBefore(r,t.firstChild)}))})):Promise.resolve()}}class Au extends Hi{static getType(){return"horizontal_divider"}static clone(e){return new Au(e.__key)}static importJSON(e){return new Au}static importDOM(){return{hr:e=>({conversion:()=>({node:new Au}),priority:1})}}constructor(e){super(e)}createDOM(){const e=vu("figure",{className:"horizontal-divider"}),t=vu("hr");return e.addEventListener("click",(t=>{wu(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.appendChild(t),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:vu("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Lu=["bold","italic","strikethrough","link","unlink","rotateHeadingFormat","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","insertHorizontalDivider","uploadAttachments","undo","redo"];class Pu{static configureFor(e){new Pu(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#W(),this.#H()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(Qt,"bold")}dispatchItalic(){this.editor.dispatchCommand(Qt,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(Qt,"strikethrough")}dispatchLink(e){this.#K(e)}dispatchUnlink(){this.#K(null)}dispatchInsertUnorderedList(){const e=ii();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===Zc(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(gl,void 0)}dispatchInsertOrderedList(){const e=ii();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===Zc(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(pl,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleNodeWrappingAllSelectedLines((e=>Ul(e)),(()=>$l()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(Qt,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>lc(e)),(()=>new oc("plain")))}))}dispatchInsertHorizontalDivider(){this.editor.update((()=>{this.contents.insertAtCursor(new Au)}))}dispatchRotateHeadingFormat(){this.editor.update((()=>{const e=ii();if(!Ur(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(Jl(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>ql(n))):this.contents.removeFormattingFromSelectedLines()}))}dispatchUploadAttachments(){const e=vu("input",{type:"file",multiple:!0,onchange:({target:e})=>{const t=Array.from(e.files);if(t.length)for(const e of t)this.contents.uploadFile(e)}});document.body.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}dispatchUndo(){this.editor.dispatchCommand(en,void 0)}dispatchRedo(){this.editor.dispatchCommand(tn,void 0)}#W(){for(const t of Lu){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#j(t,0,this[n].bind(this))}var e;this.#j(Gt,1,this.dispatchPaste.bind(this))}#j(e,t,n){this.editor.registerCommand(e,n,t)}#K(e){this.editor.update((()=>{jc(null===e?null:e)}))}#H(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#q.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#J.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#V.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#G.bind(this)))}#V(e){this.dragCounter++,1===this.dragCounter&&this.editor.getRootElement().classList.add("lexxy-editor--drag-over")}#G(e){this.dragCounter--,0===this.dragCounter&&this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")}#q(e){e.preventDefault()}#J(e){e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);if(n.length){for(const e of n)this.contents.uploadFile(e);this.editor.focus()}}}function Fu(){return new Promise(requestAnimationFrame)}class Ou{constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#Z(),this.#Y(),this.#X(),this.#Q()}clear(){this.current=null}set current(e){Hr(e)?(this._current=ii(),this.#ee()):this.editor.update((()=>{this.#ee(),this._current=null}))}get current(){return this._current}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#te();if(!t)return;const n=this.#ne(t);n&&(e=this.#re(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{Is().selectEnd()}))}get hasSelectedWordsInSingleLine(){const e=ii();if(!Ur(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(){const e=ii();if(!Ur(e))return!1;return null!==Gc(e.anchor.getNode())}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#se(e,t):Ui(e)?this.#oe(e,t):this.#ae(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#le(e):Ui(e)?this.#oe(e,t):this.#ae(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#ce(e,t):Ui(e)?this.#ue(e,t):this.#de(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ie();return e?Pr(e)?this.#he(e):Ui(e)?this.#ue(e,t):this.#de(e):null}get#ge(){return this.editorElement.contents}get#pe(){if(this._currentlySelectedKeys)return this._currentlySelectedKeys;if(this._currentlySelectedKeys=new Set,this.current)for(const e of this.current.getNodes())this._currentlySelectedKeys.add(e.getKey());return this._currentlySelectedKeys}#Y(){this.editor.registerCommand(on,this.#fe.bind(this),1),this.editor.registerCommand(rn,this.#me.bind(this),1),this.editor.registerCommand(ln,this.#ye.bind(this),1),this.editor.registerCommand(cn,this.#_e.bind(this),1),this.editor.registerCommand(pn,this.#be.bind(this),1),this.editor.registerCommand(hn,this.#xe.bind(this),1),this.editor.registerCommand(Wt,(()=>{this.current=ii()}),1)}#Z(){this.editor.getRootElement().addEventListener("lexxy:internal:select-node",(async e=>{await Fu();const{key:t}=e.detail;this.editor.update((()=>{const e=Ns(t);if(e){const t=ni();t.add(e.getKey()),Ms(t)}this.editor.focus()}))})),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#ke()}))}#X(){this.editor.getRootElement().addEventListener("keydown",(e=>{(function(e){return!(e.ctrlKey||e.metaKey||e.altKey||e.key.length>1&&"Enter"!==e.key&&"Space"!==e.key||1!==e.key.length)})(e)&&this.editor.update((()=>{const t=ii();if(Ur(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=t.anchor.offset,i=this.#ve(n,r),s=this.#Se(n,r);if(i instanceof Hi&&!i.isInline())return e.preventDefault(),void this.#ge.createParagraphAfterNode(i,e.key);if(s instanceof Hi&&!s.isInline())return e.preventDefault(),void this.#ge.createParagraphBeforeNode(s,e.key)}}))}),!0)}#ve(e,t){return Pr(e)&&0===t?e.getPreviousSibling():Ui(e)&&t>0?e.getChildAtIndex(t-1):null}#Se(e,t){return Pr(e)&&t===e.getTextContentSize()?e.getNextSibling():Ui(e)?e.getChildAtIndex(t):null}#Q(){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)}#ee(){this.#we(),this.#Ce(),this.previouslySelectedKeys=this.#pe,this._currentlySelectedKeys=null}#we(){for(const e of this.previouslySelectedKeys)if(!this.#pe.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#Ce(){for(const e of this.#pe)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#fe(){this.current?await this.#Te((e=>e.selectPrevious())):this.#Ee(this.nodeBeforeCursor)}async#me(){this.current?await this.#Te((e=>e.selectNext(0,0))):this.#Ee(this.nodeAfterCursor)}async#ye(){this.current?await this.#Te((e=>e.selectPrevious())):this.#Ee(this.topLevelNodeBeforeCursor)}async#_e(){this.current?await this.#Te((e=>e.selectNext(0,0))):this.#Ee(this.topLevelNodeAfterCursor)}async#Te(e){await Fu(),this.current&&this.editor.update((()=>{this.clear(),e(this.current.getNodes()[0]),this.editor.focus()}))}async#ke(){this.editor.update((()=>{const e=this.#Ne();e&&this.#Ae(e)}))}#Ne(){const e=ii();return e?Hr(e)?this.#Le(e):Ur(e)?this.#Pe(e):null:null}#Le(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#Pe(e){return e.anchor.getNode().getTopLevelElement()}#Ae(e){const t=e.getNextSibling();t?t.selectStart():this.#Fe()}#Fe(){const e=Is(),t=ss();e.append(t),t.selectStart()}#Ee(e){e&&e instanceof Hi&&this.editor.update((()=>{const t=ni();t.add(e.getKey()),Ms(t)}))}#be(){const e=this.nodeAfterCursor;return e instanceof Hi?this.#Ee(e):this.#ge.deleteSelectedNodes(),!0}#xe(){const e=this.nodeBeforeCursor;return e instanceof Hi?this.#Ee(e):this.#ge.deleteSelectedNodes(),!0}#te(){const e=ii();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#ne(e){let t=e.getBoundingClientRect();if(this.#Oe(t)){const n=this.#Ie(e);t=n.getBoundingClientRect(),this.#Re(n),n.remove()}return t}#Oe(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#Ie(e){const t=this.#Me();return e.insertNode(t),t}#Me(){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",va()),e}#Re(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#re(e,t){const n=this.editor.getRootElement().getBoundingClientRect();let r=e.left-n.left,i=e.top-n.top;const s=this.#De(t);return isNaN(s)||(i+=s),{x:r,y:i,fontSize:s}}#De(e){const t=window.getSelection().anchorNode,n=this.#ze(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#ze(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#ie(){const e=ii();if(!Ur(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#se(e,t){return t===e.getTextContentSize()?this.#le(e):null}#le(e){if(e.getNextSibling()instanceof Hi)return e.getNextSibling();const t=e.getParent();return t?t.getNextSibling():null}#oe(e,t){return t0?e.getChildAtIndex(t-1):this.#de(e)}#ae(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#de(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}class Iu extends Hi{static getType(){return"custom_action_text_attachment"}static clone(e){return new Iu({...e},e.__key)}static importJSON(e){return new Iu({...e})}static importDOM(){return{"action-text-attachment":e=>{const t=e.getAttribute("content");return e.getAttribute("content")?{conversion:()=>{const n=[],r=e.previousSibling;return r&&r.nodeType===Node.TEXT_NODE&&/\s$/.test(r.textContent)&&n.push(Lr(" ")),n.push(new Iu({sgid:e.getAttribute("sgid"),innerHtml:JSON.parse(t),contentType:e.getAttribute("content-type")})),n.push(Lr(" ")),{node:n}},priority:2}:null}}}constructor({sgid:e,contentType:t,innerHtml:n},r){super(r),this.sgid=e,this.contentType=t||"application/vnd.actiontext.unknown",this.innerHtml=n}createDOM(){const e=vu("action-text-attachment",{"content-type":this.contentType,"data-lexxy-decorator":!0});return e.addEventListener("click",(t=>{wu(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.insertAdjacentHTML("beforeend",this.innerHtml),e}updateDOM(){return!0}isInline(){return!0}exportDOM(){return{element:vu("action-text-attachment",{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class Ru{constructor(e){this.editorElement=e,this.editor=e.editor}insertHtml(e){this.editor.update((()=>{const t=ii();if(!Ur(t))return;const n=yl(this.editor,Su(e));t.insertNodes(n)}))}insertAtCursor(e){this.editor.update((()=>{const t=ii(),n=t?.getNodes();if(Ur(t))di([e]);else if(Hr(t)&&n&&n.length>0){n[n.length-1].insertAfter(e)}else{Is().append(e)}}))}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=ii();if(!Ur(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=ii();if(!Ur(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.insertNodeWrappingAllSelectedLines(t)}))}insertNodeWrappingAllSelectedLines(e){this.editor.update((()=>{const t=ii();Ur(t)&&(t.isCollapsed()?this.#Be(t,e):this.#$e(t,e))}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=ii();if(!Ur(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=ss();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=ii();e=Ur(t)&&!t.isCollapsed()})),e}unwrapSelectedListItems(){this.editor.update((()=>{const e=ii();if(!Ur(e))return;const{listItems:t,parentLists:n}=this.#Ue(e);if(t.size>0){const e=this.#We(t);this.#He(n),this.#Ke(e)}}))}createLink(e){let t=null;return this.editor.update((()=>{const n=Lr(e),r=Bc(e);r.append(n);const i=ii();Ur(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{jc(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=ii();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Pr(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o),l=a.lastIndexOf(e);-1!==l&&(t=a.slice(l+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=ii();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Pr(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o);t=a.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t],this.editor.update((()=>{const{anchorNode:n,offset:r}=this.#je();if(!n)return;const i=this.#qe(n,r,e);-1!==i&&this.#Je(n,r,i,t)}))}createParagraphAfterNode(e,t){const n=ss();e.insertAfter(n),n.selectStart(),t&&(n.append(Lr(t)),n.select(1,1))}createParagraphBeforeNode(e,t){const n=ss();e.insertBefore(n),n.selectStart(),t&&(n.append(Lr(t)),n.select(1,1))}uploadFile(e){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");if(!this.#Ve(e))return;const t=this.editorElement.directUploadUrl,n=this.editorElement.blobUrlTemplate;this.editor.update((()=>{const r=new Nu({file:e,uploadUrl:t,blobUrlTemplate:n,editor:this.editor});this.insertAtCursor(r)}),{tag:Xi})}async deleteSelectedNodes(){let e=null;this.editor.update((()=>{if(Hr(this.#Ge.current)){const t=this.#Ge.current.getNodes();if(0===t.length)return;e=this.#Ze(t),this.#Ye(t)}})),await Fu(),this.editor.update((()=>{this.#Xe(e),this.#Ge.clear(),this.editor.focus()}))}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=Ns(e);if(!r)return;const i=ii();let s=!1;if(Ur(i)){const e=i.getNodes();s=e.includes(r)||e.some((e=>e.getParent()===r)),s&&Ms(null)}const o=n.attachment?this.#Qe(t,n.attachment):this.#et(t);r.replace(o),s&&o.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=Ns(e);if(!r)return;let i=r;try{i=r.getTopLevelElementOrThrow()}catch{}const s=n.attachment?this.#Qe(t,n.attachment):this.#et(t);i.insertAfter(s)}))}get#Ge(){return this.editorElement.selection}#Be(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else di([t()])}#$e(e,t){const n=this.#tt(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#nt(n);if(0===r.size)return;const s=this.#rt(t,r);this.#it(e,s),this.#st(i)}#tt(e){const t=e.extract().map((e=>this.#ot(e))).filter(Boolean);return Ms(null),t}#ot(e){return os(e)?e:Pr(e)&&e.getParent()&&os(e.getParent())?e.getParent():null}#nt(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#rt(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(Lr(e)),te.remove()))}#Ye(e){e.forEach((e=>{const t=e.getParent();if(!Ui(t))return;const n=t.getChildren().indexOf(e);n>=0&&t.splice(n,1,[])}))}#Ze(e){const t=e[0],n=e[e.length-1];return t?.getPreviousSibling()||n?.getNextSibling()}#Xe(e){const t=Is();if(0===t.getChildrenSize()){const e=ss();t.append(e),e.selectStart()}else e&&(Pr(e)||os(e)?e.selectEnd():e.selectNext(0,0))}#Ue(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=Gc(e);if(t){n.add(t);const e=t.getParent();e&&hl(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#We(e){const t=[];for(const n of e){const e=this.#at(n);e&&t.push(e)}return t}#at(e){const t=e.getParent();if(!t||!hl(t))return null;const n=ss(),r=this.#lt(e,n);return e.insertAfter(n),this.#ct(n,r),e.remove(),n}#lt(e,t){const n=[];return e.getChildren().forEach((e=>{hl(e)?n.push(e):t.append(e)})),n}#ct(e,t){t.forEach((t=>{e.insertAfter(t)}))}#He(e){for(const t of e)hl(t)&&0===t.getChildrenSize()&&t.remove()}#Ke(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#ut(t,n)}#ut(e,t){e.selectStart();const n=ii();n&&Ur(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#je(){const e=ii();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Pr(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#qe(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#Je(e,t,n,r){const i=e.getTextContent(),s=i.slice(0,n),o=i.slice(t),a=Lr(s),l=Lr(o||" ");e.replace(a);this.#dt(a,r).insertAfter(l),this.#ht(l.getParentOrThrow()),l.select(0,0)}#dt(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#ht(e){if(os(e)&&!this.editorElement.isSingleLineMode){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Pr(n)&&""===n.getTextContent()&&r&&!Pr(r)&&e.append(hr())}}#Qe(e,t={}){return new Iu({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#et(e){return yl(this.editor,Su(e))[0]||ss()}#Ve(e){return Cu(this.editorElement,"lexxy:file-accept",{file:e},!0)}}function Mu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Du={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function zu(e){Du=e}var Bu={exec:()=>null};function $u(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(Uu.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Uu={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:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,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")},Wu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Hu=/(?:[*+-]|\d{1,9}[.)])/,Ku=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ju=$u(Ku).replace(/bull/g,Hu).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(),qu=$u(Ku).replace(/bull/g,Hu).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(),Ju=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Vu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Gu=$u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Vu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Zu=$u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hu).getRegex(),Yu="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",Xu=/|$))/,Qu=$u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Xu).replace("tag",Yu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ed=$u(Ju).replace("hr",Wu).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",")|<(?:script|pre|style|textarea|!--)").replace("tag",Yu).getRegex(),td={blockquote:$u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ed).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Gu,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Wu,html:Qu,lheading:ju,list:Zu,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:ed,table:Bu,text:/^[^\n]+/},nd=$u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Wu).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",")|<(?:script|pre|style|textarea|!--)").replace("tag",Yu).getRegex(),rd={...td,lheading:qu,table:nd,paragraph:$u(Ju).replace("hr",Wu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",nd).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Yu).getRegex()},id={...td,html:$u("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Xu).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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Bu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$u(Ju).replace("hr",Wu).replace("heading"," *#{1,6} *[^\n]").replace("lheading",ju).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},sd=/^( {2,}|\\)\n(?!\s*$)/,od=/[\p{P}\p{S}]/u,ad=/[\s\p{P}\p{S}]/u,ld=/[^\s\p{P}\p{S}]/u,cd=$u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ad).getRegex(),ud=/(?!~)[\p{P}\p{S}]/u,dd=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,hd=$u(dd,"u").replace(/punct/g,od).getRegex(),gd=$u(dd,"u").replace(/punct/g,ud).getRegex(),pd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fd=$u(pd,"gu").replace(/notPunctSpace/g,ld).replace(/punctSpace/g,ad).replace(/punct/g,od).getRegex(),md=$u(pd,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,ud).getRegex(),yd=$u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ld).replace(/punctSpace/g,ad).replace(/punct/g,od).getRegex(),_d=$u(/\\(punct)/,"gu").replace(/punct/g,od).getRegex(),bd=$u(/^<(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(),xd=$u(Xu).replace("(?:--\x3e|$)","--\x3e").getRegex(),kd=$u("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",xd).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),vd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,Sd=$u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",vd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),wd=$u(/^!?\[(label)\]\[(ref)\]/).replace("label",vd).replace("ref",Vu).getRegex(),Cd=$u(/^!?\[(ref)\](?:\[\])?/).replace("ref",Vu).getRegex(),Td={_backpedal:Bu,anyPunctuation:_d,autolink:bd,blockSkip:/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,br:sd,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Bu,emStrongLDelim:hd,emStrongRDelimAst:fd,emStrongRDelimUnd:yd,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Sd,nolink:Cd,punctuation:cd,reflink:wd,reflinkSearch:$u("reflink|nolink(?!\\()","g").replace("reflink",wd).replace("nolink",Cd).getRegex(),tag:kd,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Od=e=>Fd[e];function Id(e,t){if(t){if(Uu.escapeTest.test(e))return e.replace(Uu.escapeReplace,Od)}else if(Uu.escapeTestNoEncode.test(e))return e.replace(Uu.escapeReplaceNoEncode,Od);return e}function Rd(e){try{e=encodeURI(e).replace(Uu.percentDecode,"%")}catch{return null}return e}function Md(e,t){let n=e.replace(Uu.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(Uu.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.length0)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:Dd(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=Dd(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:Dd(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Dd(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,s=!1,o=[];for(t=0;t1,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 s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,a=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,a=l.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),s=this.rules.other.headingBeginRegex(d),o=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)||s.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())a+="\n"+h.slice(d);else{if(u||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||s.test(l)||n.test(l))break;a+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),l=h.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(a),g&&(h="[ ] "!==g[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;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({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]}))));return s}}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=Dd(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;r0?-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)),zd(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 zd(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,s=[...r[0]].length-1,o=s,a=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=l.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]){o+=i;continue}if((r[5]||r[6])&&s%3&&!((s+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);let t=[...r[0]][0].length,l=e.slice(0,s+r.index+t+i);if(Math.min(s,i)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,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}}}},$d=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Du,this.options.tokenizer=this.options.tokenizer||new Bd,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:Uu,block:Ld.normal,inline:Pd.normal};this.options.pedantic?(t.block=Ld.pedantic,t.inline=Pd.pedantic):this.options.gfm&&(t.block=Ld.gfm,this.options.breaks?t.inline=Pd.breaks:t.inline=Pd.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ld,inline:Pd}}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(Uu.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e!!(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 s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.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,s="";for(;e;){let r;if(i||(s=""),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,s)){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 o=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&&(o=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=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}},Ud=class{options;parser;constructor(e){this.options=e||Du}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Uu.notSpaceStart)?.[0],i=e.replace(Uu.endingNewline,"")+"\n";return r?'
'+(n?i:Id(i,!0))+"
\n":"
"+(n?i:Id(i,!0))+"
\n"}blockquote({tokens:e}){return`
\n${this.parser.parse(e)}
\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}\n`}hr(e){return"
\n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t\n"+r+"\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+" "+Id(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),`
  • ${t}
  • \n`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    \n`}table(e){let t="",n="";for(let t=0;t${r}`),"\n\n"+t+"\n"+r+"
    \n"}tablerow({text:e}){return`\n${e}\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`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Id(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Rd(e);if(null===i)return r;let s='
    ",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Rd(e);if(null===i)return Id(n);let s=`${n}{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 Ud(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Bd(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Kd;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],s=t[r];Kd.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Kd.passThroughHooksRespectAsync.has(n))return Promise.resolve(i.call(t,e)).then((e=>s.call(t,e)));let r=i.call(t,e);return s.call(t,r)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.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 $d.lex(e,t??this.defaults)}parser(e,t){return Hd.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(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 s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?$d.lex:$d.lexInline,a=i.hooks?i.hooks.provideParser():e?Hd.parse:Hd.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then((e=>o(e,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>a(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=a(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return s(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="

    An error occurred:

    "+Id(n.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function qd(e,t){return jd.parse(e,t)}function Jd(e){try{return new URL(e),!0}catch(e){return!1}}function Vd(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}qd.options=qd.setOptions=function(e){return jd.setOptions(e),qd.defaults=jd.defaults,zu(qd.defaults),qd},qd.getDefaults=Mu,qd.defaults=Du,qd.use=function(...e){return jd.use(...e),qd.defaults=jd.defaults,zu(qd.defaults),qd},qd.walkTokens=function(e,t){return jd.walkTokens(e,t)},qd.parseInline=jd.parseInline,qd.Parser=Hd,qd.parser=Hd.parse,qd.Renderer=Ud,qd.TextRenderer=Wd,qd.Lexer=$d,qd.lexer=$d.lex,qd.Tokenizer=Bd,qd.Hooks=Kd,qd.parse=qd,qd.options,qd.setOptions,qd.use,qd.walkTokens,qd.parseInline,Hd.parse,$d.lex;class Gd{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!!t&&(this.#gt(t)?(this.#pt(t),e.preventDefault(),!0):void this.#ft(t))}#gt(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#pt(e){e.items[0].getAsString((e=>{if(Jd(e)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(e);else if(Jd(e)){const t=this.contents.createLink(e);this.#mt(t,{url:e})}else this.#yt(e)}))}#mt(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};Cu(this.editorElement,"lexxy:insert-link",{...t,...n})}#yt(e){const t=qd(e);this.contents.insertHtml(t)}#ft(e){if(!this.editorElement.supportsAttachments)return;e.getData("text/html")||this.#_t((()=>{for(const t of e.items){const e=t.getAsFile();e&&this.contents.uploadFile(e)}}))}async#_t(e){const t=window.scrollY,n=window.scrollX;e(),await Fu(),window.scrollTo(n,t),this.editor.focus()}}class Zd extends HTMLElement{static formAssociated=!0;static debug=!0;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#bt="";#xt=document.createElement("textarea");constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Tu("lexxy-editor"),this.editor=this.#kt(),this.contents=new Ru(this),this.selection=new Ou(this),this.clipboard=new Gd(this),Pu.configureFor(this),this.#vt(),requestAnimationFrame((()=>Cu(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#St()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#wt())),"required"===e&&this.isConnected&&(this.#xt.required=this.hasAttribute("required"),this.#Ct())}formResetCallback(){this.value=this.#bt,this.editor.dispatchCommand(Nn,void 0)}get form(){return this.internals.form}get toolbarElement(){return this.#Tt?(this.toolbar=this.toolbar||this.#Et(),this.toolbar):null}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isSingleLineMode(){return this.hasAttribute("single-line")}get supportsAttachments(){return"false"!==this.getAttribute("attachments")}focus(){this.editor.focus()}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=function(e){return se.sanitize(e,{ALLOWED_TAGS:xu,ALLOWED_ATTR:ku,SAFE_FOR_XML:!1})}(_l(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{ao(ts);const t=Is();t.clear(),""!==e&&t.append(...this.#Nt(e)),t.select(),this.#At(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#Nt(e){e||(e="

    ");return yl(this.editor,Su(`
    ${e}
    `)).map((e=>{if("paragraph"===e.getType()&&1===e.getChildrenSize()){const t=e.getFirstChild();if(t instanceof Hi&&!t.isInline())return t}return e}))}#vt(){this.#Lt(),this.#Pt(),this.#Ft(),this.#Ot(),this.#It(),this.#Rt(),this.#Mt(),this.#Dt()}#kt(){this.editorContentElement=this.editorContentElement||this.#zt();const e=ls({namespace:"LexicalEditor",onError(e){throw e},theme:yu,nodes:this.#Bt});return e.setRootElement(this.editorContentElement),e}get#Bt(){const e=[Bl,Wl,ol,tl,oc,yc,Dc,Uc,Au,Iu];return this.supportsAttachments&&e.push(Eu,Nu),e}#zt(){const e=vu("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#$t,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#Ut.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#$t(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#Ut(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#Wt(e){const t=void 0!==this.#Wt&&this.#Wt!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#xt.value=this.#Ht?"":e,t&&Cu(this,"lexxy:change")}get#Wt(){return this._internalFormValue}#Mt(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"

    ";this.value=this.#bt=e}#Dt(){document.addEventListener("turbo:before-cache",this.#Kt)}#Kt=e=>{this.#St()};#Lt(){this.#jt(this.editor.registerUpdateListener((({editorState:e})=>{this.cachedValue=null,this.#Wt=this.value,this.#At(),this.#Ct()})))}#jt(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#qt(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#Pt(){Xl(this.editor),this.historyState={current:null,redoStack:[],undoStack:[]},function(e,t,n){const r=fu(e,n),i=Ia(e.registerCommand(en,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,s=r.pop();null!==i&&(n.push(i),e.dispatchCommand(An,!0)),0===r.length&&e.dispatchCommand(Ln,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:Yi})}}(e,t),!0)),0),e.registerCommand(tn,(()=>(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(Ln,!0));const s=n.pop();0===n.length&&e.dispatchCommand(An,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:Yi})}}(e,t),!0)),0),e.registerCommand(En,(()=>(mu(t),!1)),0),e.registerCommand(Nn,(()=>(mu(t),e.dispatchCommand(An,!1),e.dispatchCommand(Ln,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:s,dirtyElements:o,tags:a})=>{const l=t.current,c=t.redoStack,u=t.undoStack,d=null===l?null:l.editorState;if(null!==l&&n===d)return;const h=r(i,n,l,s,o,a);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(An,!1)),null!==l&&(u.push({...l}),e.dispatchCommand(Ln,!0));else if(2===h)return;t.current={editor:e,editorState:n}})))}(this.editor,this.historyState,20),ml(this.editor),this.#Jt(),ru(this.editor,gu)}#Jt(){!function(e,t){if(!e.hasNodes([oc,yc]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=wc);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(oc,(t=>{e.update((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=Ns(n);null!==t&&Tc(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(oc,(n=>Nc(n,e,t))),e.registerNodeTransform(kr,(n=>Cc(n,e,t))),e.registerNodeTransform(yc,(n=>Cc(n,e,t))),e.registerCommand(fn,(t=>{const n=function(e){const t=ii();if(!Ur(t)||!Pc(t))return null;const n=e?_n:yn,r=e?_n:mn,i=t.anchor,s=t.focus;if(i.is(s))return r;const o=Fc(t);if(1!==o.length)return n;const a=o[0];let l,c;0===a.length&&ec(285),t.isBackward()?(l=s,c=i):(l=i,c=s);const u=vc(a[0]),d=Sc(a[0]),h=Dr(u.getKey(),0,"text"),g=Dr(d.getKey(),d.getTextContentSize(),"text");return l.isBefore(h)||g.isBefore(c)?n:h.isBefore(l)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(mn,(()=>!!Pc(ii())&&(di([Ir()]),!0)),1),e.registerCommand(yn,(e=>Oc(yn)),1),e.registerCommand(_n,(e=>Oc(_n)),1),e.registerCommand(ln,(e=>{const t=ii();if(!Ur(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Pc(t)&&(t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&lc(r.getParentOrThrow())?(e.preventDefault(),!0):Ic(ln,e))}),1),e.registerCommand(cn,(e=>{const t=ii();if(!Ur(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Pc(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&lc(r.getParentOrThrow())?(e.preventDefault(),!0):Ic(cn,e))}),1),e.registerCommand(an,(e=>Rc(an,e)),1),e.registerCommand(sn,(e=>Rc(sn,e)),1)),Ia(...n)}(this.editor),this.append(vu("lexxy-code-language-picker"))}#Ft(){this.editor.getRootElement().addEventListener("lexxy:internal:invalidate-node",(e=>{const{key:t,values:n}=e.detail;this.editor.update((()=>{const e=Ns(t);if(e instanceof Eu){const t=e.getWritable();Object.assign(t,n)}}))}))}#Ot(){this.editor.registerCommand(un,(e=>(e.ctrlKey||e.metaKey||!!this.isSingleLineMode)&&(e.preventDefault(),!0)),2)}#It(){Zd.debug&&this.#jt(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{console.debug("HTML: ",this.value)}))})))}#Rt(){this.#Tt&&this.toolbarElement.setEditor(this)}#Et(){const e=this.getAttribute("toolbar");return e?document.getElementById(e):this.#Vt()}get#Tt(){return"false"!==this.getAttribute("toolbar")}#Vt(){const e=vu("lexxy-toolbar");return e.innerHTML=Yc.defaultTemplate,this.prepend(e),e}#At(){this.classList.toggle("lexxy-editor--empty",this.#Ht)}get#Ht(){return!this.editorContentElement.textContent.trim()&&!this.editorContentElement.querySelector(bu)}#Ct(){this.#xt.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#xt.validity,this.#xt.validationMessage,this.editorContentElement)}#St(){this.#qt(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#Kt)}#wt(){this.disconnectedCallback(),this.connectedCallback()}}customElements.define("lexxy-editor",Zd);class Yd extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.input=this.querySelector("input"),this.addEventListener("submit",this.#Gt.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#Zt.bind(this)),this.addEventListener("keydown",this.#Yt.bind(this))}show(e){this.input.value=this.#Xt,this.dialog.show()}close(){this.dialog.close()}#Gt(e){const t=e.submitter?.value;this.#Qt.dispatchCommand(t,this.input.value)}#Zt(e){this.#Qt.dispatchCommand("unlink"),this.close()}#Yt(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}get#Xt(){let e="";return this.#Qt.getEditorState().read((()=>{const t=ii();if(!Ur(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if($c(n)){e=n.getURL();break}n=n.getParent()}})),e}get#Qt(){return this.closest("lexxy-toolbar").editor}}customElements.define("lexxy-link-dialog",Yd);class Xd{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=vu("li",{role:"option",id:Tu("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=Su(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class Qd extends Xd{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#en(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#en(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return Vd(e).includes(Vd(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class eh extends Qd{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class th extends Qd{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class nh extends Xd{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,s)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){s(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.#tn(e));return this.#en(t)}#tn(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#en(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 rh extends HTMLElement{constructor(){super(),this.keyListeners=[]}connectedCallback(){this.source=this.#nn(),this.#rn()}disconnectedCallback(){this.source=null,this.popoverElement=null}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get#in(){return!this.supportsSpaceInSearches}#nn(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new nh(e):new th(e):new eh(this.querySelectorAll("lexxy-prompt-item"))}#rn(){const e=this.#Qt.registerUpdateListener((()=>{this.#Qt.read((()=>{const t=ii();if(!t)return;let n;if(Ur(t)?n=t.anchor.getNode():Hr(t)&&([n]=t.getNodes()),n&&Pr(n)){[...n.getTextContent().trim()].pop()===this.trigger&&(e(),this.#sn())}}))}))}get#Qt(){return this.#on.editor}get#on(){return this.closest("lexxy-editor")}get#Ge(){return this.#on.selection}async#sn(){this.popoverElement??=await this.#an(),await this.#ln(),this.#cn(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#un(),this.#on.addEventListener("keydown",this.#dn),this.#on.addEventListener("lexxy:change",this.#ln),this.#hn()}#hn(){this.keyListeners.push(this.#Qt.registerCommand(un,this.#gn.bind(this),3)),this.keyListeners.push(this.#Qt.registerCommand(fn,this.#gn.bind(this),3)),this.#in&&this.keyListeners.push(this.#Qt.registerCommand(dn,this.#gn.bind(this),3))}#un(){const e=this.#pn[0];e&&this.#fn(e)}get#pn(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#fn(e){this.#mn(),e.toggleAttribute("aria-selected",!0),e.focus(),this.#on.focus(),this.#yn.setAttribute("aria-controls",this.popoverElement.id),this.#yn.setAttribute("aria-activedescendant",e.id),this.#yn.setAttribute("aria-haspopup","listbox")}#mn(){this.#pn.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#yn.removeAttribute("aria-controls"),this.#yn.removeAttribute("aria-activedescendant"),this.#yn.removeAttribute("aria-haspopup")}#cn(){const{x:e,y:t,fontSize:n}=this.#Ge.cursorPosition,r=this.#on.getBoundingClientRect(),i=this.#yn.getBoundingClientRect().top-r.top;this.popoverElement.style.left=`${e}px`,this.popoverElement.style.top=`${t+i}px`,this.popoverElement.style.bottom="auto";this.popoverElement.getBoundingClientRect().bottom>window.innerHeight&&(this.popoverElement.style.bottom=`${t-i+n}px`,this.popoverElement.style.top="auto")}async#_n(){this.#mn(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#on.removeEventListener("lexxy:change",this.#ln),this.#on.removeEventListener("keydown",this.#dn),this.#bn(),await Fu(),this.#rn()}#bn(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#ln=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#xn.containsTextBackUntil(this.trigger)?await this.#kn():this.#_n()};async#kn(){const e=this.#xn.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#vn(t):this.#Sn(),this.#un()}#vn(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#Sn(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=vu("li",{innerHTML:this.#wn});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#wn(){return this.getAttribute("empty-results")||"Nothing found"}#dn=e=>{"Escape"===e.key?(this.#_n(),this.#on.focus(),e.stopPropagation()):"ArrowDown"===e.key?(this.#Cn(),e.preventDefault(),e.stopPropagation()):"ArrowUp"===e.key&&(this.#Tn(),e.preventDefault(),e.stopPropagation())};#Cn(){const e=this.#En+1;e=0&&this.#fn(this.#pn[e])}get#En(){return this.#pn.findIndex((e=>e.hasAttribute("aria-selected")))}get#Nn(){return this.#pn[this.#En]}#gn(e){return" "!==e.key&&e.preventDefault(),e.stopPropagation(),this.#An(),!0}#An(){this.#Ln(),this.#_n(),this.#on.focus()}#Ln(){const e=this.source.promptItemFor(this.#Nn);if(!e)return;const t=e.querySelector("template[type='editor']"),n=`${this.trigger}${this.#xn.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#Pn(t,n):this.#Fn(e,t,n)}#Pn(e,t){this.#Qt.update((()=>{const n=yl(this.#Qt,Su(`${e.innerHTML}`));this.#xn.replaceTextBackUntil(t,n)}))}#Fn(e,t,n){this.#Qt.update((()=>{const r=new Iu({sgid:e.getAttribute("sgid"),contentType:`application/vnd.actiontext.${this.name}`,innerHtml:t.innerHTML});this.#xn.replaceTextBackUntil(n,r)}))}get#xn(){return this.#on.contents}get#yn(){return this.#on.editorContentElement}async#an(){const e=vu("ul",{role:"listbox",id:Tu("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",va()),e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#On),this.#on.appendChild(e),e}#On=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#fn(t),this.#An())}}customElements.define("lexxy-prompt",rh);class ih extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.#In(),this.#Rn()}#In(){this.languagePickerElement=this.#Mn(),this.languagePickerElement.addEventListener("change",(()=>{this.#Dn(this.languagePickerElement.value)})),this.languagePickerElement.style.position="absolute",this.languagePickerElement.setAttribute("nonce",va()),this.editorElement.appendChild(this.languagePickerElement)}#Mn(){const e=vu("select",{hidden:!0,className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#zn)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#zn(){const e={...fc};e.ruby||(e.ruby="Ruby");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])}#Dn(e){this.editor.update((()=>{const t=this.#Bn();t&&t.setLanguage(e)}))}#Rn(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#Bn();e?this.#$n(e):this.#Un()}))}))}#Bn(){const e=ii();if(!Ur(e))return null;const t=e.anchor.getNode(),n=t.getParent();return lc(t)?t:lc(n)?n:null}#$n(e){const t=e.getLanguage();this.#Wn(t),this.#Hn(),this.#Kn(e)}#Wn(e){if(this.languagePickerElement&&e){const t=function(e){return mc[e]||e}(e);this.languagePickerElement.value=t}}#Kn(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top;this.languagePickerElement.style.top=`${i}px`}#Hn(){this.languagePickerElement.hidden=!1}#Un(){this.languagePickerElement.hidden=!0}}function sh(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(//gi,"\n");const r=Prism.languages[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=Prism.highlight(n,r,t),s=vu("code",{"data-language":t,innerHTML:i});e.replaceWith(s)}(e)}))}customElements.define("lexxy-code-language-picker",ih),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}(Prism),window.Prism=window.Prism||{},Prism.manual=!0;export{sh as highlightAll}; + */function ec(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.`)}"undefined"!=typeof module&&module.exports&&(module.exports=Ql),"undefined"!=typeof global&&(global.Prism=Ql),Ql.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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]},Ql.languages.markup.tag.inside["attr-value"].inside.entity=Ql.languages.markup.entity,Ql.languages.markup.doctype.inside["internal-subset"].inside=Ql.languages.markup,Ql.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Ql.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Ql.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Ql.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Ql.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Ql.languages.markup.tag,"addAttribute",{value:function(e,t){Ql.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:Ql.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Ql.languages.html=Ql.languages.markup,Ql.languages.mathml=Ql.languages.markup,Ql.languages.svg=Ql.languages.markup,Ql.languages.xml=Ql.languages.extend("markup",{}),Ql.languages.ssml=Ql.languages.xml,Ql.languages.atom=Ql.languages.xml,Ql.languages.rss=Ql.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"))}(Ql),Ql.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:/[{}[\];(),.:]/},Ql.languages.javascript=Ql.languages.extend("clike",{"class-name":[Ql.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}|\?\?=?|\?\.?|[~:]/}),Ql.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Ql.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:Ql.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:Ql.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Ql.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Ql.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:Ql.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Ql.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:Ql.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"}}),Ql.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Ql.languages.markup&&(Ql.languages.markup.tag.addInlined("script","javascript"),Ql.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")),Ql.languages.js=Ql.languages.javascript,function(){if(void 0!==Ql&&"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",n="loading",r="loaded",i="pre[data-src]:not(["+t+'="'+r+'"]):not(['+t+'="'+n+'"])';Ql.hooks.add("before-highlightall",(function(e){e.selector+=", "+i})),Ql.hooks.add("before-sanity-check",(function(s){var o=s.element;if(o.matches(i)){s.code="",o.setAttribute(t,n);var a=o.appendChild(document.createElement("CODE"));a.textContent="Loading…";var l=o.getAttribute("data-src"),c=s.language;if("none"===c){var u=(/\.(\w+)$/.exec(l)||[,"none"])[1];c=e[u]||u}Ql.util.setLanguage(a,c),Ql.util.setLanguage(o,c);var d=Ql.plugins.autoloader;d&&d.loadLanguages(c),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)}(l,(function(e){o.setAttribute(t,r);var n=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]}}(o.getAttribute("data-range"));if(n){var i=e.split(/\r\n?|\n/g),s=n[0],l=null==n[1]?i.length:n[1];s<0&&(s+=i.length),s=Math.max(0,Math.min(s-1,i.length)),l<0&&(l+=i.length),l=Math.max(0,Math.min(l,i.length)),e=i.slice(s,l).join("\n"),o.hasAttribute("data-start")||o.setAttribute("data-start",String(s+1))}a.textContent=e,Ql.highlightElement(a)}),(function(e){o.setAttribute(t,"failed"),a.textContent=e}))}})),Ql.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(i),r=0;t=n[r++];)Ql.highlightElement(t)}};var s=!1;Ql.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),Ql.plugins.fileHighlight.highlight.apply(this,arguments)}}}(),Prism.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:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.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}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.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:Prism.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:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.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:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.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:Prism.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"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.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")),Prism.languages.js=Prism.languages.javascript,Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\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://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]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.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:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//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})),s=/\|?[ \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+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),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__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\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(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.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",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),Prism.languages.c=Prism.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|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.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},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.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:Prism.languages.c}}}}),Prism.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 Prism.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"))}(Prism),Prism.languages.objectivec=Prism.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 Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec,Prism.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:/[;[\]()`,.]/},function(e){var t=e.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:/[|{}[\];(),.]/};t.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:t},boolean:t.boolean,variable:t.variable}}(Prism),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,n=0;n<2;n++)t=t.replace(//g,(function(){return t}));t=t.replace(//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}(Prism),Prism.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:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=Prism.languages.swift})),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}(Prism),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+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,(function(){return t.source}))),lookbehind:!0,inside:{punctuation:/\./}}})}(Prism),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(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//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+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//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"])}(Prism);const tc=globalThis.Prism||window.Prism,nc=e=>{try{return!!e&&tc.languages.hasOwnProperty(e)}catch(e){return!1}};function rc(e,t){for(const n of e.childNodes){if(bo(n)&&n.tagName===t)return!0;rc(n,t)}return!1}const ic="data-language",sc="data-highlight-language";let oc=class e extends $i{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=nc(e)}createDOM(e){const t=document.createElement("code");Ra(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(ic,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(sc,n)),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;return r?r!==i&&(t.setAttribute(ic,r),this.__isSyntaxHighlightSupported&&t.setAttribute(sc,r)):i&&(t.removeAttribute(ic),e.__isSyntaxHighlightSupported&&t.removeAttribute(sc)),!1}exportDOM(e){const t=document.createElement("pre");Ra(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();return n&&(t.setAttribute(ic,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(sc,n)),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||rc(e,"BR"))?{conversion:cc,priority:1}:null,div:()=>({conversion:uc,priority:1}),pre:()=>({conversion:cc,priority:0}),table:e=>pc(e)?{conversion:dc,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&pc(n)?{conversion:hc,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&pc(t)?{conversion:hc,priority:3}:null}}}static importJSON(e){return ac().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage()}}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=ss();return this.insertAfter(e,t),e}const{anchor:i,focus:s}=e,o=(i.isBefore(s)?i:s).getNode();if(Pr(o)){let e=vc(o);const t=[];for(;;)if(Rr(e))t.push(Ir()),e=e.getNextSibling();else{if(!xc(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;ne.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t.__isSyntaxHighlightSupported=nc(e),t}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function ac(e){return go(new oc(e))}function lc(e){return e instanceof oc}function cc(e){return{node:ac(e.getAttribute(ic))}}function uc(e){const t=e,n=gc(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(gc(t))return!0;t=t.parentElement}return!1}(t)?{node:n?ac():null}:{node:null}}function dc(){return{node:ac()}}function hc(){return{node:null}}function gc(e){return null!==e.style.fontFamily.match("monospace")}function pc(e){return e.classList.contains("js-file-line-container")}const fc={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"},mc={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};class yc extends kr{constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(e){return new yc(e.__text,e.__highlightType||void 0,e.__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 Ra(t,_c(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=_c(n.theme,e.__highlightType),s=_c(n.theme,this.__highlightType);return i!==s&&(i&&Ma(t,i),s&&Ra(t,s)),r}static importJSON(e){return bc().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 ac()}}function _c(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function bc(e="",t){return go(new yc(e,t))}function xc(e){return e instanceof yc}function kc(e,t){let n=e;for(let r=Jo(e,t);r&&(xc(r.origin)||Rr(r.origin));r=Da(r))n=r.origin;return n}function vc(e){return kc(e,"previous")}function Sc(e){return kc(e,"next")}const wc={defaultLanguage:"javascript",tokenize(e,t){return tc.tokenize(e,tc.languages[t||""]||tc.languages[this.defaultLanguage])}};function Cc(e,t,n){const r=e.getParent();lc(r)?Nc(r,t,n):xc(e)&&e.replace(Lr(e.__text))}function Tc(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 s="1",o=1;for(let e=0;e{!function(e,t){const n=Ns(e);if(!lc(n)||!n.isAttached())return;const r=ii();if(!Ur(r))return void t();const i=r.anchor,s=i.offset,o="element"===i.type&&gr(n.getChildAtIndex(i.offset-1));let a=0;if(!o){const e=i.getNode();a=s+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}t()&&(o?i.getNode().select(s,s):n.getChildren().some((e=>{const t=Pr(e);if(t||gr(e)){const n=e.getTextContentSize();if(t&&n>=a)return e.select(a,a),!0;a-=n}return!1})))}(r,(()=>{const t=Ns(r);if(!lc(t)||!t.isAttached())return!1;const i=t.getTextContent(),s=Ac(n.tokenize(i,t.getLanguage()||n.defaultLanguage)),o=function(e,t){let n=0;for(;n{Ec.delete(r)},skipTransforms:!0}))}function Ac(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;r0&&n.push(bc(i,t))}}else{const{content:e}=r;"string"==typeof e?n.push(...Ac([e],r.type)):Array.isArray(e)&&n.push(...Ac(e,r.type))}return n}function Lc(e,t){return xc(e)&&xc(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType||Rr(e)&&Rr(t)||gr(e)&&gr(t)}function Pc(e){if(!Ur(e))return!1;const t=e.anchor.getNode(),n=lc(t)?t:t.getParent(),r=e.focus.getNode(),i=lc(r)?r:r.getParent();return lc(n)&&n.is(i)}function Fc(e){const t=e.getNodes(),n=[];if(1===t.length&&lc(t[0]))return n;let r=[];for(let e=0;e0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=Dr(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function Oc(e){const t=ii();if(!Ur(t)||!Pc(t))return!1;const n=Fc(t),r=n.length;if(0===r&&t.isCollapsed())return e===yn&&t.insertNodes([Ir()]),!0;if(0===r&&e===yn&&"\n"===t.getTextContent()){const e=Ir(),n=hr(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),da(ka(na(Vo(e,"next",0),_a(Jo(n,"next"))),r)),!0}for(let i=0;i0){let n=r[0];if(0===i&&(n=vc(n)),e===yn){const e=Ir();if(n.insertBefore(e),0===i){const r=t.isBackward()?"focus":"anchor",i=Dr(n.getKey(),0,"text");t[r].is(i)&&t[r].set(e.getKey(),0,"text")}}else Rr(n)&&n.remove()}}return!0}function Ic(e,t){const n=ii();if(!Ur(n))return!1;const{anchor:r,focus:i}=n,s=r.offset,o=i.offset,a=r.getNode(),l=i.getNode(),c=e===ln;if(!Pc(n)||!xc(a)&&!Rr(a)||!xc(l)&&!Rr(l))return!1;if(!t.altKey){if(n.isCollapsed()){const e=a.getParentOrThrow();if(c&&0===s&&null===a.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!c&&s===a.getTextContentSize()&&null===a.getNextSibling()&&null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}return!1}let u,d;if(a.isBefore(l)?(u=vc(a),d=Sc(l)):(u=vc(l),d=Sc(a)),null==u||null==d)return!1;const h=u.getNodesBetween(d);for(let e=0;ee.remove())),e===ln?(h.forEach((e=>m.insertBefore(e))),m.insertBefore(g)):(m.insertAfter(g),m=g,h.forEach((e=>{m.insertAfter(e),m=e}))),n.setTextNodeRange(a,s,l,o),!0}function Rc(e,t){const n=ii();if(!Ur(n))return!1;const{anchor:r,focus:i}=n,s=r.getNode(),o=i.getNode(),a=e===an;if(!Pc(n)||!xc(s)&&!Rr(s)||!xc(o)&&!Rr(o))return!1;if(a){const e=function(e,t){let n=null,r=null,i=e,s=t,o=e.getTextContent();for(;;){if(0===s){if(i=i.getPreviousSibling(),null===i)break;if(xc(i)||Rr(i)||gr(i)||ec(167),gr(i)){n={node:i,offset:1};break}s=Math.max(0,i.getTextContentSize()-1),o=i.getTextContent()}else s--;const e=o[s];xc(i)&&" "!==e&&(r={node:i,offset:s})}if(null!==r)return r;let a=null;if(t({conversion:zc,priority:1})}}static importJSON(e){return Bc().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=Vc(e);try{const t=new URL(Vc(e));if(!Mc.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=Bc(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(!Ur(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 zc(e){let t=null;if(_o(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=Bc(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function Bc(e="",t){return go(new Dc(e,t))}function $c(e){return e instanceof Dc}let Uc=class e extends Dc{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 Wc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(Ui(n)){const e=Wc(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}};function Wc(e="",t){return go(new Uc(e,t))}function Hc(e){return e instanceof Uc}function Kc(e,t){if("element"===e.type){const n=e.getNode();return Ui(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 jc(e,t={}){const{target:n,title:r}=t,i=void 0===t.rel?"noreferrer":t.rel,s=ii();if(null===s||!Ur(s)&&!Hr(s))return;if(Hr(s)){const t=s.getNodes();if(0===t.length)return;return void t.forEach((t=>{if(null===e){const e=$a(t,(e=>!Hc(e)&&$c(e)));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove())}else{const r=$a(t,(e=>!Hc(e)&&$c(e)));if(r)r.setURL(e),void 0!==n&&r.setTarget(n),void 0!==i&&r.setRel(i);else{const r=Bc(e,{rel:i,target:n});t.insertBefore(r),r.append(t)}}}))}const o=s.extract();if(null===e)return void o.forEach((e=>{const t=$a(e,(e=>!Hc(e)&&$c(e)));if(t){const e=t.getChildren();for(let n=0;n{a.has(t.getKey())||(a.add(t.getKey()),t.setURL(e),void 0!==n&&t.setTarget(n),void 0!==i&&t.setRel(i),void 0!==r&&t.setTitle(r))};if(1===o.length){const e=qc(o[0],$c);if(null!==e)return l(e)}!function(e){const t=ii();if(!Ur(t))return e();const n=it(t),r=n.isBackward(),i=Kc(n.anchor,r?-1:0),s=Kc(n.focus,r?0:-1);if(e(),i||s){const e=ii();if(Ur(e)){const t=e.clone();if(i){const e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+(r?1:0),"element")}if(s){const e=s.getParent();e&&t.focus.set(e.getKey(),s.getIndexWithinParent()+(r?0:1),"element")}Ms(it(t))}}}((()=>{let t=null;for(const s of o){if(!s.isAttached())continue;const o=qc(s,$c);if(o){l(o);continue}if(Ui(s)){if(!s.isInline())continue;if($c(s)){if(!(Hc(s)||null!==t&&t.getParentOrThrow().isParentOf(s))){l(s),t=s;continue}for(const e of s.getChildren())s.insertBefore(e);s.remove();continue}}const a=s.getPreviousSibling();$c(a)&&a.is(t)?a.append(s):(t=Bc(e,{rel:i,target:n,title:r}),s.insertAfter(t),t.append(s))}}))}function qc(e,t){let n=e;for(;null!==n&&null!==n.getParent()&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}const Jc=/^\+?[0-9\s()-]{5,}$/;function Vc(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:Jc.test(e)?`tel:${e}`:`https://${e}`}function Gc(e){let t=e;for(;null!==t;){if(sl(t))return t;t=t.getParent()}return null}function Zc(e){let t=e;for(;t;){if(hl(t))return t.getListType();t=t.getParent()}return null}class Yc extends HTMLElement{constructor(){super(),this.internals=this.attachInternals(),this.internals.role="toolbar"}connectedCallback(){requestAnimationFrame((()=>this.#e())),this._resizeObserver=new ResizeObserver((()=>this.#e())),this._resizeObserver.observe(this)}disconnectedCallback(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}setEditor(e){this.editorElement=e,this.editor=e.editor,this.#t(),this.#n(),this.#r(),this.#i(),this.#s(),this.#e()}#t(){this.addEventListener("click",this.#o.bind(this))}#o({target:e}){this.#a(e,"[data-command]",this.#l.bind(this)),this.#a(e,"[data-dialog-target]",this.#c.bind(this))}#a(e,t,n){const r=e.closest(t);r&&n(r)}#l(e){const{command:t,payload:n}=e.dataset;this.editor.dispatchCommand(t,n)}#c(e){const t=document.getElementById(e.dataset.dialogTarget).parentNode;t.open?t.close():t.show()}#n(){this.editorElement.addEventListener("keydown",(e=>{this.querySelectorAll("[data-hotkey]").forEach((t=>{t.dataset.hotkey.toLowerCase().split(/\s+/).includes(this.#u(e))&&(e.preventDefault(),e.stopPropagation(),t.click())}))}))}#u(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("+")}#r(){const e=parseInt(this.editorElement.editorContentElement.getAttribute("tabindex")??"0");this.#d.forEach(((t,n)=>{t.setAttribute("tabindex",`${e+n+1}`)}))}#i(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{this.#h()}))}))}#s(){this.editor.registerUpdateListener((()=>{this.#g()}))}#g(){this.editor.getEditorState().read((()=>{const e=this.editorElement.historyState;e&&(this.#p("undo",0===e.undoStack.length),this.#p("redo",0===e.redoStack.length))}))}#p(e,t){const n=this.querySelector(`[name="${e}"]`);n&&(n.disabled=t,n.setAttribute("aria-disabled",t.toString()))}#h(){const e=ii();if(!Ur(e))return;const t=e.anchor.getNode();if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e.hasFormat("bold"),i=e.hasFormat("italic"),s=e.hasFormat("strikethrough"),o=lc(n)||e.hasFormat("code"),a=this.#f(t),l=Zc(t),c=Ul(n),u=Jl(n),d=this.#m(t);this.#y("bold",r),this.#y("italic",i),this.#y("strikethrough",s),this.#y("code",o),this.#y("unordered-list",a&&"bullet"===l),this.#y("ordered-list",a&&"number"===l),this.#y("quote",c),this.#y("heading",u),this.#y("link",d),this.#g()}#f(e){let t=e;for(;t;){if(hl(t)||sl(t))return!0;t=t.getParent()}return!1}#m(e){let t=e;for(;t;){if($c(t))return!0;t=t.getParent()}return!1}#y(e,t){const n=this.querySelector(`[name="${e}"]`);n&&n.setAttribute("aria-pressed",t.toString())}#_(){return this.scrollWidth>this.clientWidth}#e=()=>{this.#b(),this.#x(),this.#k.style.display=this.#v.children.length?"block":"none",this.#k.setAttribute("nonce",va())};get#k(){return this.querySelector(".lexxy-editor__toolbar-overflow")}get#v(){return this.querySelector(".lexxy-editor__toolbar-overflow-menu")}#b(){for(;this.#v.children.length>0;)this.insertBefore(this.#v.children[0],this.#k)}#x(){const e=this.#d.reverse();let t=!1;for(const n of e){if(!this.#_()){t&&this.#v.prepend(n);break}this.#v.prepend(n),t=!0}}get#d(){return Array.from(this.querySelectorAll(":scope > button, :scope > [role=separator]"))}static get defaultTemplate(){return'\n \n\n \n\n \n\n \n\n \n \n
    \n \n
    \n \n \n
    \n
    \n
    \n
    \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n\n \n\n
    \n •••\n
    \n
    \n '}}function Xc(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}customElements.define("lexxy-toolbar",Yc);const Qc=/[!-/:-@[-`{-~\s]/;function eu(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 tu(e,t,n){const r=n.length;for(let i=t;i>=r;i--){const t=i-r;if(nu(e,t,n,0,r)&&" "!==e[t+r])return t}return-1}function nu(e,t,n,r,i){for(let s=0;se.type));return{element:t.element||[],multilineElement:t["multiline-element"]||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}(t),r=Xc(n.textFormat,(({tag:e})=>e[e.length-1])),i=Xc(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)||eu(173,n.getType())}}const s=(e,t,s)=>{(function(e,t,n,r){if(!ho(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExp:s,replace:o}of r){const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,!1))return s.remove(),!0}}return!1})(e,t,s,n.element)||function(e,t,n,r){if(!ho(e.getParent())||e.getFirstChild()!==t)return!1;const i=t.getTextContent();if(" "!==i[n-1])return!1;for(const{regExpStart:s,replace:o,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const r=i.match(s);if(r&&r[0].length===(r[0].endsWith(" ")?n:n-1)){const i=t.getNextSiblings(),[s,a]=t.splitText(n);if(!1!==o(e,a?[a,...i]:i,r,null,null,!1))return s.remove(),!0}}return!1}(e,t,s,n.multilineElement)||function(e,t,n){let r=e.getTextContent();const i=n[r[t-1]];if(null==i)return!1;t1&&!nu(r,a,n,0,o))continue;if(" "===r[a-1])continue;const l=r[i+1];if(!1===t.intraword&&l&&!Qc.test(l))continue;const c=e;let u=c,d=tu(r,a,n),h=u;for(;d<0&&(h=h.getPreviousSibling())&&!gr(h);)if(Pr(h)){if(h.hasFormat("code"))continue;const e=h.getTextContent();u=h,d=tu(e,e.length,n)}if(d<0)continue;if(u===c&&d+o===a)continue;const g=u.getTextContent();if(d>0&&g[d-1]===s)continue;const p=g[d-1];if(!1===t.intraword&&p&&!Qc.test(p))continue;const f=c.getTextContent(),m=f.slice(0,a)+f.slice(i+1);c.setTextContent(m);const y=u===c?m:g;u.setTextContent(y.slice(0,d)+y.slice(d+o));const _=ii(),b=ti();Ms(b);const x=i-o*(u===c?2:1)+1;b.anchor.set(u.__key,d,"text"),b.focus.set(c.__key,x,"text");for(const e of t.format)b.hasFormat(e)||b.formatText(e);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const e of t.format)b.hasFormat(e)&&b.toggleFormat(e);return Ur(_)&&(b.format=_.format),!0}}(t,s,r)};return e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(Qi)||t.has(Yi))return;if(e.isComposing())return;const o=r.read(ii),a=i.read(ii);if(!Ur(a)||!Ur(o)||!o.isCollapsed()||o.is(a))return;const l=o.anchor.key,c=o.anchor.offset,u=r._nodeMap.get(l);!Pr(u)||!n.has(l)||1!==c&&c>a.anchor.offset+1||e.update((()=>{if(!function(e){return Pr(e)&&!e.hasFormat("code")}(u))return;const e=u.getParent();null===e||lc(e)||s(e,u,o.anchor.offset)}))}))}const iu=e=>(t,n,r,i)=>{const s=e(r);s.append(...n),t.replace(s),i||s.select(0,0)},su=e=>(t,n,r,i)=>{const s=t.getPreviousSibling(),o=t.getNextSibling(),a=il("check"===e?"x"===r[3]:void 0);if(hl(o)&&o.getListType()===e){const e=o.getFirstChild();null!==e?e.insertBefore(a):o.append(a),t.remove()}else if(hl(s)&&s.getListType()===e)s.append(a),t.remove();else{const n=dl(e,"number"===e?Number(r[2]):void 0);n.append(a),t.replace(n)}a.append(...n),i||a.select(0,0);const l=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]);l&&a.setIndent(l)},ou=(e,t,n)=>{const r=[],i=e.getChildren();let s=0;for(const o of i)if(sl(o)){if(1===o.getChildrenSize()){const e=o.getFirstChild();if(hl(e)){r.push(ou(e,t,n+1));continue}}const i=" ".repeat(4*n),a=e.getListType(),l="number"===a?`${e.getStart()+s}. `:"check"===a?`- [${o.getChecked()?"x":" "}] `:"- ";r.push(i+l+t(o)),s++}return r.join("\n")},au={dependencies:[Wl],export:(e,t)=>{if(!Jl(e))return null;const n=Number(e.getTag().slice(1));return"#".repeat(n)+" "+t(e)},regExp:/^(#{1,6})\s/,replace:iu((e=>ql("h"+e[1].length))),type:"element"},lu={dependencies:[Bl],export:(e,t)=>{if(!Ul(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(Ul(n))return n.splice(n.getChildrenSize(),0,[hr(),...t]),void e.remove()}const i=$l();i.append(...t),e.replace(i),r||i.select(0,0)},type:"element"},cu={dependencies:[oc],export:e=>{if(!lc(e))return null;const t=e.getTextContent();return"```"+(e.getLanguage()||"")+(t?"\n"+t:"")+"\n```"},regExpEnd:{optional:!0,regExp:/[ \t]*```$/},regExpStart:/^[ \t]*```(\w+)?/,replace:(e,t,n,r,i,s)=>{let o,a;if(!t&&i){if(1===i.length)r?(o=ac(),a=n[1]+i[0]):(o=ac(n[1]),a=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{if(o=ac(n[1]),0===i[0].trim().length)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(" ")?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();a=i.join("\n")}const t=Lr(a);o.append(t),e.append(o)}else t&&iu((e=>ac(e?e[1]:void 0)))(e,t,n,s)},type:"multiline-element"},uu={dependencies:[ol,tl],export:(e,t)=>hl(e)?ou(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:su("bullet"),type:"element"},du={dependencies:[ol,tl],export:(e,t)=>hl(e)?ou(e,t,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:su("number"),type:"element"},hu={dependencies:[Dc],export:(e,t,n)=>{if(!$c(e)||Hc(e))return null;const r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{const[,n,r,i]=t,s=Bc(r,{title:i}),o=Lr(n);return o.setFormat(e.getFormat()),s.append(o),e.replace(s),o},trigger:")",type:"text-match"},gu=[...[au,lu,uu,du],...[cu],...[{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"}],...[hu]];function pu(e,t,n,r,i){if(null===e||0===n.size&&0===r.size&&!i)return 0;const s=t._selection,o=e._selection;if(i)return 1;if(!(Ur(s)&&Ur(o)&&o.isCollapsed()&&s.isCollapsed()))return 0;const a=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||qi(n)||i.push(n)}return i}(t,n,r);if(0===a.length)return 0;if(a.length>1){const n=t._nodeMap,r=n.get(s.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&Pr(r)&&1===r.__text.length&&1===s.anchor.offset?2:0}const l=a[0],c=e._nodeMap.get(l.__key);if(!Pr(c)||!Pr(l)||c.__mode!==l.__mode)return 0;const u=c.__text,d=l.__text;if(u===d)return 0;const h=s.anchor,g=o.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}function fu(e,t){let n=Date.now(),r=0;return(i,s,o,a,l,c)=>{const u=Date.now();if(c.has(Yi))return r=0,n=u,2;const d=pu(i,s,a,l,e.isComposing()),h=(()=>{const h=null===o||o.editor===e,g=c.has("history-push");if(!g&&h&&c.has(Xi))return 0;if(null===i)return 1;const p=s._selection;return a.size>0||l.size>0?!1===g&&0!==d&&d===r&&ur.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(a)[0],i,s)?0:1:null!==p?0:2})();return n=u,r=d,h}}function mu(e){e.undoStack=[],e.redoStack=[],e.current=null}var yu={text:{bold:"lexxy-content__bold",italic:"lexxy-content__italic",strikethrough:"lexxy-content__strikethrough",underline:"lexxy-content__underline"},codeHighlight:{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__property",decorator:"code-token__function",deleted:"code-token__property",doctype:"code-token__comment",entity:"code-token__operator",function:"code-token__function",hexcode:"code-token__property",important:"code-token__variable",inserted:"code-token__selector",italic:"code-token__comment",keyword:"code-token__attr",namespace:"code-token__variable",number:"code-token__property",operator:"code-token__operator",parameter:"code-token__variable",prolog:"code-token__comment",property:"code-token__property",punctuation:"code-token__punctuation",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",url:"code-token__operator",variable:"code-token__variable"}};const _u=["img","video","audio","iframe","embed","object","picture","source","canvas","svg","math","form","input","textarea","select","button","code","blockquote","hr"].join(","),bu=["a","action-text-attachment","b","blockquote","br","code","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","li","ol","p","pre","q","s","strong","ul"],xu=["alt","caption","class","content","content-type","contenteditable","data-direct-upload-id","data-sgid","filename","filesize","height","href","presentation","previewable","sgid","src","title","url","width"];function ku(e,t){const n=document.createElement(e);for(const[e,r]of Object.entries(t||{}))e in n?n[e]=r:null!=r&&n.setAttribute(e,r);return n}function vu(e){return(new DOMParser).parseFromString(e,"text/html")}function Su(e,t,n){const r=new CustomEvent(t,{detail:n,bubbles:!0});e.dispatchEvent(r)}function wu(e,t,n=null,r=!1){return e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n,cancelable:r}))}function Cu(e){return`${e}-${Math.random().toString(36).slice(2,10)}`}function Tu(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 Eu extends Hi{static getType(){return"action_text_attachment"}static clone(e){return new Eu({...e},e.__key)}static importJSON(e){return new Eu({...e})}static importDOM(){return{"action-text-attachment":e=>({conversion:()=>({node:new Eu({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:e=>({conversion:()=>({node:new Eu({src:e.getAttribute("src"),caption:e.getAttribute("alt")||"",contentType:"image/*",width:e.getAttribute("width"),height:e.getAttribute("height")})}),priority:1})}}constructor({sgid:e,src:t,previewable:n,altText:r,caption:i,contentType:s,fileName:o,fileSize:a,width:l,height:c},u){super(u),this.sgid=e,this.src=t,this.previewable=n,this.altText=r||"",this.caption=i||"",this.contentType=s||"",this.fileName=o||"",this.fileSize=a,this.width=l,this.height=c}createDOM(){const e=this.createAttachmentFigure();return e.addEventListener("click",(t=>{this.#S(e)})),this.isPreviewableAttachment?(e.appendChild(this.#w()),e.appendChild(this.#C())):(e.appendChild(this.#T()),e.appendChild(this.#E())),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:ku("action-text-attachment",{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,sgid:this.sgid,src:this.src,previewable:this.previewable,altText:this.altText,caption:this.caption,contentType:this.contentType,fileName:this.fileName,fileSize:this.fileSize,width:this.width,height:this.height}}decorate(){return null}createAttachmentFigure(){return e=this.contentType,t=this.isPreviewableAttachment,n=this.fileName,ku("figure",{className:`attachment attachment--${t?"preview":"file"} attachment--${n?n.split(".").pop().toLowerCase():"unknown"}`,"data-content-type":e});var e,t,n}get#N(){return(e=this.contentType).startsWith("image/")&&!e.includes("svg");var e}get isPreviewableAttachment(){return this.#N||this.previewable}#w(){return ku("img",{src:this.src,alt:this.altText,...this.#A})}get#A(){return this.width&&this.height?{width:this.width,height:this.height}:{}}#T(){return ku("span",{className:"attachment__icon",textContent:`${this.fileName?this.fileName.split(".").pop().toLowerCase():"unknown"}`})}#E(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("strong",{className:"attachment__name",textContent:this.caption||this.fileName}),n=ku("span",{className:"attachment__size",textContent:Tu(this.fileSize)});return e.appendChild(t),e.appendChild(n),e}#S(e){Su(e,"lexxy:internal:select-node",{key:this.getKey()})}#C(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("input",{type:"text",class:"input",value:this.caption,placeholder:this.fileName});return t.addEventListener("focusin",(()=>t.placeholder="Add caption...")),t.addEventListener("blur",this.#L.bind(this)),t.addEventListener("keydown",this.#P.bind(this)),e.appendChild(t),e}#L(e){const t=e.target;t.placeholder=this.fileName,this.#F(t)}#F(e){Su(e,"lexxy:internal:invalidate-node",{key:this.getKey(),values:{caption:e.value}})}#P(e){"Enter"===e.key&&(this.#F(e.target),Su(e.target,"lexxy:internal:move-to-next-line"),e.preventDefault()),e.stopPropagation()}}class Nu extends Eu{static getType(){return"action_text_attachment_upload"}static clone(e){return new Nu({...e},e.__key)}constructor({file:e,uploadUrl:t,blobUrlTemplate:n,editor:r,progress:i},s){super({contentType:e.type},s),this.file=e,this.uploadUrl=t,this.blobUrlTemplate=n,this.src=null,this.editor=r,this.progress=i||0}createDOM(){const e=this.createAttachmentFigure();this.isPreviewableAttachment?e.appendChild(this.#w()):e.appendChild(this.#T()),e.appendChild(this.#O());const t=ku("progress",{value:this.progress,max:100});return e.appendChild(t),this.#I(e).then((()=>this.#R(t,e))),e}exportDOM(){const e=document.createElement("img");return this.src&&(e.src=this.src),{element:e}}#w(){return ku("img")}#T(){return ku("span",{className:"attachment__icon",textContent:this.#M()})}#M(){return this.file.name.split(".").pop().toLowerCase()}#O(){const e=ku("figcaption",{className:"attachment__caption"}),t=ku("span",{className:"attachment__name",textContent:this.file.name||""}),n=ku("span",{className:"attachment__size",textContent:Tu(this.file.size)});return e.appendChild(t),e.appendChild(n),e}#I(e){const t=e.querySelector("img");return t?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):Promise.resolve()}#R(t,n){const r=new e(this.file,this.uploadUrl,this);r.delegate={directUploadWillStoreFileWithXHR:e=>{e.upload.addEventListener("progress",(e=>{this.editor.update((()=>{t.value=Math.round(e.loaded/e.total*100)}))}))}},r.create(((e,t)=>{e?this.#D(n):this.#z(t,n).then((()=>{this.#B(n,t)}))}))}#D(e){e.innerHTML="",e.classList.add("attachment--error"),e.appendChild(ku("div",{innerText:`Error uploading ${this.file?.name??"image"}`}))}async#B(e,t){this.editor.update((()=>{const n=e.querySelector("img"),r=this.blobUrlTemplate.replace(":signed_id",t.signed_id).replace(":filename",encodeURIComponent(t.filename)),i=Ns(this.getKey());i&&i.replace(new Eu({sgid:t.attachable_sgid,src:t.previewable?t.url:r,altText:t.filename,contentType:t.content_type,fileName:t.filename,fileSize:t.byte_size,width:n?.naturalWidth,previewable:t.previewable,height:n?.naturalHeight}))}),{tag:Xi})}async#z(e,t){return e.previewable?new Promise((n=>{this.editor.update((()=>{const r=this.#w();r.addEventListener("load",(()=>{n()})),r.src=e.url,t.insertBefore(r,t.firstChild)}))})):Promise.resolve()}}class Au extends Hi{static getType(){return"horizontal_divider"}static clone(e){return new Au(e.__key)}static importJSON(e){return new Au}static importDOM(){return{hr:e=>({conversion:()=>({node:new Au}),priority:1})}}constructor(e){super(e)}createDOM(){const e=ku("figure",{className:"horizontal-divider"}),t=ku("hr");return e.addEventListener("click",(t=>{Su(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.appendChild(t),e}updateDOM(){return!0}isInline(){return!1}exportDOM(){return{element:ku("hr")}}exportJSON(){return{type:"horizontal_divider",version:1}}decorate(){return null}}const Lu=["bold","italic","strikethrough","link","unlink","rotateHeadingFormat","insertUnorderedList","insertOrderedList","insertQuoteBlock","insertCodeBlock","insertHorizontalDivider","uploadAttachments","undo","redo"];class Pu{static configureFor(e){new Pu(e)}constructor(e){this.editorElement=e,this.editor=e.editor,this.selection=e.selection,this.contents=e.contents,this.clipboard=e.clipboard,this.#$(),this.#U()}dispatchPaste(e){return this.clipboard.paste(e)}dispatchBold(){this.editor.dispatchCommand(Qt,"bold")}dispatchItalic(){this.editor.dispatchCommand(Qt,"italic")}dispatchStrikethrough(){this.editor.dispatchCommand(Qt,"strikethrough")}dispatchLink(e){this.#W(e)}dispatchUnlink(){this.#W(null)}dispatchInsertUnorderedList(){const e=ii();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"bullet"===Zc(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(gl,void 0)}dispatchInsertOrderedList(){const e=ii();if(!e)return;const t=e.anchor.getNode();this.selection.isInsideList&&t&&"number"===Zc(t)?this.contents.unwrapSelectedListItems():this.editor.dispatchCommand(pl,void 0)}dispatchInsertQuoteBlock(){this.contents.toggleNodeWrappingAllSelectedLines((e=>Ul(e)),(()=>$l()))}dispatchInsertCodeBlock(){this.editor.update((()=>{this.selection.hasSelectedWordsInSingleLine?this.editor.dispatchCommand(Qt,"code"):this.contents.toggleNodeWrappingAllSelectedLines((e=>lc(e)),(()=>new oc("plain")))}))}dispatchInsertHorizontalDivider(){this.editor.update((()=>{this.contents.insertAtCursor(new Au)}))}dispatchRotateHeadingFormat(){this.editor.update((()=>{const e=ii();if(!Ur(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow();let n="h2";if(Jl(t)){const e=t.getTag();n="h2"===e?"h3":"h3"===e?"h4":"h4"===e?null:"h2"}n?this.contents.insertNodeWrappingEachSelectedLine((()=>ql(n))):this.contents.removeFormattingFromSelectedLines()}))}dispatchUploadAttachments(){const e=ku("input",{type:"file",multiple:!0,onchange:({target:e})=>{const t=Array.from(e.files);if(t.length)for(const e of t)this.contents.uploadFile(e)}});document.body.appendChild(e),e.click(),setTimeout((()=>e.remove()),1e3)}dispatchUndo(){this.editor.dispatchCommand(en,void 0)}dispatchRedo(){this.editor.dispatchCommand(tn,void 0)}#$(){for(const t of Lu){const n=`dispatch${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;this.#H(t,0,this[n].bind(this))}var e;this.#H(Gt,1,this.dispatchPaste.bind(this))}#H(e,t,n){this.editor.registerCommand(e,n,t)}#W(e){this.editor.update((()=>{jc(null===e?null:e)}))}#U(){this.editorElement.supportsAttachments&&(this.dragCounter=0,this.editor.getRootElement().addEventListener("dragover",this.#K.bind(this)),this.editor.getRootElement().addEventListener("drop",this.#j.bind(this)),this.editor.getRootElement().addEventListener("dragenter",this.#q.bind(this)),this.editor.getRootElement().addEventListener("dragleave",this.#J.bind(this)))}#q(e){this.dragCounter++,1===this.dragCounter&&this.editor.getRootElement().classList.add("lexxy-editor--drag-over")}#J(e){this.dragCounter--,0===this.dragCounter&&this.editor.getRootElement().classList.remove("lexxy-editor--drag-over")}#K(e){e.preventDefault()}#j(e){e.preventDefault(),this.dragCounter=0,this.editor.getRootElement().classList.remove("lexxy-editor--drag-over");const t=e.dataTransfer;if(!t)return;const n=Array.from(t.files);if(n.length){for(const e of n)this.contents.uploadFile(e);this.editor.focus()}}}function Fu(){return new Promise(requestAnimationFrame)}class Ou{constructor(e){this.editorElement=e,this.editorContentElement=e.editorContentElement,this.editor=this.editorElement.editor,this.previouslySelectedKeys=new Set,this.#V(),this.#G(),this.#Z(),this.#Y()}clear(){this.current=null}set current(e){Hr(e)?(this._current=ii(),this.#X()):this.editor.update((()=>{this.#X(),this._current=null}))}get current(){return this._current}get cursorPosition(){let e={x:0,y:0};return this.editor.getEditorState().read((()=>{const t=this.#Q();if(!t)return;const n=this.#ee(t);n&&(e=this.#te(n,t))})),e}placeCursorAtTheEnd(){this.editor.update((()=>{Is().selectEnd()}))}get hasSelectedWordsInSingleLine(){const e=ii();if(!Ur(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(){const e=ii();if(!Ur(e))return!1;return null!==Gc(e.anchor.getNode())}get nodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ne();return e?Pr(e)?this.#re(e,t):Ui(e)?this.#ie(e,t):this.#se(e):null}get topLevelNodeAfterCursor(){const{anchorNode:e,offset:t}=this.#ne();return e?Pr(e)?this.#oe(e):Ui(e)?this.#ie(e,t):this.#se(e):null}get nodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ne();return e?Pr(e)?this.#ae(e,t):Ui(e)?this.#le(e,t):this.#ce(e):null}get topLevelNodeBeforeCursor(){const{anchorNode:e,offset:t}=this.#ne();return e?Pr(e)?this.#ue(e):Ui(e)?this.#le(e,t):this.#ce(e):null}get#de(){return this.editorElement.contents}get#he(){if(this._currentlySelectedKeys)return this._currentlySelectedKeys;if(this._currentlySelectedKeys=new Set,this.current)for(const e of this.current.getNodes())this._currentlySelectedKeys.add(e.getKey());return this._currentlySelectedKeys}#G(){this.editor.registerCommand(on,this.#ge.bind(this),1),this.editor.registerCommand(rn,this.#pe.bind(this),1),this.editor.registerCommand(ln,this.#fe.bind(this),1),this.editor.registerCommand(cn,this.#me.bind(this),1),this.editor.registerCommand(pn,this.#ye.bind(this),1),this.editor.registerCommand(hn,this.#_e.bind(this),1),this.editor.registerCommand(Wt,(()=>{this.current=ii()}),1)}#V(){this.editor.getRootElement().addEventListener("lexxy:internal:select-node",(async e=>{await Fu();const{key:t}=e.detail;this.editor.update((()=>{const e=Ns(t);if(e){const t=ni();t.add(e.getKey()),Ms(t)}this.editor.focus()}))})),this.editor.getRootElement().addEventListener("lexxy:internal:move-to-next-line",(e=>{this.#be()}))}#Z(){this.editor.getRootElement().addEventListener("keydown",(e=>{(function(e){return!(e.ctrlKey||e.metaKey||e.altKey||e.key.length>1&&"Enter"!==e.key&&"Space"!==e.key||1!==e.key.length)})(e)&&this.editor.update((()=>{const t=ii();if(Ur(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=t.anchor.offset,i=this.#xe(n,r),s=this.#ke(n,r);if(i instanceof Hi&&!i.isInline())return e.preventDefault(),void this.#de.createParagraphAfterNode(i,e.key);if(s instanceof Hi&&!s.isInline())return e.preventDefault(),void this.#de.createParagraphBeforeNode(s,e.key)}}))}),!0)}#xe(e,t){return Pr(e)&&0===t?e.getPreviousSibling():Ui(e)&&t>0?e.getChildAtIndex(t-1):null}#ke(e,t){return Pr(e)&&t===e.getTextContentSize()?e.getNextSibling():Ui(e)?e.getChildAtIndex(t):null}#Y(){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)}#X(){this.#ve(),this.#Se(),this.previouslySelectedKeys=this.#he,this._currentlySelectedKeys=null}#ve(){for(const e of this.previouslySelectedKeys)if(!this.#he.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.remove("node--selected")}}#Se(){for(const e of this.#he)if(!this.previouslySelectedKeys.has(e)){const t=this.editor.getElementByKey(e);t&&t.classList.add("node--selected")}}async#ge(){this.current?await this.#we((e=>e.selectPrevious())):this.#Ce(this.nodeBeforeCursor)}async#pe(){this.current?await this.#we((e=>e.selectNext(0,0))):this.#Ce(this.nodeAfterCursor)}async#fe(){this.current?await this.#we((e=>e.selectPrevious())):this.#Ce(this.topLevelNodeBeforeCursor)}async#me(){this.current?await this.#we((e=>e.selectNext(0,0))):this.#Ce(this.topLevelNodeAfterCursor)}async#we(e){await Fu(),this.current&&this.editor.update((()=>{this.clear(),e(this.current.getNodes()[0]),this.editor.focus()}))}async#be(){this.editor.update((()=>{const e=this.#Te();e&&this.#Ee(e)}))}#Te(){const e=ii();return e?Hr(e)?this.#Ne(e):Ur(e)?this.#Ae(e):null:null}#Ne(e){const t=e.getNodes();return t.length>0?t[0].getTopLevelElement():null}#Ae(e){return e.anchor.getNode().getTopLevelElement()}#Ee(e){const t=e.getNextSibling();t?t.selectStart():this.#Le()}#Le(){const e=Is(),t=ss();e.append(t),t.selectStart()}#Ce(e){e&&e instanceof Hi&&this.editor.update((()=>{const t=ni();t.add(e.getKey()),Ms(t)}))}#ye(){const e=this.nodeAfterCursor;return e instanceof Hi?this.#Ce(e):this.#de.deleteSelectedNodes(),!0}#_e(){const e=this.nodeBeforeCursor;return e instanceof Hi?this.#Ce(e):this.#de.deleteSelectedNodes(),!0}#Q(){const e=ii();if(!e||!e.isCollapsed())return null;const t=window.getSelection();return t&&0!==t.rangeCount?t.getRangeAt(0):null}#ee(e){let t=e.getBoundingClientRect();if(this.#Pe(t)){const n=this.#Fe(e);t=n.getBoundingClientRect(),this.#Oe(n),n.remove()}return t}#Pe(e){return 0===e.width&&0===e.height||0===e.top&&0===e.left}#Fe(e){const t=this.#Ie();return e.insertNode(t),t}#Ie(){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",va()),e}#Oe(e){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.setStartAfter(e),n.collapse(!0),t.addRange(n)}#te(e,t){const n=this.editor.getRootElement().getBoundingClientRect(),r=e.left-n.left;let i=e.top-n.top;const s=this.#Re(t);return isNaN(s)||(i+=s),{x:r,y:i,fontSize:s}}#Re(e){const t=window.getSelection().anchorNode,n=this.#Me(t);if(n instanceof HTMLElement){const e=window.getComputedStyle(n);return parseFloat(e.fontSize)}return 0}#Me(e){return e?.nodeType===Node.TEXT_NODE?e.parentElement:e}#ne(){const e=ii();if(!Ur(e)||!e.isCollapsed())return{anchorNode:null,offset:0};const{anchor:t}=e;return{anchorNode:t.getNode(),offset:t.offset}}#re(e,t){return t===e.getTextContentSize()?this.#oe(e):null}#oe(e){if(e.getNextSibling()instanceof Hi)return e.getNextSibling();const t=e.getParent();return t?t.getNextSibling():null}#ie(e,t){return t0?e.getChildAtIndex(t-1):this.#ce(e)}#se(e){let t=e;for(;t&&null==t.getNextSibling();)t=t.getParent();return t?t.getNextSibling():null}#ce(e){let t=e;for(;t&&null==t.getPreviousSibling();)t=t.getParent();return t?t.getPreviousSibling():null}}class Iu extends Hi{static getType(){return"custom_action_text_attachment"}static clone(e){return new Iu({...e},e.__key)}static importJSON(e){return new Iu({...e})}static importDOM(){return{"action-text-attachment":e=>{const t=e.getAttribute("content");return e.getAttribute("content")?{conversion:()=>{const n=[],r=e.previousSibling;return r&&r.nodeType===Node.TEXT_NODE&&/\s$/.test(r.textContent)&&n.push(Lr(" ")),n.push(new Iu({sgid:e.getAttribute("sgid"),innerHtml:JSON.parse(t),contentType:e.getAttribute("content-type")})),n.push(Lr(" ")),{node:n}},priority:2}:null}}}constructor({sgid:e,contentType:t,innerHtml:n},r){super(r),this.sgid=e,this.contentType=t||"application/vnd.actiontext.unknown",this.innerHtml=n}createDOM(){const e=ku("action-text-attachment",{"content-type":this.contentType,"data-lexxy-decorator":!0});return e.addEventListener("click",(t=>{Su(e,"lexxy:internal:select-node",{key:this.getKey()})})),e.insertAdjacentHTML("beforeend",this.innerHtml),e}updateDOM(){return!0}isInline(){return!0}exportDOM(){return{element:ku("action-text-attachment",{sgid:this.sgid,content:JSON.stringify(this.innerHtml),"content-type":this.contentType})}}exportJSON(){return{type:"custom_action_text_attachment",version:1,sgid:this.sgid,contentType:this.contentType,innerHtml:this.innerHtml}}decorate(){return null}}class Ru{constructor(e){this.editorElement=e,this.editor=e.editor}insertHtml(e){this.editor.update((()=>{const t=ii();if(!Ur(t))return;const n=yl(this.editor,vu(e));t.insertNodes(n)}))}insertAtCursor(e){this.editor.update((()=>{const t=ii(),n=t?.getNodes();if(Ur(t))di([e]);else if(Hr(t)&&n&&n.length>0){n[n.length-1].insertAfter(e)}else{Is().append(e)}}))}insertNodeWrappingEachSelectedLine(e){this.editor.update((()=>{const t=ii();if(!Ur(t))return;t.extract().forEach((t=>{if(!t.getParent())return;const n=t.getTopLevelElementOrThrow(),r=e();r.append(...n.getChildren()),n.replace(r)}))}))}toggleNodeWrappingAllSelectedLines(e,t){this.editor.update((()=>{const n=ii();if(!Ur(n))return;const r=n.anchor.getNode().getTopLevelElementOrThrow();e(r)?this.removeFormattingFromSelectedLines():this.insertNodeWrappingAllSelectedLines(t)}))}insertNodeWrappingAllSelectedLines(e){this.editor.update((()=>{const t=ii();Ur(t)&&(t.isCollapsed()?this.#De(t,e):this.#ze(t,e))}))}removeFormattingFromSelectedLines(){this.editor.update((()=>{const e=ii();if(!Ur(e))return;const t=e.anchor.getNode().getTopLevelElementOrThrow(),n=ss();n.append(...t.getChildren()),t.replace(n)}))}hasSelectedText(){let e=!1;return this.editor.read((()=>{const t=ii();e=Ur(t)&&!t.isCollapsed()})),e}unwrapSelectedListItems(){this.editor.update((()=>{const e=ii();if(!Ur(e))return;const{listItems:t,parentLists:n}=this.#Be(e);if(t.size>0){const e=this.#$e(t);this.#Ue(n),this.#We(e)}}))}createLink(e){let t=null;return this.editor.update((()=>{const n=Lr(e),r=Bc(e);r.append(n);const i=ii();Ur(i)&&(i.insertNodes([r]),t=r.getKey())})),t}createLinkWithSelectedText(e){this.hasSelectedText()&&this.editor.update((()=>{jc(e)}))}textBackUntil(e){let t="";return this.editor.getEditorState().read((()=>{const n=ii();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Pr(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o),l=a.lastIndexOf(e);-1!==l&&(t=a.slice(l+e.length))})),t}containsTextBackUntil(e){let t=!1;return this.editor.getEditorState().read((()=>{const n=ii();if(!n||!n.isCollapsed())return;const r=n.anchor,i=r.getNode();if(!Pr(i))return;const s=i.getTextContent(),o=r.offset,a=s.slice(0,o);t=a.includes(e)})),t}replaceTextBackUntil(e,t){t=Array.isArray(t)?t:[t],this.editor.update((()=>{const{anchorNode:n,offset:r}=this.#He();if(!n)return;const i=this.#Ke(n,r,e);-1!==i&&this.#je(n,r,i,t)}))}createParagraphAfterNode(e,t){const n=ss();e.insertAfter(n),n.selectStart(),t&&(n.append(Lr(t)),n.select(1,1))}createParagraphBeforeNode(e,t){const n=ss();e.insertBefore(n),n.selectStart(),t&&(n.append(Lr(t)),n.select(1,1))}uploadFile(e){if(!this.editorElement.supportsAttachments)return void console.warn("This editor does not supports attachments (it's configured with [attachments=false])");if(!this.#qe(e))return;const t=this.editorElement.directUploadUrl,n=this.editorElement.blobUrlTemplate;this.editor.update((()=>{const r=new Nu({file:e,uploadUrl:t,blobUrlTemplate:n,editor:this.editor});this.insertAtCursor(r)}),{tag:Xi})}async deleteSelectedNodes(){let e=null;this.editor.update((()=>{if(Hr(this.#Je.current)){const t=this.#Je.current.getNodes();if(0===t.length)return;e=this.#Ve(t),this.#Ge(t)}})),await Fu(),this.editor.update((()=>{this.#Ze(e),this.#Je.clear(),this.editor.focus()}))}replaceNodeWithHTML(e,t,n={}){this.editor.update((()=>{const r=Ns(e);if(!r)return;const i=ii();let s=!1;if(Ur(i)){const e=i.getNodes();s=e.includes(r)||e.some((e=>e.getParent()===r)),s&&Ms(null)}const o=n.attachment?this.#Ye(t,n.attachment):this.#Xe(t);r.replace(o),s&&o.selectEnd()}))}insertHTMLBelowNode(e,t,n={}){this.editor.update((()=>{const r=Ns(e);if(!r)return;let i=r;try{i=r.getTopLevelElementOrThrow()}catch{}const s=n.attachment?this.#Ye(t,n.attachment):this.#Xe(t);i.insertAfter(s)}))}get#Je(){return this.editorElement.selection}#De(e,t){const n=e.anchor.getNode().getTopLevelElementOrThrow();if(n.getTextContent()){const e=t();e.append(...n.getChildren()),n.replace(e)}else di([t()])}#ze(e,t){const n=this.#Qe(e);if(0===n.length)return;const{lineSet:r,nodesToDelete:i}=this.#et(n);if(0===r.size)return;const s=this.#tt(t,r);this.#nt(e,s),this.#rt(i)}#Qe(e){const t=e.extract().map((e=>this.#it(e))).filter(Boolean);return Ms(null),t}#it(e){return os(e)?e:Pr(e)&&e.getParent()&&os(e.getParent())?e.getParent():null}#et(e){const t=new Set,n=new Set;return e.forEach((e=>{const r=e.getTextContent();r&&r.split("\n").forEach((e=>{e.trim()&&t.add(e)})),n.add(e)})),{lineSet:t,nodesToDelete:n}}#tt(e,t){const n=e(),r=Array.from(t);return r.forEach(((e,t)=>{n.append(Lr(e)),te.remove()))}#Ge(e){e.forEach((e=>{const t=e.getParent();if(!Ui(t))return;const n=t.getChildren().indexOf(e);n>=0&&t.splice(n,1,[])}))}#Ve(e){const t=e[0],n=e[e.length-1];return t?.getPreviousSibling()||n?.getNextSibling()}#Ze(e){const t=Is();if(0===t.getChildrenSize()){const e=ss();t.append(e),e.selectStart()}else e&&(Pr(e)||os(e)?e.selectEnd():e.selectNext(0,0))}#Be(e){const t=e.getNodes(),n=new Set,r=new Set;for(const e of t){const t=Gc(e);if(t){n.add(t);const e=t.getParent();e&&hl(e)&&r.add(e)}}return{listItems:n,parentLists:r}}#$e(e){const t=[];for(const n of e){const e=this.#st(n);e&&t.push(e)}return t}#st(e){const t=e.getParent();if(!t||!hl(t))return null;const n=ss(),r=this.#ot(e,n);return e.insertAfter(n),this.#at(n,r),e.remove(),n}#ot(e,t){const n=[];return e.getChildren().forEach((e=>{hl(e)?n.push(e):t.append(e)})),n}#at(e,t){t.forEach((t=>{e.insertAfter(t)}))}#Ue(e){for(const t of e)hl(t)&&0===t.getChildrenSize()&&t.remove()}#We(e){if(0===e.length)return;const t=e[0],n=e[e.length-1];1===e.length?t.selectEnd():this.#lt(t,n)}#lt(e,t){e.selectStart();const n=ii();n&&Ur(n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(t.getKey(),t.getChildrenSize(),"element"))}#He(){const e=ii();if(!e||!e.isCollapsed())return{anchorNode:null,offset:0};const t=e.anchor,n=t.getNode();return Pr(n)?{anchorNode:n,offset:t.offset}:{anchorNode:null,offset:0}}#Ke(e,t,n){return e.getTextContent().slice(0,t).lastIndexOf(n)}#je(e,t,n,r){const i=e.getTextContent(),s=i.slice(0,n),o=i.slice(t),a=Lr(s),l=Lr(o||" ");e.replace(a);this.#ct(a,r).insertAfter(l),this.#ut(l.getParentOrThrow()),l.select(0,0)}#ct(e,t){let n=e;for(const e of t)n.insertAfter(e),n=e;return n}#ut(e){if(os(e)&&!this.editorElement.isSingleLineMode){const t=e.getChildren(),n=t[t.length-1],r=t[t.length-2];Pr(n)&&""===n.getTextContent()&&r&&!Pr(r)&&e.append(hr())}}#Ye(e,t={}){return new Iu({sgid:("object"==typeof t?t:{}).sgid||null,contentType:"text/html",innerHtml:e})}#Xe(e){return yl(this.editor,vu(e))[0]||ss()}#qe(e){return wu(this.editorElement,"lexxy:file-accept",{file:e},!0)}}function Mu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Du={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function zu(e){Du=e}var Bu={exec:()=>null};function $u(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(Uu.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Uu={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:/^
    /i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,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")},Wu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Hu=/(?:[*+-]|\d{1,9}[.)])/,Ku=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ju=$u(Ku).replace(/bull/g,Hu).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(),qu=$u(Ku).replace(/bull/g,Hu).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(),Ju=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Vu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Gu=$u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Vu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Zu=$u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hu).getRegex(),Yu="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",Xu=/|$))/,Qu=$u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Xu).replace("tag",Yu).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ed=$u(Ju).replace("hr",Wu).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",")|<(?:script|pre|style|textarea|!--)").replace("tag",Yu).getRegex(),td={blockquote:$u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ed).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Gu,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Wu,html:Qu,lheading:ju,list:Zu,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:ed,table:Bu,text:/^[^\n]+/},nd=$u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Wu).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",")|<(?:script|pre|style|textarea|!--)").replace("tag",Yu).getRegex(),rd={...td,lheading:qu,table:nd,paragraph:$u(Ju).replace("hr",Wu).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",nd).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",Yu).getRegex()},id={...td,html:$u("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Xu).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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Bu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$u(Ju).replace("hr",Wu).replace("heading"," *#{1,6} *[^\n]").replace("lheading",ju).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},sd=/^( {2,}|\\)\n(?!\s*$)/,od=/[\p{P}\p{S}]/u,ad=/[\s\p{P}\p{S}]/u,ld=/[^\s\p{P}\p{S}]/u,cd=$u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ad).getRegex(),ud=/(?!~)[\p{P}\p{S}]/u,dd=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,hd=$u(dd,"u").replace(/punct/g,od).getRegex(),gd=$u(dd,"u").replace(/punct/g,ud).getRegex(),pd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fd=$u(pd,"gu").replace(/notPunctSpace/g,ld).replace(/punctSpace/g,ad).replace(/punct/g,od).getRegex(),md=$u(pd,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,ud).getRegex(),yd=$u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ld).replace(/punctSpace/g,ad).replace(/punct/g,od).getRegex(),_d=$u(/\\(punct)/,"gu").replace(/punct/g,od).getRegex(),bd=$u(/^<(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(),xd=$u(Xu).replace("(?:--\x3e|$)","--\x3e").getRegex(),kd=$u("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",xd).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),vd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,Sd=$u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",vd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),wd=$u(/^!?\[(label)\]\[(ref)\]/).replace("label",vd).replace("ref",Vu).getRegex(),Cd=$u(/^!?\[(ref)\](?:\[\])?/).replace("ref",Vu).getRegex(),Td={_backpedal:Bu,anyPunctuation:_d,autolink:bd,blockSkip:/\[[^\[\]]*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,br:sd,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Bu,emStrongLDelim:hd,emStrongRDelimAst:fd,emStrongRDelimUnd:yd,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Sd,nolink:Cd,punctuation:cd,reflink:wd,reflinkSearch:$u("reflink|nolink(?!\\()","g").replace("reflink",wd).replace("nolink",Cd).getRegex(),tag:kd,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Od=e=>Fd[e];function Id(e,t){if(t){if(Uu.escapeTest.test(e))return e.replace(Uu.escapeReplace,Od)}else if(Uu.escapeTestNoEncode.test(e))return e.replace(Uu.escapeReplaceNoEncode,Od);return e}function Rd(e){try{e=encodeURI(e).replace(Uu.percentDecode,"%")}catch{return null}return e}function Md(e,t){let n=e.replace(Uu.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})),r=n.split(Uu.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.length0)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:Dd(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=Dd(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:Dd(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Dd(t[0],"\n").split("\n"),n="",r="",i=[];for(;e.length>0;){let t,s=!1,o=[];for(t=0;t1,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 s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,a=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,a=l.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),s=this.rules.other.headingBeginRegex(d),o=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)||s.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(h.search(this.rules.other.nonSpaceChar)>=d||!c.trim())a+="\n"+h.slice(d);else{if(u||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||s.test(l)||n.test(l))break;a+="\n"+c}!u&&!c.trim()&&(u=!0),r+=g+"\n",e=e.substring(g.length+1),l=h.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let h,g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(a),g&&(h="[ ] "!==g[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!g,checked:h,loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;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({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]}))));return s}}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=Dd(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;r0?-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)),zd(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 zd(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,s=[...r[0]].length-1,o=s,a=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(r=l.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]){o+=i;continue}if((r[5]||r[6])&&s%3&&!((s+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);let t=[...r[0]][0].length,l=e.slice(0,s+r.index+t+i);if(Math.min(s,i)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,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}}}},$d=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Du,this.options.tokenizer=this.options.tokenizer||new Bd,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:Uu,block:Ld.normal,inline:Pd.normal};this.options.pedantic?(t.block=Ld.pedantic,t.inline=Pd.pedantic):this.options.gfm&&(t.block=Ld.gfm,this.options.breaks?t.inline=Pd.breaks:t.inline=Pd.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ld,inline:Pd}}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(Uu.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e!!(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 s=t.at(-1);n&&"paragraph"===s?.type?(s.raw+=(s.raw.endsWith("\n")?"":"\n")+r.raw,s.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.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,s="";for(;e;){let r;if(i||(s=""),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,s)){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 o=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&&(o=e.substring(0,n+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=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}},Ud=class{options;parser;constructor(e){this.options=e||Du}space(e){return""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(Uu.notSpaceStart)?.[0],i=e.replace(Uu.endingNewline,"")+"\n";return r?'
    '+(n?i:Id(i,!0))+"
    \n":"
    "+(n?i:Id(i,!0))+"
    \n"}blockquote({tokens:e}){return`
    \n${this.parser.parse(e)}
    \n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}\n`}hr(e){return"
    \n"}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t\n"+r+"\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+" "+Id(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),`
  • ${t}
  • \n`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    \n`}table(e){let t="",n="";for(let t=0;t${r}`),"\n\n"+t+"\n"+r+"
    \n"}tablerow({text:e}){return`\n${e}\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`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Id(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Rd(e);if(null===i)return r;let s='
    ",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Rd(e);if(null===i)return Id(n);let s=`${n}{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 Ud(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Bd(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],s=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Kd;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],s=t[r];Kd.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Kd.passThroughHooksRespectAsync.has(n))return Promise.resolve(i.call(t,e)).then((e=>s.call(t,e)));let r=i.call(t,e);return s.call(t,r)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=s.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 $d.lex(e,t??this.defaults)}parser(e,t){return Hd.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(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 s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);let o=i.hooks?i.hooks.provideLexer():e?$d.lex:$d.lexInline,a=i.hooks?i.hooks.provideParser():e?Hd.parse:Hd.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then((e=>o(e,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>a(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=a(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return s(e)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="

    An error occurred:

    "+Id(n.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function qd(e,t){return jd.parse(e,t)}function Jd(e){try{return new URL(e),!0}catch{return!1}}function Vd(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}qd.options=qd.setOptions=function(e){return jd.setOptions(e),qd.defaults=jd.defaults,zu(qd.defaults),qd},qd.getDefaults=Mu,qd.defaults=Du,qd.use=function(...e){return jd.use(...e),qd.defaults=jd.defaults,zu(qd.defaults),qd},qd.walkTokens=function(e,t){return jd.walkTokens(e,t)},qd.parseInline=jd.parseInline,qd.Parser=Hd,qd.parser=Hd.parse,qd.Renderer=Ud,qd.TextRenderer=Wd,qd.Lexer=$d,qd.lexer=$d.lex,qd.Tokenizer=Bd,qd.Hooks=Kd,qd.parse=qd,qd.options,qd.setOptions,qd.use,qd.walkTokens,qd.parseInline,Hd.parse,$d.lex;class Gd{constructor(e){this.editorElement=e,this.editor=e.editor,this.contents=e.contents}paste(e){const t=e.clipboardData;return!!t&&(this.#dt(t)?(this.#ht(t),e.preventDefault(),!0):void this.#gt(t))}#dt(e){const t=Array.from(e.types);return 1===t.length&&"text/plain"===t[0]}#ht(e){e.items[0].getAsString((e=>{if(Jd(e)&&this.contents.hasSelectedText())this.contents.createLinkWithSelectedText(e);else if(Jd(e)){const t=this.contents.createLink(e);this.#pt(t,{url:e})}else this.#ft(e)}))}#pt(e,t){const n={replaceLinkWith:(t,n)=>this.contents.replaceNodeWithHTML(e,t,n),insertBelowLink:(t,n)=>this.contents.insertHTMLBelowNode(e,t,n)};wu(this.editorElement,"lexxy:insert-link",{...t,...n})}#ft(e){const t=qd(e);this.contents.insertHtml(t)}#gt(e){if(!this.editorElement.supportsAttachments)return;e.getData("text/html")||this.#mt((()=>{for(const t of e.items){const e=t.getAsFile();e&&this.contents.uploadFile(e)}}))}async#mt(e){const t=window.scrollY,n=window.scrollX;e(),await Fu(),window.scrollTo(n,t),this.editor.focus()}}class Zd extends HTMLElement{static formAssociated=!0;static debug=!0;static commands=["bold","italic","strikethrough"];static observedAttributes=["connected","required"];#yt="";#_t=document.createElement("textarea");constructor(){super(),this.internals=this.attachInternals(),this.internals.role="presentation"}connectedCallback(){this.id??=Cu("lexxy-editor"),this.editor=this.#bt(),this.contents=new Ru(this),this.selection=new Ou(this),this.clipboard=new Gd(this),Pu.configureFor(this),this.#xt(),requestAnimationFrame((()=>wu(this,"lexxy:initialize"))),this.toggleAttribute("connected",!0),this.valueBeforeDisconnect=null}disconnectedCallback(){this.valueBeforeDisconnect=this.value,this.#kt()}attributeChangedCallback(e,t,n){"connected"===e&&this.isConnected&&null!=t&&t!==n&&requestAnimationFrame((()=>this.#vt())),"required"===e&&this.isConnected&&(this.#_t.required=this.hasAttribute("required"),this.#St())}formResetCallback(){this.value=this.#yt,this.editor.dispatchCommand(Nn,void 0)}get form(){return this.internals.form}get toolbarElement(){return this.#wt?(this.toolbar=this.toolbar||this.#Ct(),this.toolbar):null}get directUploadUrl(){return this.dataset.directUploadUrl}get blobUrlTemplate(){return this.dataset.blobUrlTemplate}get isSingleLineMode(){return this.hasAttribute("single-line")}get supportsAttachments(){return"false"!==this.getAttribute("attachments")}focus(){this.editor.focus()}get value(){return this.cachedValue||this.editor?.getEditorState().read((()=>{this.cachedValue=function(e){return se.sanitize(e,{ALLOWED_TAGS:bu,ALLOWED_ATTR:xu,SAFE_FOR_XML:!1})}(_l(this.editor,null))})),this.cachedValue}set value(e){this.editor.update((()=>{ao(ts);const t=Is();t.clear(),""!==e&&t.append(...this.#Tt(e)),t.select(),this.#Et(),requestAnimationFrame((()=>this.editor?.update((()=>{}))))}))}#Tt(e){e||(e="

    ");return yl(this.editor,vu(`
    ${e}
    `)).map((e=>{if("paragraph"===e.getType()&&1===e.getChildrenSize()){const t=e.getFirstChild();if(t instanceof Hi&&!t.isInline())return t}return e}))}#xt(){this.#Nt(),this.#At(),this.#Lt(),this.#Pt(),this.#Ft(),this.#Ot(),this.#It(),this.#Rt()}#bt(){this.editorContentElement=this.editorContentElement||this.#Mt();const e=ls({namespace:"LexicalEditor",onError(e){throw e},theme:yu,nodes:this.#Dt});return e.setRootElement(this.editorContentElement),e}get#Dt(){const e=[Bl,Wl,ol,tl,oc,yc,Dc,Uc,Au,Iu];return this.supportsAttachments&&e.push(Eu,Nu),e}#Mt(){const e=ku("div",{classList:"lexxy-editor__content",contenteditable:!0,role:"textbox","aria-multiline":!0,"aria-label":this.#zt,placeholder:this.getAttribute("placeholder")});return e.id=`${this.id}-content`,this.#Bt.forEach((t=>e.setAttribute(t.name,t.value))),this.appendChild(e),this.getAttribute("tabindex")?(e.setAttribute("tabindex",this.getAttribute("tabindex")),this.removeAttribute("tabindex")):e.setAttribute("tabindex",0),e}get#zt(){return Array.from(this.internals.labels).map((e=>e.textContent)).join(" ")}get#Bt(){return Array.from(this.attributes).filter((e=>e.name.startsWith("aria-")))}set#$t(e){const t=void 0!==this.#$t&&this.#$t!==this.value;this.internals.setFormValue(e),this._internalFormValue=e,this.#_t.value=this.#Ut?"":e,t&&wu(this,"lexxy:change")}get#$t(){return this._internalFormValue}#It(){const e=this.valueBeforeDisconnect||this.getAttribute("value")||"

    ";this.value=this.#yt=e}#Rt(){document.addEventListener("turbo:before-cache",this.#Wt)}#Wt=e=>{this.#kt()};#Nt(){this.#Ht(this.editor.registerUpdateListener((({editorState:e})=>{this.cachedValue=null,this.#$t=this.value,this.#Et(),this.#St()})))}#Ht(e){this.unregisterHandlers=this.unregisterHandlers||[],this.unregisterHandlers.push(e)}#Kt(){this.unregisterHandlers?.forEach((e=>{e()})),this.unregisterHandlers=null}#At(){Xl(this.editor),this.historyState={current:null,redoStack:[],undoStack:[]},function(e,t,n){const r=fu(e,n),i=Ia(e.registerCommand(en,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const i=t.current,s=r.pop();null!==i&&(n.push(i),e.dispatchCommand(An,!0)),0===r.length&&e.dispatchCommand(Ln,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:Yi})}}(e,t),!0)),0),e.registerCommand(tn,(()=>(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(Ln,!0));const s=n.pop();0===n.length&&e.dispatchCommand(An,!1),t.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:Yi})}}(e,t),!0)),0),e.registerCommand(En,(()=>(mu(t),!1)),0),e.registerCommand(Nn,(()=>(mu(t),e.dispatchCommand(An,!1),e.dispatchCommand(Ln,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:s,dirtyElements:o,tags:a})=>{const l=t.current,c=t.redoStack,u=t.undoStack,d=null===l?null:l.editorState;if(null!==l&&n===d)return;const h=r(i,n,l,s,o,a);if(1===h)0!==c.length&&(t.redoStack=[],e.dispatchCommand(An,!1)),null!==l&&(u.push({...l}),e.dispatchCommand(Ln,!0));else if(2===h)return;t.current={editor:e,editorState:n}})))}(this.editor,this.historyState,20),ml(this.editor),this.#jt(),ru(this.editor,gu)}#jt(){!function(e,t){if(!e.hasNodes([oc,yc]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==t&&(t=wc);const n=[];!0!==e._headless&&n.push(e.registerMutationListener(oc,(t=>{e.update((()=>{for(const[n,r]of t)if("destroyed"!==r){const t=Ns(n);null!==t&&Tc(t,e)}}))}),{skipInitialization:!1})),n.push(e.registerNodeTransform(oc,(n=>Nc(n,e,t))),e.registerNodeTransform(kr,(n=>Cc(n,e,t))),e.registerNodeTransform(yc,(n=>Cc(n,e,t))),e.registerCommand(fn,(t=>{const n=function(e){const t=ii();if(!Ur(t)||!Pc(t))return null;const n=e?_n:yn,r=e?_n:mn,i=t.anchor,s=t.focus;if(i.is(s))return r;const o=Fc(t);if(1!==o.length)return n;const a=o[0];let l,c;0===a.length&&ec(285),t.isBackward()?(l=s,c=i):(l=i,c=s);const u=vc(a[0]),d=Sc(a[0]),h=Dr(u.getKey(),0,"text"),g=Dr(d.getKey(),d.getTextContentSize(),"text");return l.isBefore(h)||g.isBefore(c)?n:h.isBefore(l)||c.isBefore(g)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n,void 0),!0)}),1),e.registerCommand(mn,(()=>!!Pc(ii())&&(di([Ir()]),!0)),1),e.registerCommand(yn,(e=>Oc(yn)),1),e.registerCommand(_n,(e=>Oc(_n)),1),e.registerCommand(ln,(e=>{const t=ii();if(!Ur(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Pc(t)&&(t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&lc(r.getParentOrThrow())?(e.preventDefault(),!0):Ic(ln,e))}),1),e.registerCommand(cn,(e=>{const t=ii();if(!Ur(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Pc(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&lc(r.getParentOrThrow())?(e.preventDefault(),!0):Ic(cn,e))}),1),e.registerCommand(an,(e=>Rc(an,e)),1),e.registerCommand(sn,(e=>Rc(sn,e)),1)),Ia(...n)}(this.editor),this.append(ku("lexxy-code-language-picker"))}#Lt(){this.editor.getRootElement().addEventListener("lexxy:internal:invalidate-node",(e=>{const{key:t,values:n}=e.detail;this.editor.update((()=>{const e=Ns(t);if(e instanceof Eu){const t=e.getWritable();Object.assign(t,n)}}))}))}#Pt(){this.editor.registerCommand(un,(e=>(e.ctrlKey||e.metaKey||!!this.isSingleLineMode)&&(e.preventDefault(),!0)),2)}#Ft(){Zd.debug&&this.#Ht(this.editor.registerUpdateListener((({editorState:e})=>{e.read((()=>{console.debug("HTML: ",this.value)}))})))}#Ot(){this.#wt&&this.toolbarElement.setEditor(this)}#Ct(){const e=this.getAttribute("toolbar");return e?document.getElementById(e):this.#qt()}get#wt(){return"false"!==this.getAttribute("toolbar")}#qt(){const e=ku("lexxy-toolbar");return e.innerHTML=Yc.defaultTemplate,this.prepend(e),e}#Et(){this.classList.toggle("lexxy-editor--empty",this.#Ut)}get#Ut(){return!this.editorContentElement.textContent.trim()&&!this.editorContentElement.querySelector(_u)}#St(){this.#_t.validity.valid?this.internals.setValidity({}):this.internals.setValidity(this.#_t.validity,this.#_t.validationMessage,this.editorContentElement)}#kt(){this.#Kt(),this.editorContentElement&&(this.editorContentElement.remove(),this.editorContentElement=null),this.contents=null,this.editor=null,this.toolbar&&(this.getAttribute("toolbar")||this.toolbar.remove(),this.toolbar=null),this.selection=null,document.removeEventListener("turbo:before-cache",this.#Wt)}#vt(){this.disconnectedCallback(),this.connectedCallback()}}customElements.define("lexxy-editor",Zd);class Yd extends HTMLElement{connectedCallback(){this.dialog=this.querySelector("dialog"),this.input=this.querySelector("input"),this.addEventListener("submit",this.#Jt.bind(this)),this.querySelector("[value='unlink']").addEventListener("click",this.#Vt.bind(this)),this.addEventListener("keydown",this.#Gt.bind(this))}show(e){this.input.value=this.#Zt,this.dialog.show()}close(){this.dialog.close()}#Jt(e){const t=e.submitter?.value;this.#Yt.dispatchCommand(t,this.input.value)}#Vt(e){this.#Yt.dispatchCommand("unlink"),this.close()}#Gt(e){"Escape"===e.key&&(e.stopPropagation(),this.close())}get#Zt(){let e="";return this.#Yt.getEditorState().read((()=>{const t=ii();if(!Ur(t))return;let n=t.getNodes()[0];for(;n&&n.getParent();){if($c(n)){e=n.getURL();break}n=n.getParent()}})),e}get#Yt(){return this.closest("lexxy-toolbar").editor}}customElements.define("lexxy-link-dialog",Yd);class Xd{async buildListItems(e=""){return Promise.resolve([])}promptItemFor(e){return null}buildListItemElementFor(e){const t=e.querySelector("template[type='menu']").content.cloneNode(!0),n=ku("li",{role:"option",id:Cu("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=vu(await t.text()).querySelectorAll("lexxy-prompt-item");return Promise.resolve(Array.from(n))}catch(e){return Promise.reject(e)}}}class Qd extends Xd{async buildListItems(e=""){const t=await this.fetchPromptItems();return this.#Xt(t,e)}async fetchPromptItems(e){return Promise.resolve([])}promptItemFor(e){return this.promptItemByListItem.get(e)}#Xt(e,t){const n=[];return this.promptItemByListItem=new WeakMap,e.forEach((e=>{const r=e.getAttribute("search");if(!t||function(e,t){return Vd(e).includes(Vd(t))}(r,t)){const t=this.buildListItemElementFor(e);this.promptItemByListItem.set(t,e),n.push(t)}})),n}}class eh extends Qd{constructor(e){super(),this.inlinePromptItemElements=Array.from(e)}async fetchPromptItems(){return Promise.resolve(this.inlinePromptItemElements)}}class th extends Qd{constructor(e){super(),this.url=e,this.fetchPromptItems()}async fetchPromptItems(){return this.promptItems??=await this.loadPromptItemsFromUrl(this.url),Promise.resolve(this.promptItems)}}class nh extends Xd{constructor(e){super(),this.baseURL=e,this.loadAndFilterListItems=function(e,t){let n;return(...r)=>(clearTimeout(n),new Promise(((i,s)=>{n=setTimeout((async()=>{try{const t=await e(...r);i(t)}catch(e){s(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.#Qt(e));return this.#Xt(t)}#Qt(e){const t=new URL(this.baseURL,window.location.origin);return t.searchParams.append("filter",e),t.toString()}#Xt(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 rh extends HTMLElement{constructor(){super(),this.keyListeners=[]}connectedCallback(){this.source=this.#en(),this.#tn()}disconnectedCallback(){this.source=null,this.popoverElement=null}get name(){return this.getAttribute("name")}get trigger(){return this.getAttribute("trigger")}get supportsSpaceInSearches(){return this.hasAttribute("supports-space-in-searches")}get#nn(){return!this.supportsSpaceInSearches}#en(){const e=this.getAttribute("src");return e?this.hasAttribute("remote-filtering")?new nh(e):new th(e):new eh(this.querySelectorAll("lexxy-prompt-item"))}#tn(){const e=this.#Yt.registerUpdateListener((()=>{this.#Yt.read((()=>{const t=ii();if(!t)return;let n;if(Ur(t)?n=t.anchor.getNode():Hr(t)&&([n]=t.getNodes()),n&&Pr(n)){[...n.getTextContent().trim()].pop()===this.trigger&&(e(),this.#rn())}}))}))}get#Yt(){return this.#in.editor}get#in(){return this.closest("lexxy-editor")}get#Je(){return this.#in.selection}async#rn(){this.popoverElement??=await this.#sn(),await this.#on(),this.#an(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!0),this.#ln(),this.#in.addEventListener("keydown",this.#cn),this.#in.addEventListener("lexxy:change",this.#on),this.#un()}#un(){this.keyListeners.push(this.#Yt.registerCommand(un,this.#dn.bind(this),3)),this.keyListeners.push(this.#Yt.registerCommand(fn,this.#dn.bind(this),3)),this.#nn&&this.keyListeners.push(this.#Yt.registerCommand(dn,this.#dn.bind(this),3))}#ln(){const e=this.#hn[0];e&&this.#gn(e)}get#hn(){return Array.from(this.popoverElement.querySelectorAll(".lexxy-prompt-menu__item"))}#gn(e){this.#pn(),e.toggleAttribute("aria-selected",!0),e.focus(),this.#in.focus(),this.#fn.setAttribute("aria-controls",this.popoverElement.id),this.#fn.setAttribute("aria-activedescendant",e.id),this.#fn.setAttribute("aria-haspopup","listbox")}#pn(){this.#hn.forEach((e=>{e.toggleAttribute("aria-selected",!1)})),this.#fn.removeAttribute("aria-controls"),this.#fn.removeAttribute("aria-activedescendant"),this.#fn.removeAttribute("aria-haspopup")}#an(){const{x:e,y:t,fontSize:n}=this.#Je.cursorPosition,r=this.#in.getBoundingClientRect(),i=this.#fn.getBoundingClientRect().top-r.top;this.popoverElement.style.left=`${e}px`,this.popoverElement.style.top=`${t+i}px`,this.popoverElement.style.bottom="auto";this.popoverElement.getBoundingClientRect().bottom>window.innerHeight&&(this.popoverElement.style.bottom=`${t-i+n}px`,this.popoverElement.style.top="auto")}async#mn(){this.#pn(),this.popoverElement.classList.toggle("lexxy-prompt-menu--visible",!1),this.#in.removeEventListener("lexxy:change",this.#on),this.#in.removeEventListener("keydown",this.#cn),this.#yn(),await Fu(),this.#tn()}#yn(){this.keyListeners.forEach((e=>e())),this.keyListeners=[]}#on=async()=>{this.initialPrompt?this.initialPrompt=!1:this.#_n.containsTextBackUntil(this.trigger)?await this.#bn():this.#mn()};async#bn(){const e=this.#_n.textBackUntil(this.trigger),t=await this.source.buildListItems(e);this.popoverElement.innerHTML="",t.length>0?this.#xn(t):this.#kn(),this.#ln()}#xn(e){this.popoverElement.classList.remove("lexxy-prompt-menu--empty"),this.popoverElement.append(...e)}#kn(){this.popoverElement.classList.add("lexxy-prompt-menu--empty");const e=ku("li",{innerHTML:this.#vn});e.classList.add("lexxy-prompt-menu__item--empty"),this.popoverElement.append(e)}get#vn(){return this.getAttribute("empty-results")||"Nothing found"}#cn=e=>{"Escape"===e.key?(this.#mn(),this.#in.focus(),e.stopPropagation()):"ArrowDown"===e.key?(this.#Sn(),e.preventDefault(),e.stopPropagation()):"ArrowUp"===e.key&&(this.#wn(),e.preventDefault(),e.stopPropagation())};#Sn(){const e=this.#Cn+1;e=0&&this.#gn(this.#hn[e])}get#Cn(){return this.#hn.findIndex((e=>e.hasAttribute("aria-selected")))}get#Tn(){return this.#hn[this.#Cn]}#dn(e){return" "!==e.key&&e.preventDefault(),e.stopPropagation(),this.#En(),!0}#En(){this.#Nn(),this.#mn(),this.#in.focus()}#Nn(){const e=this.source.promptItemFor(this.#Tn);if(!e)return;const t=e.querySelector("template[type='editor']"),n=`${this.trigger}${this.#_n.textBackUntil(this.trigger)}`;this.hasAttribute("insert-editable-text")?this.#An(t,n):this.#Ln(e,t,n)}#An(e,t){this.#Yt.update((()=>{const n=yl(this.#Yt,vu(`${e.innerHTML}`));this.#_n.replaceTextBackUntil(t,n)}))}#Ln(e,t,n){this.#Yt.update((()=>{const r=new Iu({sgid:e.getAttribute("sgid"),contentType:`application/vnd.actiontext.${this.name}`,innerHtml:t.innerHTML});this.#_n.replaceTextBackUntil(n,r)}))}get#_n(){return this.#in.contents}get#fn(){return this.#in.editorContentElement}async#sn(){const e=ku("ul",{role:"listbox",id:Cu("prompt-popover")});return e.classList.add("lexxy-prompt-menu"),e.style.position="absolute",e.setAttribute("nonce",va()),e.append(...await this.source.buildListItems()),e.addEventListener("click",this.#Pn),this.#in.appendChild(e),e}#Pn=e=>{const t=e.target.closest(".lexxy-prompt-menu__item");t&&(this.#gn(t),this.#En())}}customElements.define("lexxy-prompt",rh);class ih extends HTMLElement{connectedCallback(){this.editorElement=this.closest("lexxy-editor"),this.editor=this.editorElement.editor,this.#Fn(),this.#On()}#Fn(){this.languagePickerElement=this.#In(),this.languagePickerElement.addEventListener("change",(()=>{this.#Rn(this.languagePickerElement.value)})),this.languagePickerElement.style.position="absolute",this.languagePickerElement.setAttribute("nonce",va()),this.editorElement.appendChild(this.languagePickerElement)}#In(){const e=ku("select",{hidden:!0,className:"lexxy-code-language-picker","aria-label":"Pick a language…",name:"lexxy-code-language"});for(const[t,n]of Object.entries(this.#Mn)){const r=document.createElement("option");r.value=t,r.textContent=n,e.appendChild(r)}return e}get#Mn(){const e={...fc};e.ruby||(e.ruby="Ruby");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])}#Rn(e){this.editor.update((()=>{const t=this.#Dn();t&&t.setLanguage(e)}))}#On(){this.editor.registerUpdateListener((()=>{this.editor.getEditorState().read((()=>{const e=this.#Dn();e?this.#zn(e):this.#Bn()}))}))}#Dn(){const e=ii();if(!Ur(e))return null;const t=e.anchor.getNode(),n=t.getParent();return lc(t)?t:lc(n)?n:null}#zn(e){const t=e.getLanguage();this.#$n(t),this.#Un(),this.#Wn(e)}#$n(e){if(this.languagePickerElement&&e){const t=function(e){return mc[e]||e}(e);this.languagePickerElement.value=t}}#Wn(e){const t=this.editor.getElementByKey(e.getKey());if(!t)return;const n=t.getBoundingClientRect(),r=this.editorElement.getBoundingClientRect(),i=n.top-r.top;this.languagePickerElement.style.top=`${i}px`}#Un(){this.languagePickerElement.hidden=!1}#Bn(){this.languagePickerElement.hidden=!0}}function sh(){document.querySelectorAll("pre[data-language]").forEach((e=>{!function(e){const t=e.getAttribute("data-language");let n=e.innerHTML.replace(//gi,"\n");const r=Prism.languages[t];if(!r)return;n=(new DOMParser).parseFromString(n,"text/html").body.textContent||"";const i=Prism.highlight(n,r,t),s=ku("code",{"data-language":t,innerHTML:i});e.replaceWith(s)}(e)}))}customElements.define("lexxy-code-language-picker",ih),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}(Prism),window.Prism=window.Prism||{},Prism.manual=!0;export{sh as highlightAll}; diff --git a/app/assets/javascript/lexxy.min.js.br b/app/assets/javascript/lexxy.min.js.br index 529128e89..d925329fa 100644 Binary files a/app/assets/javascript/lexxy.min.js.br and b/app/assets/javascript/lexxy.min.js.br differ diff --git a/app/assets/javascript/lexxy.min.js.gz b/app/assets/javascript/lexxy.min.js.gz index 97d45eb79..e1ca96fcd 100644 Binary files a/app/assets/javascript/lexxy.min.js.gz and b/app/assets/javascript/lexxy.min.js.gz differ diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..61764acf9 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,72 @@ +import js from "@eslint/js" + +export default [ + { + ignores: ["dist/**", "app/**", "node_modules/**", "pkg/**", "test/**", "lib/**", "bin/**", "config/**", "docs/**", "vendor/**"] + }, + js.configs.recommended, + { + files: ["src/**/*.js"], + languageOptions: { + ecmaVersion: 2022, + sourceType: "module", + globals: { + console: "readonly", + document: "readonly", + window: "readonly", + navigator: "readonly", + HTMLElement: "readonly", + CustomEvent: "readonly", + Element: "readonly", + Node: "readonly", + NodeList: "readonly", + Event: "readonly", + MutationObserver: "readonly", + DOMParser: "readonly", + Blob: "readonly", + File: "readonly", + FileReader: "readonly", + URL: "readonly", + URLSearchParams: "readonly", + Request: "readonly", + Response: "readonly", + FormData: "readonly", + fetch: "readonly", + setTimeout: "readonly", + clearTimeout: "readonly", + setInterval: "readonly", + clearInterval: "readonly", + XMLHttpRequest: "readonly", + requestAnimationFrame: "readonly", + cancelAnimationFrame: "readonly", + customElements: "readonly", + Prism: "readonly", + ResizeObserver: "readonly" + } + }, + rules: { + "array-bracket-spacing": ["error", "always"], + "block-spacing": ["error", "always"], + "camelcase": ["error"], + "comma-spacing": ["error"], + "curly": ["error", "multi-line"], + "dot-notation": ["error"], + "eol-last": ["error"], + "func-style": ["error", "declaration"], + "getter-return": ["error"], + "keyword-spacing": ["error"], + "no-empty": "off", + "no-multi-spaces": ["error", { "exceptions": { "VariableDeclarator": true } }], + "no-multiple-empty-lines": ["error", { "max": 2 }], + "no-restricted-globals": ["error", "event"], + "no-trailing-spaces": ["error"], + "no-unused-vars": ["error", { "vars": "all", "args": "none", "caughtErrors": "none" }], + "no-var": ["error"], + "object-curly-spacing": ["error", "always"], + "prefer-const": ["error"], + "quotes": ["error", "double"], + "semi": ["error", "never"], + "sort-imports": ["error", { "ignoreDeclarationSort": true }] + } + } +] diff --git a/package.json b/package.json index 0c727f72d..24d849ca4 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,10 @@ "author": "Jorge Manrubia ", "license": "MIT", "devDependencies": { + "@eslint/js": "^9.15.0", "@rollup/plugin-node-resolve": "^16.0.1", "@rollup/plugin-terser": "^0.4.4", + "eslint": "^9.15.0", "rollup": "^4.44.1", "rollup-plugin-gzip": "^4.1.1" }, @@ -21,6 +23,7 @@ "build": "rollup -c", "build:npm": "rollup -c rollup.config.npm.mjs", "watch": "rollup -wc", + "lint": "eslint", "prerelease": "yarn build:npm", "release": "yarn build:npm && yarn publish" }, diff --git a/src/config/dom_purify.js b/src/config/dom_purify.js index fae22e93c..e341b5e4f 100644 --- a/src/config/dom_purify.js +++ b/src/config/dom_purify.js @@ -1,7 +1,7 @@ -import DOMPurify from 'dompurify' +import DOMPurify from "dompurify" DOMPurify.addHook("uponSanitizeElement", (node, data) => { if (data.tagName === "strong" || data.tagName === "em") { - node.removeAttribute('class'); + node.removeAttribute("class") } -}); +}) diff --git a/src/config/theme.js b/src/config/theme.js index 3a22d06f0..245a50494 100644 --- a/src/config/theme.js +++ b/src/config/theme.js @@ -6,47 +6,47 @@ export default { underline: "lexxy-content__underline", }, codeHighlight: { - 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__property', - decorator: 'code-token__function', - deleted: 'code-token__property', - doctype: 'code-token__comment', - entity: 'code-token__operator', - function: 'code-token__function', - hexcode: 'code-token__property', - important: 'code-token__variable', - inserted: 'code-token__selector', - italic: 'code-token__comment', - keyword: 'code-token__attr', - namespace: 'code-token__variable', - number: 'code-token__property', - operator: 'code-token__operator', - parameter: 'code-token__variable', - prolog: 'code-token__comment', - property: 'code-token__property', - punctuation: 'code-token__punctuation', - 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', - url: 'code-token__operator', - variable: 'code-token__variable', + 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__property", + decorator: "code-token__function", + deleted: "code-token__property", + doctype: "code-token__comment", + entity: "code-token__operator", + function: "code-token__function", + hexcode: "code-token__property", + important: "code-token__variable", + inserted: "code-token__selector", + italic: "code-token__comment", + keyword: "code-token__attr", + namespace: "code-token__variable", + number: "code-token__property", + operator: "code-token__operator", + parameter: "code-token__variable", + prolog: "code-token__comment", + property: "code-token__property", + punctuation: "code-token__punctuation", + 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", + url: "code-token__operator", + variable: "code-token__variable", } } diff --git a/src/editor/clipboard.js b/src/editor/clipboard.js index 6d05686ec..d0091e3f3 100644 --- a/src/editor/clipboard.js +++ b/src/editor/clipboard.js @@ -1,6 +1,6 @@ import { marked } from "marked" -import { isUrl } from "../helpers/string_helper"; -import { nextFrame } from "../helpers/timing_helpers"; +import { isUrl } from "../helpers/string_helper" +import { nextFrame } from "../helpers/timing_helpers" import { dispatch } from "../helpers/html_helper" export default class Clipboard { @@ -63,7 +63,7 @@ export default class Clipboard { #handlePastedFiles(clipboardData) { if (!this.editorElement.supportsAttachments) return - const html = clipboardData.getData('text/html') + const html = clipboardData.getData("text/html") if (html) return // Ignore if image copied from browser since we will load it as a remote image this.#preservingScrollPosition(() => { diff --git a/src/editor/command_dispatcher.js b/src/editor/command_dispatcher.js index 74c0d9c1d..7df4573de 100644 --- a/src/editor/command_dispatcher.js +++ b/src/editor/command_dispatcher.js @@ -1,16 +1,16 @@ import { $getSelection, $isRangeSelection, - PASTE_COMMAND, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND, - UNDO_COMMAND, - REDO_COMMAND + PASTE_COMMAND, + REDO_COMMAND, + UNDO_COMMAND } from "lexical" import { INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND } from "@lexical/list" import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode } from "@lexical/rich-text" -import { CodeNode, $isCodeNode } from "@lexical/code" +import { $isCodeNode, CodeNode } from "@lexical/code" import { $toggleLink } from "@lexical/link" import { createElement } from "../helpers/html_helper" import { getListType } from "../helpers/lexical_helper" @@ -75,7 +75,7 @@ export class CommandDispatcher { dispatchInsertUnorderedList() { const selection = $getSelection() - if (!selection) return; + if (!selection) return const anchorNode = selection.anchor.getNode() @@ -88,7 +88,7 @@ export class CommandDispatcher { dispatchInsertOrderedList() { const selection = $getSelection() - if (!selection) return; + if (!selection) return const anchorNode = selection.anchor.getNode() diff --git a/src/editor/contents.js b/src/editor/contents.js index 27a52ba55..c6df4cb52 100644 --- a/src/editor/contents.js +++ b/src/editor/contents.js @@ -1,16 +1,16 @@ import { - $createParagraphNode, $getSelection, $setSelection, $insertNodes, $isElementNode, $isParagraphNode, $isTextNode, - $isRangeSelection, $createLineBreakNode, $createTextNode, HISTORY_MERGE_TAG, $isNodeSelection, $getNodeByKey, $getRoot + $createLineBreakNode, $createParagraphNode, $createTextNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, + $isElementNode, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isTextNode, $setSelection, HISTORY_MERGE_TAG } from "lexical" import { $generateNodesFromDOM } from "@lexical/html" import { ActionTextAttachmentUploadNode } from "../nodes/action_text_attachment_upload_node" import { CustomActionTextAttachmentNode } from "../nodes/custom_action_text_attachment_node" -import { $toggleLink, $createLinkNode } from "@lexical/link" +import { $createLinkNode, $toggleLink } from "@lexical/link" import { dispatch, parseHtml } from "../helpers/html_helper" -import { $isListItemNode, $isListNode } from "@lexical/list" +import { $isListNode } from "@lexical/list" import { getNearestListItemNode } from "../helpers/lexical_helper" -import { nextFrame } from "../helpers/timing_helpers.js"; +import { nextFrame } from "../helpers/timing_helpers.js" export default class Contents { constructor(editorElement) { @@ -546,8 +546,8 @@ export default class Contents { firstParagraph.selectStart() const currentSelection = $getSelection() if (currentSelection && $isRangeSelection(currentSelection)) { - currentSelection.anchor.set(firstParagraph.getKey(), 0, 'element') - currentSelection.focus.set(lastParagraph.getKey(), lastParagraph.getChildrenSize(), 'element') + currentSelection.anchor.set(firstParagraph.getKey(), 0, "element") + currentSelection.focus.set(lastParagraph.getKey(), lastParagraph.getChildrenSize(), "element") } } @@ -601,14 +601,14 @@ export default class Contents { const last = children[children.length - 1] const beforeLast = children[children.length - 2] - if (($isTextNode(last) && last.getTextContent() === "") && (beforeLast && !$isTextNode(beforeLast))) { + if ($isTextNode(last) && last.getTextContent() === "" && (beforeLast && !$isTextNode(beforeLast))) { paragraph.append($createLineBreakNode()) } } } #createCustomAttachmentNodeWithHtml(html, options = {}) { - const attachmentConfig = typeof options === 'object' ? options : {} + const attachmentConfig = typeof options === "object" ? options : {} return new CustomActionTextAttachmentNode({ sgid: attachmentConfig.sgid || null, @@ -623,6 +623,6 @@ export default class Contents { } #shouldUploadFile(file) { - return dispatch(this.editorElement, 'lexxy:file-accept', { file }, true) + return dispatch(this.editorElement, "lexxy:file-accept", { file }, true) } } diff --git a/src/editor/prompt/local_filter_source.js b/src/editor/prompt/local_filter_source.js index e48625afc..084dc5f24 100644 --- a/src/editor/prompt/local_filter_source.js +++ b/src/editor/prompt/local_filter_source.js @@ -1,5 +1,5 @@ import BaseSource from "./base_source" -import { filterMatches } from "../../helpers/string_helper"; +import { filterMatches } from "../../helpers/string_helper" export default class LocalFilterSource extends BaseSource { async buildListItems(filter = "") { diff --git a/src/editor/prompt/remote_filter_source.js b/src/editor/prompt/remote_filter_source.js index f2eb8e407..e669239cd 100644 --- a/src/editor/prompt/remote_filter_source.js +++ b/src/editor/prompt/remote_filter_source.js @@ -1,5 +1,5 @@ import BaseSource from "./base_source" -import { debounceAsync } from "../../helpers/timing_helpers"; +import { debounceAsync } from "../../helpers/timing_helpers" const DEBOUNCE_INTERVAL = 200 diff --git a/src/editor/selection.js b/src/editor/selection.js index 46772a667..c5d435fc5 100644 --- a/src/editor/selection.js +++ b/src/editor/selection.js @@ -1,8 +1,8 @@ import { - $createNodeSelection, $isElementNode, $isRangeSelection, $getNodeByKey, $getSelection, $isNodeSelection, - $setSelection, $getRoot, $isTextNode, $isLineBreakNode, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND, KEY_ARROW_LEFT_COMMAND, - KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_DELETE_COMMAND, - KEY_BACKSPACE_COMMAND, DecoratorNode, $createParagraphNode + $createNodeSelection, $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $isElementNode, + $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isTextNode, $setSelection, COMMAND_PRIORITY_LOW, DecoratorNode, + KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, + KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from "lexical" import { nextFrame } from "../helpers/timing_helpers" import { getNonce } from "../helpers/csp_helper" @@ -266,11 +266,11 @@ export default class Selection { // above when navigating UP/DOWN when Lexical shows its fake cursor on custom decorator nodes. this.editorContentElement.addEventListener("keydown", (event) => { if (event.key === "ArrowUp") { - const lexicalCursor = this.editor.getRootElement().querySelector('[data-lexical-cursor]') + const lexicalCursor = this.editor.getRootElement().querySelector("[data-lexical-cursor]") if (lexicalCursor) { let currentElement = lexicalCursor.previousElementSibling - while (currentElement && currentElement.hasAttribute('data-lexical-cursor')) { + while (currentElement && currentElement.hasAttribute("data-lexical-cursor")) { currentElement = currentElement.previousElementSibling } @@ -281,11 +281,11 @@ export default class Selection { } if (event.key === "ArrowDown") { - const lexicalCursor = this.editor.getRootElement().querySelector('[data-lexical-cursor]') + const lexicalCursor = this.editor.getRootElement().querySelector("[data-lexical-cursor]") if (lexicalCursor) { let currentElement = lexicalCursor.nextElementSibling - while (currentElement && currentElement.hasAttribute('data-lexical-cursor')) { + while (currentElement && currentElement.hasAttribute("data-lexical-cursor")) { currentElement = currentElement.nextElementSibling } @@ -473,7 +473,7 @@ export default class Selection { } #isRectUnreliable(rect) { - return (rect.width === 0 && rect.height === 0) || (rect.top === 0 && rect.left === 0) + return rect.width === 0 && rect.height === 0 || rect.top === 0 && rect.left === 0 } #createAndInsertMarker(range) { @@ -504,7 +504,7 @@ export default class Selection { #calculateCursorPosition(rect, range) { const rootRect = this.editor.getRootElement().getBoundingClientRect() - let x = rect.left - rootRect.left + const x = rect.left - rootRect.left let y = rect.top - rootRect.top const fontSize = this.#getFontSizeForCursor(range) diff --git a/src/elements/editor.js b/src/elements/editor.js index ecf614b90..ab5280ca6 100644 --- a/src/elements/editor.js +++ b/src/elements/editor.js @@ -1,11 +1,11 @@ -import { createEditor, $getRoot, $getNodeByKey, $addUpdateTag, SKIP_DOM_SELECTION_TAG, KEY_ENTER_COMMAND, COMMAND_PRIORITY_NORMAL, DecoratorNode, CLEAR_HISTORY_COMMAND } from "lexical" -import { ListNode, ListItemNode, registerList } from "@lexical/list" -import { LinkNode, AutoLinkNode } from "@lexical/link" -import { registerRichText, QuoteNode, HeadingNode } from "@lexical/rich-text" -import { $generateNodesFromDOM, $generateHtmlFromNodes } from "@lexical/html" +import { $addUpdateTag, $getNodeByKey, $getRoot, CLEAR_HISTORY_COMMAND, COMMAND_PRIORITY_NORMAL, DecoratorNode, KEY_ENTER_COMMAND, SKIP_DOM_SELECTION_TAG, createEditor } from "lexical" +import { ListItemNode, ListNode, registerList } from "@lexical/list" +import { AutoLinkNode, LinkNode } from "@lexical/link" +import { HeadingNode, QuoteNode, registerRichText } from "@lexical/rich-text" +import { $generateHtmlFromNodes, $generateNodesFromDOM } from "@lexical/html" import { CodeHighlightNode, CodeNode, registerCodeHighlighting, } from "@lexical/code" import { TRANSFORMERS, registerMarkdownShortcuts } from "@lexical/markdown" -import { registerHistory, createEmptyHistoryState } from '@lexical/history' +import { createEmptyHistoryState, registerHistory } from "@lexical/history" import theme from "../config/theme" import { ActionTextAttachmentNode } from "../nodes/action_text_attachment_node" diff --git a/src/elements/link_dialog.js b/src/elements/link_dialog.js index 20154d50e..7b36d8fe3 100644 --- a/src/elements/link_dialog.js +++ b/src/elements/link_dialog.js @@ -1,6 +1,5 @@ -import { createElement } from "../helpers/html_helper"; -import { $getSelection, $isRangeSelection } from "lexical"; -import { $isLinkNode } from "@lexical/link"; +import { $getSelection, $isRangeSelection } from "lexical" +import { $isLinkNode } from "@lexical/link" export class LinkDialog extends HTMLElement { connectedCallback() { diff --git a/src/elements/prompt.js b/src/elements/prompt.js index 1bd92b1e4..53870f0f0 100644 --- a/src/elements/prompt.js +++ b/src/elements/prompt.js @@ -1,13 +1,12 @@ import { createElement, generateDomId, parseHtml } from "../helpers/html_helper" import { getNonce } from "../helpers/csp_helper" -import { COMMAND_PRIORITY_HIGH, KEY_ENTER_COMMAND, KEY_TAB_COMMAND, KEY_SPACE_COMMAND, $isTextNode, $isRangeSelection, $getSelection, $isNodeSelection, $getNodeByKey } from "lexical" +import { $getSelection, $isNodeSelection, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_HIGH, KEY_ENTER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND } from "lexical" import { CustomActionTextAttachmentNode } from "../nodes/custom_action_text_attachment_node" -import { isPath, isUrl } from "../helpers/string_helper" import InlinePromptSource from "../editor/prompt/inline_source" import DeferredPromptSource from "../editor/prompt/deferred_source" import RemoteFilterSource from "../editor/prompt/remote_filter_source" import { $generateNodesFromDOM } from "@lexical/html" -import { nextFrame } from "../helpers/timing_helpers"; +import { nextFrame } from "../helpers/timing_helpers" const NOTHING_FOUND_DEFAULT_MESSAGE = "Nothing found" @@ -313,7 +312,7 @@ export default class LexicalPromptElement extends HTMLElement { popoverContainer.classList.add("lexxy-prompt-menu") popoverContainer.style.position = "absolute" popoverContainer.setAttribute("nonce", getNonce()) - popoverContainer.append(...(await this.source.buildListItems())) + popoverContainer.append(...await this.source.buildListItems()) popoverContainer.addEventListener("click", this.#handlePopoverClick) this.#editorElement.appendChild(popoverContainer) return popoverContainer diff --git a/src/elements/toolbar.js b/src/elements/toolbar.js index b58375452..d77a4a472 100644 --- a/src/elements/toolbar.js +++ b/src/elements/toolbar.js @@ -1,15 +1,13 @@ import { $getSelection, - $isRangeSelection, - FORMAT_TEXT_COMMAND, - $isTextNode + $isRangeSelection } from "lexical" import { getNonce } from "../helpers/csp_helper" -import { $isListNode, $isListItemNode } from "@lexical/list" -import { $isQuoteNode, $isHeadingNode } from "@lexical/rich-text" -import { $isCodeNode, $isCodeHighlightNode } from "@lexical/code" +import { $isListItemNode, $isListNode } from "@lexical/list" +import { $isHeadingNode, $isQuoteNode } from "@lexical/rich-text" +import { $isCodeNode } from "@lexical/code" import { $isLinkNode } from "@lexical/link" -import { getListType } from "../helpers/lexical_helper"; +import { getListType } from "../helpers/lexical_helper" export default class LexicalToolbarElement extends HTMLElement { constructor() { @@ -19,16 +17,16 @@ export default class LexicalToolbarElement extends HTMLElement { } connectedCallback() { - requestAnimationFrame(() => this.#refreshToolbarOverflow()); + requestAnimationFrame(() => this.#refreshToolbarOverflow()) - this._resizeObserver = new ResizeObserver(() => this.#refreshToolbarOverflow()); - this._resizeObserver.observe(this); + this._resizeObserver = new ResizeObserver(() => this.#refreshToolbarOverflow()) + this._resizeObserver.observe(this) } disconnectedCallback() { if (this._resizeObserver) { - this._resizeObserver.disconnect(); - this._resizeObserver = null; + this._resizeObserver.disconnect() + this._resizeObserver = null } } @@ -76,7 +74,7 @@ export default class LexicalToolbarElement extends HTMLElement { } #bindHotkeys() { - this.editorElement.addEventListener('keydown', (event) => { + this.editorElement.addEventListener("keydown", (event) => { const buttons = this.querySelectorAll("[data-hotkey]") buttons.forEach((button) => { const hotkeys = button.dataset.hotkey.toLowerCase().split(/\s+/) @@ -92,13 +90,13 @@ export default class LexicalToolbarElement extends HTMLElement { #keyCombinationFor(event) { const pressedKey = event.key.toLowerCase() const modifiers = [ - event.ctrlKey ? 'ctrl' : null, - event.metaKey ? 'cmd' : null, - event.altKey ? 'alt' : null, - event.shiftKey ? 'shift' : null, + event.ctrlKey ? "ctrl" : null, + event.metaKey ? "cmd" : null, + event.altKey ? "alt" : null, + event.shiftKey ? "shift" : null, ].filter(Boolean) - return [ ...modifiers, pressedKey ].join('+') + return [ ...modifiers, pressedKey ].join("+") } #assignButtonTabindex() { @@ -172,19 +170,6 @@ export default class LexicalToolbarElement extends HTMLElement { this.#updateUndoRedoButtonStates() } - #isSelectionInInlineCode(selection) { - const nodes = selection.getNodes() - return nodes.some(node => { - if ($isCodeHighlightNode(node)) return true - // Check parent for text nodes inside code highlight - if ($isTextNode(node)) { - const parent = node.getParent() - if (parent && $isCodeHighlightNode(parent)) return true - } - return false - }) - } - #isInList(node) { let current = node while (current) { @@ -232,7 +217,7 @@ export default class LexicalToolbarElement extends HTMLElement { #resetToolbar() { while (this.#overflowMenu.children.length > 0) { - this.insertBefore(this.#overflowMenu.children[0], this.#overflow); + this.insertBefore(this.#overflowMenu.children[0], this.#overflow) } } diff --git a/src/helpers/csp_helper.js b/src/helpers/csp_helper.js index 615da9889..c79334e6c 100644 --- a/src/helpers/csp_helper.js +++ b/src/helpers/csp_helper.js @@ -1,4 +1,4 @@ -const getNonce = () => { +function getNonce() { const element = document.head.querySelector("meta[name=csp-nonce]") return element?.content } diff --git a/src/helpers/html_helper.js b/src/helpers/html_helper.js index 7ac340675..3ed77bc52 100644 --- a/src/helpers/html_helper.js +++ b/src/helpers/html_helper.js @@ -1,5 +1,4 @@ -import DOMPurify from 'dompurify' -import { mimeTypeToExtension } from "./storage_helper"; +import DOMPurify from "dompurify" const VISUALLY_RELEVANT_ELEMENTS_SELECTOR = [ "img", "video", "audio", "iframe", "embed", "object", "picture", "source", "canvas", "svg", "math", @@ -31,9 +30,9 @@ export function parseHtml(html) { } export function createAttachmentFigure(contentType, isPreviewable, fileName) { - const extension = fileName ? fileName.split('.').pop().toLowerCase() : "unknown" + const extension = fileName ? fileName.split(".").pop().toLowerCase() : "unknown" return createElement("figure", { - className: `attachment attachment--${isPreviewable ? 'preview' : 'file'} attachment--${extension}`, + className: `attachment attachment--${isPreviewable ? "preview" : "file"} attachment--${extension}`, "data-content-type": contentType }) } diff --git a/src/helpers/lexical_helper.js b/src/helpers/lexical_helper.js index fe2bda13b..91679b835 100644 --- a/src/helpers/lexical_helper.js +++ b/src/helpers/lexical_helper.js @@ -25,7 +25,7 @@ export function isPrintableCharacter(event) { if (event.ctrlKey || event.metaKey || event.altKey) return false // Ignore special keys - if (event.key.length > 1 && event.key !== 'Enter' && event.key !== 'Space') return false + if (event.key.length > 1 && event.key !== "Enter" && event.key !== "Space") return false // Accept single character keys (letters, numbers, punctuation) return event.key.length === 1 diff --git a/src/helpers/string_helper.js b/src/helpers/string_helper.js index 8de2dcfd1..9bedfe17b 100644 --- a/src/helpers/string_helper.js +++ b/src/helpers/string_helper.js @@ -2,13 +2,13 @@ export function isUrl(string) { try { new URL(string) return true - } catch (_) { + } catch { return false } } export function isPath(string) { - return /^\/.*$/.test(string); + return /^\/.*$/.test(string) } export function normalizeFilteredText(string) { diff --git a/src/helpers/timing_helpers.js b/src/helpers/timing_helpers.js index 1e91a3679..da0e34b6b 100644 --- a/src/helpers/timing_helpers.js +++ b/src/helpers/timing_helpers.js @@ -1,6 +1,5 @@ export function debounceAsync(fn, wait) { let timeout - let lastCall return (...args) => { clearTimeout(timeout) @@ -14,8 +13,6 @@ export function debounceAsync(fn, wait) { reject(err) } }, wait) - - lastCall = timeout }) } } diff --git a/src/index.js b/src/index.js index b93837d91..9ea6c2b04 100644 --- a/src/index.js +++ b/src/index.js @@ -13,4 +13,4 @@ import "./elements/code_language_picker" import "prismjs/components/prism-ruby" -export { highlightAll } from './helpers/code_highlighting_helper' +export { highlightAll } from "./helpers/code_highlighting_helper" diff --git a/src/nodes/action_text_attachment_node.js b/src/nodes/action_text_attachment_node.js index 597646509..f6d6237b0 100644 --- a/src/nodes/action_text_attachment_node.js +++ b/src/nodes/action_text_attachment_node.js @@ -1,6 +1,6 @@ import { DecoratorNode } from "lexical" -import { createAttachmentFigure, createElement, dispatchCustomEvent, isPreviewableImage } from "../helpers/html_helper"; -import { bytesToHumanSize, mimeTypeToExtension } from "../helpers/storage_helper"; +import { createAttachmentFigure, createElement, dispatchCustomEvent, isPreviewableImage } from "../helpers/html_helper" +import { bytesToHumanSize } from "../helpers/storage_helper" export class ActionTextAttachmentNode extends DecoratorNode { static getType() { @@ -8,7 +8,7 @@ export class ActionTextAttachmentNode extends DecoratorNode { } static clone(node) { - return new ActionTextAttachmentNode({ ...node }, node.__key); + return new ActionTextAttachmentNode({ ...node }, node.__key) } static importJSON(serializedNode) { @@ -146,7 +146,7 @@ export class ActionTextAttachmentNode extends DecoratorNode { } #createDOMForImage() { - return createElement("img", { src: this.src, alt: this.altText, ...this.#imageDimensions}) + return createElement("img", { src: this.src, alt: this.altText, ...this.#imageDimensions }) } get #imageDimensions() { @@ -158,8 +158,8 @@ export class ActionTextAttachmentNode extends DecoratorNode { } #createDOMForFile() { - const extension = this.fileName ? this.fileName.split('.').pop().toLowerCase() : 'unknown' - return createElement("span", { className: "attachment__icon", textContent: `${extension}`}) + const extension = this.fileName ? this.fileName.split(".").pop().toLowerCase() : "unknown" + return createElement("span", { className: "attachment__icon", textContent: `${extension}` }) } #createDOMForNotImage() { @@ -196,9 +196,6 @@ export class ActionTextAttachmentNode extends DecoratorNode { return caption } - #updateCaption(input) { - } - #handleCaptionInputBlurred(event) { const input = event.target diff --git a/src/nodes/action_text_attachment_upload_node.js b/src/nodes/action_text_attachment_upload_node.js index 824671950..02d138b91 100644 --- a/src/nodes/action_text_attachment_upload_node.js +++ b/src/nodes/action_text_attachment_upload_node.js @@ -1,10 +1,10 @@ -import { DecoratorNode, $getNodeByKey } from "lexical" +import { $getNodeByKey } from "lexical" import { DirectUpload } from "@rails/activestorage" import { ActionTextAttachmentNode } from "./action_text_attachment_node" -import { createAttachmentFigure, createElement } from "../helpers/html_helper" +import { createElement } from "../helpers/html_helper" import { loadFileIntoImage } from "../helpers/upload_helper" -import { HISTORY_MERGE_TAG } from 'lexical' -import { bytesToHumanSize } from "../helpers/storage_helper"; +import { HISTORY_MERGE_TAG } from "lexical" +import { bytesToHumanSize } from "../helpers/storage_helper" export class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { static getType() { @@ -12,7 +12,7 @@ export class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { } static clone(node) { - return new ActionTextAttachmentUploadNode({ ...node }, node.__key); + return new ActionTextAttachmentUploadNode({ ...node }, node.__key) } constructor({ file, uploadUrl, blobUrlTemplate, editor, progress }, key) { @@ -65,7 +65,7 @@ export class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { } #getFileExtension() { - return this.file.name.split('.').pop().toLowerCase() + return this.file.name.split(".").pop().toLowerCase() } #createCaption() { @@ -95,7 +95,7 @@ export class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode { directUploadWillStoreFileWithXHR: (request) => { request.upload.addEventListener("progress", (event) => { this.editor.update(() => { - progressBar.value = Math.round((event.loaded / event.total) * 100) + progressBar.value = Math.round(event.loaded / event.total * 100) }) }) } diff --git a/src/nodes/custom_action_text_attachment_node.js b/src/nodes/custom_action_text_attachment_node.js index eda2914d4..6485beb00 100644 --- a/src/nodes/custom_action_text_attachment_node.js +++ b/src/nodes/custom_action_text_attachment_node.js @@ -1,6 +1,5 @@ import { $createTextNode, DecoratorNode } from "lexical" -import { createAttachmentFigure, createElement, dispatchCustomEvent, isPreviewableImage } from "../helpers/html_helper" -import { bytesToHumanSize, mimeTypeToExtension } from "../helpers/storage_helper" +import { createElement, dispatchCustomEvent } from "../helpers/html_helper" export class CustomActionTextAttachmentNode extends DecoratorNode { static getType() { diff --git a/src/nodes/horizontal_divider_node.js b/src/nodes/horizontal_divider_node.js index 0167e0497..04c6b50d5 100644 --- a/src/nodes/horizontal_divider_node.js +++ b/src/nodes/horizontal_divider_node.js @@ -67,4 +67,4 @@ export class HorizontalDividerNode extends DecoratorNode { decorate() { return null } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index a97647b5c..c97c9d335 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,104 @@ # yarn lockfile v1 +"@eslint-community/eslint-utils@^4.8.0": + version "4.9.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz#7308df158e064f0dd8b8fdb58aa14fa2a7f913b3" + integrity sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g== + dependencies: + eslint-visitor-keys "^3.4.3" + +"@eslint-community/regexpp@^4.12.1": + version "4.12.2" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.2.tgz#bccdf615bcf7b6e8db830ec0b8d21c9a25de597b" + integrity sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew== + +"@eslint/config-array@^0.21.1": + version "0.21.1" + resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.21.1.tgz#7d1b0060fea407f8301e932492ba8c18aff29713" + integrity sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA== + dependencies: + "@eslint/object-schema" "^2.1.7" + debug "^4.3.1" + minimatch "^3.1.2" + +"@eslint/config-helpers@^0.4.1": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@eslint/config-helpers/-/config-helpers-0.4.2.tgz#1bd006ceeb7e2e55b2b773ab318d300e1a66aeda" + integrity sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw== + dependencies: + "@eslint/core" "^0.17.0" + +"@eslint/core@^0.16.0": + version "0.16.0" + resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.16.0.tgz#490254f275ba9667ddbab344f4f0a6b7a7bd7209" + integrity sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q== + dependencies: + "@types/json-schema" "^7.0.15" + +"@eslint/core@^0.17.0": + version "0.17.0" + resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.17.0.tgz#77225820413d9617509da9342190a2019e78761c" + integrity sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ== + dependencies: + "@types/json-schema" "^7.0.15" + +"@eslint/eslintrc@^3.3.1": + version "3.3.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.3.1.tgz#e55f7f1dd400600dd066dbba349c4c0bac916964" + integrity sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^10.0.1" + globals "^14.0.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@9.38.0", "@eslint/js@^9.15.0": + version "9.38.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.38.0.tgz#f7aa9c7577577f53302c1d795643589d7709ebd1" + integrity sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A== + +"@eslint/object-schema@^2.1.7": + version "2.1.7" + resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.7.tgz#6e2126a1347e86a4dedf8706ec67ff8e107ebbad" + integrity sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA== + +"@eslint/plugin-kit@^0.4.0": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz#9779e3fd9b7ee33571a57435cf4335a1794a6cb2" + integrity sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA== + dependencies: + "@eslint/core" "^0.17.0" + levn "^0.4.1" + +"@humanfs/core@^0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.1.tgz#17c55ca7d426733fe3c561906b8173c336b40a77" + integrity sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA== + +"@humanfs/node@^0.16.6": + version "0.16.7" + resolved "https://registry.yarnpkg.com/@humanfs/node/-/node-0.16.7.tgz#822cb7b3a12c5a240a24f621b5a2413e27a45f26" + integrity sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ== + dependencies: + "@humanfs/core" "^0.19.1" + "@humanwhocodes/retry" "^0.4.0" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/retry@^0.4.0", "@humanwhocodes/retry@^0.4.2": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.4.3.tgz#c2b9d2e374ee62c586d3adbea87199b1d7a7a6ba" + integrity sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ== + "@jridgewell/gen-mapping@^0.3.5": version "0.3.8" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz#4f0e06362e01362f823d348f1872b08f666d8142" @@ -281,7 +379,7 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.44.1.tgz#1c982f6a5044ffc2a35cd754a0951bdcb44d5ba0" integrity sha512-J8o22LuF0kTe7m+8PvW9wk3/bRq5+mRo5Dqo6+vXb7otCm3TPhYOJqOaQtGU9YMWQSL3krMnoOxMr0+9E6F3Ug== -"@types/estree@1.0.8": +"@types/estree@1.0.8", "@types/estree@^1.0.6": version "1.0.8" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== @@ -291,6 +389,11 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.7.tgz#4158d3105276773d5b7695cd4834b1722e4f37a8" integrity sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ== +"@types/json-schema@^7.0.15": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/resolve@1.20.2": version "1.20.2" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" @@ -301,21 +404,117 @@ resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11" integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw== +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + acorn@^8.14.0: version "8.14.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.1.tgz#721d5dc10f7d5b5609a891773d47731796935dfb" integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg== +acorn@^8.15.0: + version "8.15.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" + integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== + +ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^1.1.7: + version "1.1.12" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" + integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +cross-spawn@^7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@^4.3.1, debug@^4.3.2: + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== + dependencies: + ms "^2.1.3" + +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + deepmerge@^4.2.2: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" @@ -328,11 +527,150 @@ dompurify@^3.2.6: optionalDependencies: "@types/trusted-types" "^2.0.7" +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-scope@^8.4.0: + version "8.4.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.4.0.tgz#88e646a207fad61436ffa39eb505147200655c82" + integrity sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint-visitor-keys@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz#4cfea60fe7dd0ad8e816e1ed026c1d5251b512c1" + integrity sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ== + +eslint@^9.15.0: + version "9.38.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.38.0.tgz#3957d2af804e5cf6cc503c618f60acc71acb2e7e" + integrity sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw== + dependencies: + "@eslint-community/eslint-utils" "^4.8.0" + "@eslint-community/regexpp" "^4.12.1" + "@eslint/config-array" "^0.21.1" + "@eslint/config-helpers" "^0.4.1" + "@eslint/core" "^0.16.0" + "@eslint/eslintrc" "^3.3.1" + "@eslint/js" "9.38.0" + "@eslint/plugin-kit" "^0.4.0" + "@humanfs/node" "^0.16.6" + "@humanwhocodes/module-importer" "^1.0.1" + "@humanwhocodes/retry" "^0.4.2" + "@types/estree" "^1.0.6" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.6" + debug "^4.3.2" + escape-string-regexp "^4.0.0" + eslint-scope "^8.4.0" + eslint-visitor-keys "^4.2.1" + espree "^10.4.0" + esquery "^1.5.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^8.0.0" + find-up "^5.0.0" + glob-parent "^6.0.2" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + json-stable-stringify-without-jsonify "^1.0.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + +espree@^10.0.1, espree@^10.4.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.4.0.tgz#d54f4949d4629005a1fa168d937c3ff1f7e2a837" + integrity sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ== + dependencies: + acorn "^8.15.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^4.2.1" + +esquery@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + estree-walker@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +file-entry-cache@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" + integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== + dependencies: + flat-cache "^4.0.0" + +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" + integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== + dependencies: + flatted "^3.2.9" + keyv "^4.5.4" + +flatted@^3.2.9: + version "3.3.3" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.3.tgz#67c8fad95454a7c7abebf74bb78ee74a44023358" + integrity sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg== + fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" @@ -343,6 +681,23 @@ function-bind@^1.1.2: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +globals@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" + integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + hasown@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" @@ -350,6 +705,24 @@ hasown@^2.0.2: dependencies: function-bind "^1.1.2" +ignore@^5.2.0: + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== + +import-fresh@^3.2.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.1.tgz#9cecb56503c0ada1f2741dbbd6546e4b13b57ccf" + integrity sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + is-core-module@^2.16.0: version "2.16.1" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" @@ -357,21 +730,147 @@ is-core-module@^2.16.0: dependencies: hasown "^2.0.2" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-glob@^4.0.0, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g== +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + +keyv@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + lexical@0.32.1: version "0.32.1" resolved "https://registry.yarnpkg.com/lexical/-/lexical-0.32.1.tgz#6e2b3aac067a45bdafae576326fefca4f2e57a40" integrity sha512-Rvr9p00zUwzjXIqElIjMDyl/24QHw68yaqmXUWIT3lSdSAr8OpjSJK3iWBLZwVZwwpVhwShZRckomc+3vSb/zw== +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + marked@^16.3.0: version "16.3.0" resolved "https://registry.yarnpkg.com/marked/-/marked-16.3.0.tgz#2f513891f867d6edc4772b4a026db9cc331eb94f" integrity sha512-K3UxuKu6l6bmA5FUwYho8CfJBlsUWAooKtdGgMcERSpF7gcBUrCGsLH7wDaaNOzwq18JzSUDyoEb/YsrqMac3w== +minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +optionator@^0.9.3: + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.5" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" @@ -382,11 +881,21 @@ picomatch@^4.0.2: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prismjs@^1.30.0: version "1.30.0" resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.30.0.tgz#d9709969d9d4e16403f6f348c63553b19f0975a9" integrity sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw== +punycode@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -394,6 +903,11 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve@^1.22.1: version "1.22.10" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" @@ -449,6 +963,18 @@ serialize-javascript@^6.0.1: dependencies: randombytes "^2.1.0" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + smob@^1.0.0: version "1.5.0" resolved "https://registry.yarnpkg.com/smob/-/smob-1.5.0.tgz#85d79a1403abf128d24d3ebc1cdc5e1a9548d3ab" @@ -467,6 +993,18 @@ source-map@^0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -481,3 +1019,34 @@ terser@^5.17.4: acorn "^8.14.0" commander "^2.20.0" source-map-support "~0.5.20" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==