bible-note 0.6.0 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/bible-note.cjs +154 -112
  2. package/dist/bible-note.css +1 -1
  3. package/dist/bible-note.mjs +7574 -7236
  4. package/dist/chunks/{ContentEditable-C_wyHFh1.mjs → ContentEditable-BaXBKC3m.mjs} +1 -1
  5. package/dist/chunks/{ContentEditable-DgthEFHJ.cjs → ContentEditable-Ce294XLd.cjs} +2 -2
  6. package/dist/chunks/{ExcalidrawComponent-bEqDGYRW.cjs → ExcalidrawComponent-DdmtbuXc.cjs} +1 -1
  7. package/dist/chunks/{ExcalidrawComponent-iTobN_Hf.mjs → ExcalidrawComponent-OMjYgJCL.mjs} +2 -2
  8. package/dist/chunks/{ExcalidrawModal-DAEdxIBk.mjs → ExcalidrawModal-DSotOBGc.mjs} +2 -2
  9. package/dist/chunks/{ExcalidrawModal-Bbez9U5x.cjs → ExcalidrawModal-Db1LI01l.cjs} +2 -2
  10. package/dist/chunks/LexicalUtils.prod-CYv8J7Gq.cjs +3 -0
  11. package/dist/chunks/{LexicalUtils.prod-5zbJxaQa.mjs → LexicalUtils.prod-D2Igim2c.mjs} +28 -32
  12. package/dist/chunks/{MediaComponent-BTaaADsV.mjs → MediaComponent-CSawoM2p.mjs} +3 -3
  13. package/dist/chunks/{MediaComponent-BhjGu3D-.cjs → MediaComponent-qZBSiJiq.cjs} +1 -1
  14. package/dist/chunks/{MediaResizer-C7UGQ3Kl.mjs → MediaResizer-C_ZJbHAU.mjs} +1 -1
  15. package/dist/chunks/{MediaResizer-DGw5LvDR.cjs → MediaResizer-Dzro5TVg.cjs} +1 -1
  16. package/dist/chunks/{StickyComponent-B8skHBRs.mjs → StickyComponent-Ce5jkV0z.mjs} +13 -13
  17. package/dist/chunks/{StickyComponent-C6xBrvrK.cjs → StickyComponent-CoU6Bu8d.cjs} +1 -1
  18. package/dist/chunks/{StickyNode-B2B6di-N.mjs → StickyNode-CN3WkBD3.mjs} +11 -11
  19. package/dist/chunks/{StickyNode-GgIn3-zY.cjs → StickyNode-Dm3H0XUa.cjs} +1 -1
  20. package/dist/chunks/{TreeViewPlugin-B0UnxNiM.mjs → TreeViewPlugin-BV40YjJ0.mjs} +948 -887
  21. package/dist/chunks/{TreeViewPlugin-DkUjU27t.cjs → TreeViewPlugin-BlY6n0zI.cjs} +10 -10
  22. package/knowledge/development.md +8 -4
  23. package/knowledge/ui-rag.md +248 -140
  24. package/package.json +2 -2
  25. package/dist/chunks/LexicalUtils.prod-W-Xb5dGB.cjs +0 -3
@@ -1,16 +1,16 @@
1
- const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./Lexical.prod-C9Xekspf.cjs"),n=require("./LexicalUtils.prod-W-Xb5dGB.cjs"),r=require("./ContentEditable-DgthEFHJ.cjs"),i=require("./useLexicalEditable.prod-B2XnDcjV.cjs");let a=require("react");a=e.a(a,1);let o=require("react/jsx-runtime"),s=require("react-dom");s=e.a(s,1),r.y.tag(`h1`,`h2`,`h3`,`h4`,`h5`,`h6`),r.y.tag(`blockquote`),r.y.tag(`blockquote`),r.y.tag(`p`),r.y.tag(`span`);var c=t.x(`DRAG_DROP_PASTE_FILE`),l=t.rr(`shadowRoot`,{parse:Boolean}),u=class e extends t.m{static getType(){return`quote`}static clone(t){return new e(t.__key)}$config(){return this.config(`quote`,{extends:t.m,stateConfigs:[{flat:!0,stateConfig:l}]})}isShadowRoot(){return t.Yr(this,l)}setIsShadowRoot(e){return t.jt(this,l,e)}createDOM(e){let n=t.qt().createElement(`blockquote`);return t.Vr(n,e.theme.quote),n}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:g,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(t.Sn(n)){this.isEmpty()&&n.append(t.qt().createElement(`br`));let e=this.getFormatType();e&&(n.style.textAlign=e);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return d().updateFromJSON(e)}exportJSON(){return super.exportJSON()}insertNewAfter(e,n){let r=t.Ar(),i=this.getDirection();return r.setDirection(i),this.insertAfter(r,n),r}collapseAtStart(){if(this.isShadowRoot()){for(let e of this.getChildren())this.insertBefore(e);return this.remove(),!0}let e=t.Ar();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function d(e){let n=t.o(new u);return e&&e.shadowRoot?n.setIsShadowRoot(!0):n}function f(e){return e instanceof u}var p=class e extends t.m{__tag;static getType(){return`heading`}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e=`h1`,t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){let t=this.getWritable();return t.__tag=e,t}createDOM(e){let n=this.__tag,r=t.qt().createElement(n),i=e.theme.heading;if(i!==void 0){let e=i[n];t.Vr(r,e)}return r}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:h,priority:0}),h2:e=>({conversion:h,priority:0}),h3:e=>({conversion:h,priority:0}),h4:e=>({conversion:h,priority:0}),h5:e=>({conversion:h,priority:0}),h6:e=>({conversion:h,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&m(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>m(e)?{conversion:e=>({node:_(`h1`)}),priority:3}:null}}exportDOM(e){let{element:n}=super.exportDOM(e);if(t.Sn(n)){this.isEmpty()&&n.append(t.qt().createElement(`br`));let e=this.getFormatType();e&&(n.style.textAlign=e);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return _(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,n=!0){let r=e?e.anchor.offset:0,i=this.getLastDescendant(),a=!i||e&&e.anchor.key===i.getKey()&&r===i.getTextContentSize()||!e?t.Ar():_(this.getTag()),o=this.getDirection();if(a.setDirection(o),this.insertAfter(a,n),r===0&&!this.isEmpty()&&e){let e=t.Ar();e.select(),this.replace(e,!0)}return a}collapseAtStart(){if(this.isEmpty()){let e=t.Ar();this.getChildren().forEach(t=>e.append(t)),this.replace(e)}return!0}extractWithChild(){return!0}};function m(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function h(e){let n=e.nodeName.toLowerCase(),r=null;return n!==`h1`&&n!==`h2`&&n!==`h3`&&n!==`h4`&&n!==`h5`&&n!==`h6`||(r=_(n),t.p(e,r),t.b(r,e),t._t(r,e)),{node:r}}function g(e){let n=d();return t.b(n,e),t.p(e,n),t._t(n,e),{node:n}}function _(e=`h1`){return t.o(new p(e))}function v(e){return e instanceof p}function y(e){return t.$(t.Yt(e))}function b(e,n,r,i){let a=!1,o=null;if(e.isCollapsed()&&e.anchor.type===`text`){let n=e.anchor.getNode();if(t.Jt(n)){o=n;let t=e.anchor.offset,i=t===n.getTextContentSize()&&n.getNextSibling()===null,s=t===0&&n.getPreviousSibling()===null;a=r===`end`&&i||r===`start`&&s||r===`both`&&(i||s)}}let s=!1;for(let[r,c]of Object.entries(i)){if(c==null||!c[n])continue;let i=r;if(c.onlyAtBoundary){if(!(a&&o&&t.Jt(o)&&o.hasFormat(i)))continue;s=!0}e.hasFormat(i)&&e.toggleFormat(i)}s&&e.setStyle(``)}var x={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function S(e,n){return function(e,n){if(!e.isCollapsed())return!1;let r=t.Gt(e.focus,n),i=t.B(r.origin,t.et);if(!i)return!1;let a=e.focus.getNode();if(!i.is(a)&&!t.i(a,i))return!1;let o=t.O(r,t.f(i,n));if(o.getTextSlices().some(e=>e&&e.getTextContentSize()>0))return!1;let s=t.O(o.anchor.getSiblingCaret(),o.focus),c=s.anchor.origin;for(let e of s){if(!t.Hr(e)||!e.origin.is(c.getParent()))return!1;c=e.origin}let l=i;for(let e of t.Ft(t.f(i,n))){if(!e.origin.is(l.getParent())){if(t.Rt(e.origin)){let e=t.f(l,n);return t.en(t.O(e,e)),!0}break}if(!t.et(e.origin))break;l=e.origin}return!1}(e,n)||function(e,n){if(!e.isCollapsed()||e.anchor.type!==`element`)return!1;let r=t.Gt(e.anchor,n).getNodeAtCaret();return!(!t.et(r)||r.isInline()||(t.en(t.t(t.wr(t.Z(r,n)))),0))}(e,n)}function C(e){return t.$(e)&&!e.isInline()&&!e.isIsolated()&&e.isKeyboardSelectable()}function w(e){let n=t.xt();n.add(e),t.En(n)}function T(e,n){if(!e.isCollapsed())return!1;let r=e.focus,i=r.getNode(),a=n?`previous`:`next`,o=t.Gt(r,a);if(r.type===`element`&&t.vt(i)&&(t.ri(i)||t.et(i))){let e=o.getNodeAtCaret();return!(e===null||!C(e))&&(w(e.__key),!0)}let s=t.B(t.vt(i)?i:i.getParentOrThrow(),e=>t.vt(e)&&!e.isInline()&&t.J(e.getParent()));if(s===null)return!1;let c=t.f(s,a).getNodeAtCaret();if(c===null||!C(c))return!1;if(s.getTextContentSize()===0)return w(c.__key),!0;let l=t.s().getRootElement();if(l===null)return!1;let u=t.M(l.ownerDocument.defaultView);if(u===null||u.rangeCount===0)return!1;let d=u.anchorNode,f=u.anchorOffset,p=u.focusNode,m=u.focusOffset;u.modify(`move`,n?`backward`:`forward`,`line`);let h=u.anchorNode,g=u.anchorOffset;if(h===null)return E(u,d,f,p,m),!1;let _=t.Yt(h);return E(u,d,f,p,m),_!==null&&(h===d&&g===f||!_.is(s)&&!t.i(_,s))&&(w(c.__key),!0)}function E(e,t,n,r,i){t!==null&&r!==null&&e.setBaseAndExtent(t,n,r,i)}function D(e,n){if(!e.isCollapsed())return!1;let i=e.focus.getNode(),a=t.B(t.vt(i)?i:i.getParentOrThrow(),e=>t.vt(e)&&!e.isInline());if(a===null)return!1;let o=t.s(),s=o.getRootElement();if(s===null)return!1;let c=s.ownerDocument.defaultView;if(c===null)return!1;let l=!1;for(let e of a.getChildren())if(t.vt(e)&&e.isInline()){let t=o.getElementByKey(e.getKey());if(t!==null){let e=c.getComputedStyle(t).display;if(e===`inline-grid`||e===`inline-flex`){l=!0;break}}}if(!l)return!1;let u=t.f(a,n?`previous`:`next`).getNodeAtCaret();if(u===null||!t.vt(u)){if(n){let e=a.getFirstDescendant();t.Jt(e)?e.select(0,0):a.select(0,0)}else{let e=a.getLastDescendant();if(t.Jt(e)){let t=e.getTextContentSize();e.select(t,t)}else{let e=a.getChildrenSize();a.select(e,e)}}return!0}let d=o.getElementByKey(u.getKey());if(d===null)return!1;let f=t.M(c);if(f===null||f.rangeCount===0)return!1;let p=f.getRangeAt(0).cloneRange();p.collapse(!0);let m=p.getBoundingClientRect(),h=d.getBoundingClientRect(),g=h.top+h.height/2;if(m.height>0){let t=r.m(m.left,g,s);if(t!==null&&d.contains(t.node)){let n=s.ownerDocument.createRange();return n.setStart(t.node,t.offset),n.collapse(!0),e.applyDOMRange(n),e.dirty=!0,!0}}let _=n?u.getLastDescendant():u.getFirstDescendant();if(t.Jt(_)){let e=n?_.getTextContentSize():0;_.select(e,e)}else{let e=u.getChildrenSize();u.select(n?e:0,n?e:0)}return!0}function O(e,n){let r=t.f(e,n),i=r.getAdjacentCaret();i!==null&&t.vt(i.origin)&&!i.origin.isInline()&&i.origin.isShadowRoot()?t.en(t.t(r)):n===`next`?e.selectNext(0,0):e.selectPrevious()}function k(e,n,r){r.preventDefault(),r.stopPropagation();let i=e.getNodes();if(i.length===0)return!0;let a=i.map(e=>t.f(e,`next`)).sort(t.Un),o=(n?a[0]:a[a.length-1]).origin,s=t.B(o,e=>e!==o&&t.vt(e)&&!e.isInline())??t.Dr(),c=n?0:s.getChildrenSize();return s.select(c,c),!0}function A(e,i=r.B(x)){return t.Yn(e.registerCommand(t.K,()=>{let e=t.tt();return t.Fr(e)?(e.clear(),!0):(t.bn(e)&&b(e,`click`,`both`,i.peek()),!1)},0),e.registerCommand(t.It,e=>{let n=t.tt();return t.bn(n)?(n.deleteCharacter(e),!0):!!t.Fr(n)&&(n.deleteNodes(),!0)},0),e.registerCommand(t.gr,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteWord(e),!0)},0),e.registerCommand(t.Zt,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteLine(e),!0)},0),e.registerCommand(t.V,n=>{let i=t.tt();if(typeof n==`string`)i!==null&&i.insertText(n);else{if(i===null)return!1;let a=n.dataTransfer;if(a!=null)r.h(a,i,e);else if(t.bn(i)){let e=n.data;return e&&i.insertText(e),!0}}return!0},0),e.registerCommand(t.zt,()=>{let e=t.tt();return!!t.bn(e)&&(e.removeText(),!0)},0),e.registerCommand(t.w,e=>{let n=t.tt();return!(!t.bn(n)&&!t.Fr(n))&&(t.Bn(n,e),!0)},0),e.registerCommand(t.Kt,e=>{let n=t.tt();return!(!t.bn(n)&&!t.Fr(n))&&(t.Tn(n,e),!0)},0),e.registerCommand(t.tr,e=>{let n=t.tt();if(!t.bn(n)&&!t.Fr(n))return!1;let r=n.getNodes();for(let n of r){let r=t.B(n,e=>t.vt(e)&&!e.isInline());r!==null&&r.setFormat(e)}return!0},0),e.registerCommand(t.n,e=>{let n=t.tt();return!!t.bn(n)&&(n.insertLineBreak(e),!0)},0),e.registerCommand(t.A,()=>{let e=t.tt();return!!t.bn(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(t.Pn,()=>{let e=t.kr(),n=t.tt();return t.bn(n)&&(e.setFormat(n.format),e.setStyle(n.style)),t.W([e]),!0},0),e.registerCommand(t.on,()=>n.t(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(t.pr,()=>n.t(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(t.Cr,e=>{let n=t.tt();if(t.Fr(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],`previous`),!0}else if(t.bn(n)&&(!e.shiftKey&&S(n,`previous`)||!e.shiftKey&&T(n,!0)||!e.shiftKey&&D(n,!0)))return e.preventDefault(),!0;return!1},0),e.registerCommand(t.Qn,e=>{let n=t.tt();if(t.Fr(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],`next`),!0}else if(t.bn(n)&&(function(e){let n=e.focus;return n.key===`root`&&n.offset===t.Dr().getChildrenSize()}(n)||!e.shiftKey&&S(n,`next`)||!e.shiftKey&&T(n,!1)||!e.shiftKey&&D(n,!1)))return e.preventDefault(),!0;return!1},0),e.registerCommand(t.ur,e=>{let r=t.tt();if(t.Fr(r)){let t=r.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],n.k(t[0])?`next`:`previous`),!0}if(!t.bn(r))return!1;if(!e.shiftKey&&S(r,n.k(r.anchor.getNode())?`next`:`previous`))return e.preventDefault(),!0;if(e.shiftKey||b(r,`arrow`,`start`,i.peek()),n.I(r,!0)){let t=e.shiftKey;return e.preventDefault(),n.N(r,t,!0),!0}return!1},0),e.registerCommand(t.Dn,e=>{let r=t.tt();if(t.Fr(r)){let t=r.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],n.k(t[0])?`previous`:`next`),!0}if(!t.bn(r))return!1;if(!e.shiftKey&&S(r,n.k(r.anchor.getNode())?`previous`:`next`))return e.preventDefault(),!0;if(e.shiftKey||b(r,`arrow`,`end`,i.peek()),n.I(r,!1)){let t=e.shiftKey;return e.preventDefault(),n.N(r,t,!1),!0}return!1},0),e.registerCommand(t.Nr,r=>{let i=t.tt();if(!t.Fr(i)&&y(r.target))return!1;if(t.bn(i)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:r}=e;if(r.offset!==0)return!1;let i=r.getNode();if(t.ri(i))return!1;let a=n.o(i);return a.getIndent()>0&&(a.is(i)||i.is(a.getFirstDescendant()))}(i))return r.preventDefault(),e.dispatchCommand(t.pr,void 0);if(t.Xn&&t.xr)return!1}else if(!t.Fr(i))return!1;return r.preventDefault(),e.dispatchCommand(t.It,!0)},0),e.registerCommand(t.wn,n=>{let r=t.tt();return!(!t.Fr(r)&&y(n.target))&&!(!t.bn(r)&&!t.Fr(r))&&(n.preventDefault(),e.dispatchCommand(t.It,!1))},0),e.registerCommand(t.yn,n=>{let r=t.tt();if(t.Fr(r)){let e=r.getNodes();e.length===1&&t.$(e[0])&&!e[0].isInline()&&(r=e[0].selectNext())}if(!t.bn(r))return!1;if(b(r,`enter`,`both`,i.peek()),n!==null){if((t.Xn||t.ln||t.xn)&&t.xr)return!1;if(n.preventDefault(),n.shiftKey)return e.dispatchCommand(t.n,!1)}return e.dispatchCommand(t.A,void 0)},0),e.registerCommand(t.jn,()=>!!t.bn(t.tt())&&(e.blur(),!0),0),e.registerCommand(t.Qr,i=>{let[,a]=n.i(i);if(a.length>0){let n=i.clientX,o=i.clientY,s=r.m(n,o,e.getRootElement());if(s!==null){let{offset:n,node:r}=s,i=t.Yt(r);if(i!==null){let e=t.h();if(t.Jt(i))e.anchor.set(i.getKey(),n,`text`),e.focus.set(i.getKey(),n,`text`);else{let t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,`element`),e.focus.set(t,n,`element`)}t.En(t.R(e))}e.dispatchCommand(c,a)}return i.preventDefault(),!0}return r.f(i,e)},0),e.registerCommand(t.qr,i=>{let[a]=n.i(i),o=t.tt();return!(a&&!t.bn(o))&&(t.bn(o)&&!o.isCollapsed()&&i.dataTransfer!==null&&(r.d(i.dataTransfer,r.u(o)),r.v(i.dataTransfer,e)),!0)},0),e.registerCommand(t.l,i=>{let[a]=n.i(i),o=t.tt();if(a&&!t.bn(o))return!1;let s=i.clientX,c=i.clientY,l=r.m(s,c,e.getRootElement());return l!==null&&t.$(t.Yt(l.node))&&i.preventDefault(),!0},0),e.registerCommand(t.qn,()=>{let e=t.tt();return t.Zr(t.bn(e)&&t.Tr(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(t.Rr,t=>(r.c(e,n.s(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(t.Nt,i=>(async function(e,i){await r.c(i,n.s(e,ClipboardEvent)?e:null),i.update(()=>{let e=t.tt();t.bn(e)?e.removeText():t.Fr(e)&&e.getNodes().forEach(e=>e.remove())},{tag:`cut`})}(i,e),!0),0),e.registerCommand(t.Wn,i=>{let[,a,o]=n.i(i);return a.length>0&&!o?(e.dispatchCommand(c,a),!0):t.Ln(i.target)&&t.Gr(i.target)?!1:t.tt()!==null&&(function(e,i){e.preventDefault(),i.update(()=>{let a=t.tt(),o=n.s(e,InputEvent)||n.s(e,KeyboardEvent)?null:e.clipboardData;o!=null&&a!==null&&r.h(o,a,i)},{tag:`paste`})}(i,e),!0)},0),e.registerCommand(t.fn,()=>{let e=t.tt();return t.bn(e)&&b(e,`space`,`both`,i.peek()),!1},0),e.registerCommand(t.zn,()=>{let e=t.tt();return t.bn(e)&&b(e,`tab`,`both`,i.peek()),!1},0),e.registerCommand(t.sr,e=>{let n=t.tt();if(t.Fr(n))return k(n,!1,e);if(!t.bn(n))return!1;let{anchor:r}=n;if(r.type!==`element`||r.offset!==0)return!1;let i=r.getNode();if(!t.vt(i))return!1;let a=i.getFirstChild();if(!t.$(a)||!a.isInline())return!1;let o=i.getKey(),s=i.selectEnd();return e.shiftKey&&s.anchor.set(o,0,`element`),e.preventDefault(),e.stopPropagation(),!0},0),e.registerCommand(t.br,e=>{let n=t.tt();if(t.Fr(n))return k(n,!0,e);if(!t.bn(n))return!1;let{anchor:r,focus:i}=n,a=t.B(i.getNode(),e=>t.vt(e)&&!e.isInline());if(a===null)return!1;let o=a.getFirstChild();if(!t.$(o)||!o.isInline()||t.B(r.getNode(),e=>t.vt(e)&&!e.isInline())!==a)return!1;let s=a.getKey();return(i.type!==`element`||i.key!==s||i.offset!==0)&&(n.focus.set(s,0,`element`),e.shiftKey||n.anchor.set(s,0,`element`),e.preventDefault(),e.stopPropagation(),!0)},0))}var j=/^(\d+(?:\.\d+)?)px$/,M={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},N=class e extends t.m{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return`tablecell`}static clone(t){return new e(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign,this.__colSpan=e.__colSpan,this.__headerState=e.__headerState,this.__width=e.__width}static importDOM(){return{td:e=>({conversion:ee,priority:0}),th:e=>({conversion:ee,priority:0})}}static importJSON(e){return F().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=M.NO_STATUS,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let n=t.qt().createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),P(this.__verticalAlign)&&(n.style.verticalAlign=this.__verticalAlign),t.Vr(n,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),n}exportDOM(e){let n=super.exportDOM(e);if(t.Sn(n.element)){let e=n.element;e.setAttribute(`data-temporary-table-cell-lexical-key`,this.getKey()),e.style.border=`1px solid black`,this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||`top`,e.style.textAlign=`start`,this.__backgroundColor===null&&this.hasHeader()&&(e.style.backgroundColor=`#f2f3f5`)}return n}exportJSON(){return{...super.exportJSON(),...P(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?`th`:`td`}setHeaderStyles(e,t=M.BOTH){let n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){let t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==M.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function P(e){return e===`middle`||e===`bottom`}function ee(e){let n=e,r=e.nodeName.toLowerCase(),i;j.test(n.style.width)&&(i=parseFloat(n.style.width));let a=M.NO_STATUS;if(r===`th`){let e=n.getAttribute(`scope`);if(e===`col`)a=M.COLUMN;else if(e===`row`)a=M.ROW;else{let e=n.parentElement,r=t.Sn(e)&&e.nodeName.toLowerCase()===`tr`&&t.Sn(e.parentElement)&&(e.parentElement.nodeName.toLowerCase()===`thead`||e.rowIndex===0),i=n.cellIndex===0;r&&(a|=M.ROW),i&&(a|=M.COLUMN),a===M.NO_STATUS&&(a=M.ROW)}}let o=F(a,n.colSpan,i);o.__rowSpan=n.rowSpan;let s=n.style.backgroundColor;s!==``&&(o.__backgroundColor=s);let c=n.style.verticalAlign;P(c)&&(o.__verticalAlign=c);let l=n.style,u=(l&&l.textDecoration||``).split(` `),d=l.fontWeight===`700`||l.fontWeight===`bold`,f=u.includes(`line-through`),p=l.fontStyle===`italic`,m=u.includes(`underline`),h=l.color;return{after:e=>{let n=[],r=null,i=()=>{if(r){let e=r.getFirstChild();t._r(e)&&r.getChildrenSize()===1&&e.remove()}};for(let a of e)if(t.S(a)||t.Jt(a)||t._r(a)){if(t.Jt(a)&&(d&&a.toggleFormat(`bold`),f&&a.toggleFormat(`strikethrough`),p&&a.toggleFormat(`italic`),m&&a.toggleFormat(`underline`),h)){let e=a.getStyle();e.includes(`color:`)||a.setStyle(e+`color: ${h};`)}r?r.append(a):(r=t.Ar().append(a),n.push(r))}else n.push(a),i(),r=null;return i(),n.length===0&&n.push(t.Ar()),n},node:o}}function F(e=M.NO_STATUS,n=1,r){return t.o(new N(e,n,r))}function I(e){return e instanceof N}var te=t.x(`INSERT_TABLE_COMMAND`);function L(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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.`)}var ne=class e extends t.m{__height;static getType(){return`tablerow`}static clone(t){return new e(t.__height,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__height=e.__height}static importDOM(){return{tr:e=>({conversion:re,priority:0})}}static importJSON(e){return ie().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){let e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){let n=t.qt().createElement(`tr`);return this.__height&&(n.style.height=`${this.__height}px`),t.Vr(n,e.theme.tableRow),n}extractWithChild(e,t,n){return n===`html`}isShadowRoot(){return!0}setHeight(e){let t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function re(e){let t=e,r;return j.test(t.style.height)&&(r=parseFloat(t.style.height)),{after:e=>n.f(e,I),node:ie(r)}}function ie(e){return t.o(new ne(e))}function R(e){return e instanceof ne}function ae(e,n,r=!0){let i=Tt();for(let a=0;a<e;a++){let e=ie();for(let i=0;i<n;i++){let n=M.NO_STATUS;typeof r==`object`?(a===0&&r.rows&&(n|=M.ROW),i===0&&r.columns&&(n|=M.COLUMN)):r&&(a===0&&(n|=M.ROW),i===0&&(n|=M.COLUMN));let o=F(n),s=t.Ar();s.append(t.D()),o.append(s),e.append(o)}i.append(e)}return i}function oe(e){let n=t.B(e,e=>I(e));return I(n)?n:null}function se(e){let n=t.B(e,e=>R(e));if(R(n))return n;throw Error(`Expected table cell to be inside of table row.`)}function ce(e){let n=t.B(e,e=>K(e));if(K(n))return n;throw Error(`Expected table cell to be inside of table.`)}function le(e){let t=se(e);return ce(t).getChildren().findIndex(e=>e.is(t))}function ue(e){return se(e).getChildren().findIndex(t=>t.is(e))}var de=(e,t)=>e===M.BOTH||e===t?t:M.NO_STATUS;function fe(e=!0){let n=t.tt();t.bn(n)||H(n)||L(188);let r=n.anchor.getNode(),i=n.focus.getNode(),[a]=V(r),[o,,s]=V(i),[,c,l]=z(s,o,a),{startRow:u}=l,{startRow:d}=c;return e?pe(u+a.__rowSpan>d+o.__rowSpan?a:o,!0):pe(d<u?o:a,!1)}function pe(e,n=!0){let[,,r]=V(e),[i,a]=z(r,e,e),o=i[0].length,{startRow:s}=a,c=null;if(n){let n=s+e.__rowSpan-1,a=i[n],l=ie();for(let e=0;e<o;e++){let{cell:r,startRow:i}=a[e];if(i+r.__rowSpan-1<=n){let n=a[e].cell.__headerState,r=de(n,M.COLUMN);l.append(F(r).append(t.Ar()))}else r.setRowSpan(r.__rowSpan+1)}let u=r.getChildAtIndex(n);R(u)||L(256),u.insertAfter(l),c=l}else{let e=s,n=i[e],a=ie();for(let r=0;r<o;r++){let{cell:i,startRow:o}=n[r];if(o===e){let e=n[r].cell.__headerState,i=de(e,M.COLUMN);a.append(F(i).append(t.Ar()))}else i.setRowSpan(i.__rowSpan+1)}let l=r.getChildAtIndex(e);R(l)||L(257),l.insertBefore(a),c=a}return c}function me(e=!0){let n=t.tt();t.bn(n)||H(n)||L(188);let r=n.anchor.getNode(),i=n.focus.getNode(),[a]=V(r),[o,,s]=V(i),[,c,l]=z(s,o,a),{startColumn:u}=l,{startColumn:d}=c;return e?he(u+a.__colSpan>d+o.__colSpan?a:o,!0):he(d<u?o:a,!1)}function he(e,n=!0,r=!0){let[,,i]=V(e),[a,o]=z(i,e,e),s=a.length,{startColumn:c}=o,l=n?c+e.__colSpan-1:c-1,u=i.getFirstChild();R(u)||L(120);let d=null;function f(e=M.NO_STATUS){let n=F(e).append(t.Ar());return d===null&&(d=n),n}let p=u;e:for(let e=0;e<s;e++){if(e!==0){let e=p.getNextSibling();R(e)||L(121),p=e}let t=a[e],n=t[l<0?0:l].cell.__headerState,r=de(n,M.ROW);if(l<0){ye(p,f(r));continue}let{cell:i,startColumn:o,startRow:s}=t[l];if(o+i.__colSpan-1<=l){let n=i,a=s,o=l;for(;a!==e&&n.__rowSpan>1;){if(o-=i.__colSpan,!(o>=0)){p.append(f(r));continue e}{let{cell:e,startRow:r}=t[o];n=e,a=r}}n.insertAfter(f(r))}else i.setColSpan(i.__colSpan+1)}d!==null&&r&&ve(d);let m=i.getColWidths();if(m){let e=[...m],t=l<0?0:l,n=e[t];e.splice(t,0,n),i.setColWidths(e)}return d}function ge(){let e=t.tt();t.bn(e)||H(e)||L(188);let[n,r]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[i,,a]=V(n),[o]=V(r),[s,c,l]=z(a,i,o),{startRow:u}=c,{startRow:d}=l,f=d+o.__rowSpan-1;if(s.length===f-u+1)return void a.remove();let p=s[0].length,m=s[f+1],h=a.getChildAtIndex(f+1);for(let e=f;e>=u;e--){for(let t=p-1;t>=0;t--){let{cell:n,startRow:r,startColumn:i}=s[e][t];if(i===t){if(r<u||r+n.__rowSpan-1>f){let e=Math.max(r,u),t=Math.min(n.__rowSpan+r-1,f),i=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-i)}if(r>=u&&r+n.__rowSpan-1>f&&e===f){R(h)||L(387);let r=null;for(let n=0;n<t;n++){let t=m[n],i=t.cell;t.startRow===e+1&&(r=i),i.__colSpan>1&&(n+=i.__colSpan-1)}r===null?ye(h,n):r.insertAfter(n)}}}let t=a.getChildAtIndex(e);R(t)||L(206,String(e)),t.remove()}if(m!==void 0){let{cell:e}=m[0];ve(e)}else{let{cell:e}=s[u-1][0];ve(e)}}function _e(){let e=t.tt();t.bn(e)||H(e)||L(188);let n=e.anchor.getNode(),r=e.focus.getNode(),[i,,a]=V(n),[o]=V(r),[s,c,l]=z(a,i,o),{startColumn:u}=c,{startRow:d,startColumn:f}=l,p=Math.min(u,f),m=Math.max(u+i.__colSpan-1,f+o.__colSpan-1),h=m-p+1;if(s[0].length===m-p+1)return a.selectPrevious(),void a.remove();let g=s.length;for(let e=0;e<g;e++)for(let t=p;t<=m;t++){let{cell:n,startColumn:r}=s[e][t];if(r<p){if(t===p){let e=p-r;n.setColSpan(n.__colSpan-Math.min(h,n.__colSpan-e))}}else if(r+n.__colSpan-1>m){if(t===m){let e=m-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}let _=s[d],v=u>f?_[u+i.__colSpan]:_[f+o.__colSpan];if(v!==void 0){let{cell:e}=v;ve(e)}else{let{cell:e}=f<u?_[f-1]:_[u-1];ve(e)}let y=a.getColWidths();if(y){let e=[...y];e.splice(p,h),a.setColWidths(e)}}function ve(e){let t=e.getFirstDescendant();t==null?e.selectStart():t.getParentOrThrow().selectStart()}function ye(e,t){let n=e.getFirstChild();n===null?e.append(t):n.insertBefore(t)}function be(e){if(e.length===0)return null;let[n]=B(ce(e[0]),null,null),r=1/0,i=-1/0,a=1/0,o=-1/0,s=new Set;for(let t of n)for(let n of t){if(!n||!n.cell)continue;let t=n.cell.getKey();if(!s.has(t)&&e.some(e=>e.is(n.cell))){s.add(t);let e=n.startRow,c=n.startColumn,l=n.cell.__rowSpan||1,u=n.cell.__colSpan||1;r=Math.min(r,e),i=Math.max(i,e+l-1),a=Math.min(a,c),o=Math.max(o,c+u-1)}}if(r===1/0||a===1/0)return null;let c=i-r+1,l=o-a+1,u=n[r][a];if(!u.cell)return null;let d=u.cell;d.setColSpan(l),d.setRowSpan(c);let f=new Set([d.getKey()]);for(let e=r;e<=i;e++)for(let t=a;t<=o;t++){let r=n[e][t];if(!r.cell)continue;let i=r.cell,a=i.getKey();f.has(a)||(f.add(a),xe(i)||d.append(...i.getChildren()),i.remove())}return d.getChildrenSize()===0&&d.append(t.Ar()),d}function xe(e){if(e.getChildrenSize()!==1)return!1;let n=e.getFirstChildOrThrow();return!(!t.kn(n)||!n.isEmpty())}function Se(){let e=t.tt();t.bn(e)||H(e)||L(188);let n=t.B(e.anchor.getNode(),I);return I(n)||L(148),Ce(n)}function Ce(e){let[n,r,i]=V(e),a=n.__colSpan,o=n.__rowSpan;if(a===1&&o===1)return;let[s,c]=z(i,n,n),{startColumn:l,startRow:u}=c,d=n.__headerState&M.COLUMN,f=Array.from({length:a},(e,t)=>{let n=d;for(let e=0;n!==0&&e<s.length;e++)n&=s[e][t+l].cell.__headerState;return n}),p=n.__headerState&M.ROW,m=Array.from({length:o},(e,t)=>{let n=p;for(let e=0;n!==0&&e<s[0].length;e++)n&=s[t+u][e].cell.__headerState;return n});if(a>1){for(let e=1;e<a;e++)n.insertAfter(F(f[e]|m[0]).append(t.Ar()));n.setColSpan(1)}if(o>1){let e;for(let n=1;n<o;n++){let i=u+n,o=s[i];e=(e||r).getNextSibling(),R(e)||L(125);let c=null;for(let e=0;e<l;e++){let t=o[e],n=t.cell;t.startRow===i&&(c=n),n.__colSpan>1&&(e+=n.__colSpan-1)}if(c===null)for(let r=a-1;r>=0;r--)ye(e,F(f[r]|m[n]).append(t.Ar()));else for(let e=a-1;e>=0;e--)c.insertAfter(F(f[e]|m[n]).append(t.Ar()))}n.setRowSpan(1)}}function z(e,t,n){let[r,i,a]=B(e,t,n);return i===null&&L(207),a===null&&L(208),[r,i,a]}function B(e,t,n){let r=[],i=null,a=null;function o(e){let t=r[e];return t===void 0&&(r[e]=t=[]),t}let s=e.getChildren();for(let e=0;e<s.length;e++){let r=s[e];R(r)||L(209);let c=o(e);for(let l=r.getFirstChild(),u=0;l!=null;l=l.getNextSibling()){for(I(l)||L(147);c[u]!==void 0;)u++;let r={cell:l,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:f}=l;for(let t=0;t<d&&!(e+t>=s.length);t++){let n=o(e+t);for(let e=0;e<f;e++)n[u+e]=r}t!==null&&i===null&&t.is(l)&&(i=r),n!==null&&a===null&&n.is(l)&&(a=r)}}return[r,i,a]}function V(e){let n;if(e instanceof N)n=e;else if(`__type`in e){let r=t.B(e,I);I(r)||L(148),n=r}else{let r=t.B(e.getNode(),I);I(r)||L(148),n=r}let r=n.getParent();R(r)||L(149);let i=r.getParent();return K(i)||L(210),[n,r,i]}function we(e,t,n){let r,i=Math.min(t.startColumn,n.startColumn),a=Math.min(t.startRow,n.startRow),o=Math.max(t.startColumn+t.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),s=Math.max(t.startRow+t.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{r=!1;for(let t=0;t<e.length;t++)for(let n=0;n<e[0].length;n++){let c=e[t][n];if(!c)continue;let l=c.startColumn+c.cell.__colSpan-1,u=c.startRow+c.cell.__rowSpan-1,d=c.startColumn<=o&&l>=i,f=c.startRow<=s&&u>=a;if(d&&f){let e=Math.min(i,c.startColumn),t=Math.max(o,l),n=Math.min(a,c.startRow),d=Math.max(s,u);e===i&&t===o&&n===a&&d===s||(i=e,o=t,a=n,s=d,r=!0)}}}while(r);return{maxColumn:o,maxRow:s,minColumn:i,minRow:a}}function Te(e){let[t,,n]=V(e),r=n.getChildren().filter(R),i=r.length,a=r[0].getChildren().length,o=Array(i);for(let e=0;e<i;e++)o[e]=Array(a);for(let e=0;e<i;e++){let n=r[e].getChildren().filter(I),i=0;for(let r=0;r<n.length;r++){for(;o[e][i];)i++;let a=n[r],s=a.__rowSpan||1,c=a.__colSpan||1;for(let t=0;t<s;t++)for(let n=0;n<c;n++)o[e+t][i+n]=a;if(t===a)return{colSpan:c,columnIndex:i,rowIndex:e,rowSpan:s};i+=c}}return null}function Ee(e,n){let r=n.getStartEndPoints(),i=H(n);if(r===null)return!1;let[a,o]=r,[s,c,l]=V(a),u=t.B(o.getNode(),e=>I(e));if(!(I(s)&&I(u)&&R(c)&&K(l)))return!1;let[d,f,p]=z(l,s,u),[m]=B(e,null,null),h=d.length,g=h>0?d[0].length:0,_=f.startRow,v=f.startColumn,y=m.length,b=y>0?m[0].length:0;if(i){let e=we(d,f,p),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;_=e.minRow,v=e.minColumn,y=Math.min(y,t),b=Math.min(b,n)}let x=!1,S=Math.min(h,_+y)-1,C=Math.min(g,v+b)-1,w=new Set;for(let e=_;e<=S;e++)for(let t=v;t<=C;t++){let n=d[e][t];w.has(n.cell.getKey())||n.cell.__rowSpan===1&&n.cell.__colSpan===1||(Ce(n.cell),w.add(n.cell.getKey()),x=!0)}let[T]=B(l.getWritable(),null,null),E=y-h+_;for(let e=0;e<E;e++)pe(T[h-1][0].cell);let D=b-g+v;for(let e=0;e<D;e++)he(T[0][g-1].cell,!0,!1);[T]=B(l.getWritable(),null,null);for(let e=_;e<_+y;e++)for(let n=v;n<v+b;n++){let r=e-_,i=n-v,a=m[r][i];if(a.startRow!==r||a.startColumn!==i)continue;let o=a.cell;if(o.__rowSpan!==1||o.__colSpan!==1){let t=[],r=Math.min(e+o.__rowSpan,_+y)-1,i=Math.min(n+o.__colSpan,v+b)-1;for(let a=e;a<=r;a++)for(let e=n;e<=i;e++){let n=T[a][e];t.push(n.cell)}be(t),x=!0}let{cell:s}=T[e][n],c=o.getBackgroundColor();c!=null&&s.setBackgroundColor(c);let l=s.getChildren();o.getChildren().forEach(e=>{t.Jt(e)&&t.Ar().append(e),s.append(e)}),l.forEach(e=>e.remove())}if(i&&x){let[e]=B(l.getWritable(),null,null);e[f.startRow][f.startColumn].cell.selectEnd()}return!0}function De(e){let[[n,r,i,a],[o,s,c,l]]=[`anchor`,`focus`].map(n=>{let r=e[n].getNode(),i=t.B(r,I);I(i)||L(238,n,r.getKey(),r.getType());let a=i.getParent();R(a)||L(239,n);let o=a.getParent();return K(o)||L(240,n),[r,i,a,o]});return a.is(l)||L(241),{anchorCell:r,anchorNode:n,anchorRow:i,anchorTable:a,focusCell:s,focusNode:o,focusRow:c,focusTable:l}}var Oe=class e{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey===`root`||this.anchor.key===`root`||this.anchor.type!==`element`||this.focus.key===`root`||this.focus.type!==`element`)return!1;let e=t.Ht(this.tableKey),n=t.Ht(this.anchor.key),r=t.Ht(this.focus.key);return e!==null&&n!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return H(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new e(this.tableKey,t.dr(this.anchor.key,this.anchor.offset,this.anchor.type),t.dr(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){if(e===``)return;let n=(e.endsWith(`
1
+ const e=require("./rolldown-runtime-D_FWMvbo.cjs"),t=require("./Lexical.prod-C9Xekspf.cjs"),n=require("./LexicalUtils.prod-CYv8J7Gq.cjs"),r=require("./ContentEditable-Ce294XLd.cjs"),i=require("./useLexicalEditable.prod-B2XnDcjV.cjs");let a=require("react");a=e.a(a,1);let o=require("react/jsx-runtime"),s=require("react-dom");s=e.a(s,1),r.y.tag(`h1`,`h2`,`h3`,`h4`,`h5`,`h6`),r.y.tag(`blockquote`),r.y.tag(`blockquote`),r.y.tag(`p`),r.y.tag(`span`);var c=t.x(`DRAG_DROP_PASTE_FILE`),l=t.rr(`shadowRoot`,{parse:Boolean}),u=class e extends t.m{static getType(){return`quote`}static clone(t){return new e(t.__key)}$config(){return this.config(`quote`,{extends:t.m,stateConfigs:[{flat:!0,stateConfig:l}]})}isShadowRoot(){return t.Yr(this,l)}setIsShadowRoot(e){return t.jt(this,l,e)}createDOM(e){let n=t.qt().createElement(`blockquote`);return t.Vr(n,e.theme.quote),n}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:g,priority:0})}}exportDOM(e){let{element:n}=super.exportDOM(e);if(t.Sn(n)){this.isEmpty()&&n.append(t.qt().createElement(`br`));let e=this.getFormatType();e&&(n.style.textAlign=e);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return d().updateFromJSON(e)}exportJSON(){return super.exportJSON()}insertNewAfter(e,n){let r=t.Ar(),i=this.getDirection();return r.setDirection(i),this.insertAfter(r,n),r}collapseAtStart(){if(this.isShadowRoot()){for(let e of this.getChildren())this.insertBefore(e);return this.remove(),!0}let e=t.Ar();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function d(e){let n=t.o(new u);return e&&e.shadowRoot?n.setIsShadowRoot(!0):n}function f(e){return e instanceof u}var p=class e extends t.m{__tag;static getType(){return`heading`}static clone(t){return new e(t.__tag,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e=`h1`,t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){let t=this.getWritable();return t.__tag=e,t}createDOM(e){let n=this.__tag,r=t.qt().createElement(n),i=e.theme.heading;if(i!==void 0){let e=i[n];t.Vr(r,e)}return r}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:h,priority:0}),h2:e=>({conversion:h,priority:0}),h3:e=>({conversion:h,priority:0}),h4:e=>({conversion:h,priority:0}),h5:e=>({conversion:h,priority:0}),h6:e=>({conversion:h,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&m(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>m(e)?{conversion:e=>({node:_(`h1`)}),priority:3}:null}}exportDOM(e){let{element:n}=super.exportDOM(e);if(t.Sn(n)){this.isEmpty()&&n.append(t.qt().createElement(`br`));let e=this.getFormatType();e&&(n.style.textAlign=e);let r=this.getDirection();r&&(n.dir=r)}return{element:n}}static importJSON(e){return _(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,n=!0){let r=e?e.anchor.offset:0,i=this.getLastDescendant(),a=!i||e&&e.anchor.key===i.getKey()&&r===i.getTextContentSize()||!e?t.Ar():_(this.getTag()),o=this.getDirection();if(a.setDirection(o),this.insertAfter(a,n),r===0&&!this.isEmpty()&&e){let e=t.Ar();e.select(),this.replace(e,!0)}return a}collapseAtStart(){if(this.isEmpty()){let e=t.Ar();this.getChildren().forEach(t=>e.append(t)),this.replace(e)}return!0}extractWithChild(){return!0}};function m(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function h(e){let n=e.nodeName.toLowerCase(),r=null;return n!==`h1`&&n!==`h2`&&n!==`h3`&&n!==`h4`&&n!==`h5`&&n!==`h6`||(r=_(n),t.p(e,r),t.b(r,e),t._t(r,e)),{node:r}}function g(e){let n=d();return t.b(n,e),t.p(e,n),t._t(n,e),{node:n}}function _(e=`h1`){return t.o(new p(e))}function v(e){return e instanceof p}function y(e){return t.$(t.Yt(e))}function b(e,n,r,i){let a=!1,o=null;if(e.isCollapsed()&&e.anchor.type===`text`){let n=e.anchor.getNode();if(t.Jt(n)){o=n;let t=e.anchor.offset,i=t===n.getTextContentSize()&&n.getNextSibling()===null,s=t===0&&n.getPreviousSibling()===null;a=r===`end`&&i||r===`start`&&s||r===`both`&&(i||s)}}let s=!1;for(let[r,c]of Object.entries(i)){if(c==null||!c[n])continue;let i=r;if(c.onlyAtBoundary){if(!(a&&o&&t.Jt(o)&&o.hasFormat(i)))continue;s=!0}e.hasFormat(i)&&e.toggleFormat(i)}s&&e.setStyle(``)}var x={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function S(e,n){return function(e,n){if(!e.isCollapsed())return!1;let r=t.Gt(e.focus,n),i=t.B(r.origin,t.et);if(!i)return!1;let a=e.focus.getNode();if(!i.is(a)&&!t.i(a,i))return!1;let o=t.O(r,t.f(i,n));if(o.getTextSlices().some(e=>e&&e.getTextContentSize()>0))return!1;let s=t.O(o.anchor.getSiblingCaret(),o.focus),c=s.anchor.origin;for(let e of s){if(!t.Hr(e)||!e.origin.is(c.getParent()))return!1;c=e.origin}let l=i;for(let e of t.Ft(t.f(i,n))){if(!e.origin.is(l.getParent())){if(t.Rt(e.origin)){let e=t.f(l,n);return t.en(t.O(e,e)),!0}break}if(!t.et(e.origin))break;l=e.origin}return!1}(e,n)||function(e,n){if(!e.isCollapsed()||e.anchor.type!==`element`)return!1;let r=t.Gt(e.anchor,n).getNodeAtCaret();return!(!t.et(r)||r.isInline()||(t.en(t.t(t.wr(t.Z(r,n)))),0))}(e,n)}function C(e){return t.$(e)&&!e.isInline()&&!e.isIsolated()&&e.isKeyboardSelectable()}function w(e){let n=t.xt();n.add(e),t.En(n)}function T(e,n){if(!e.isCollapsed())return!1;let r=e.focus,i=r.getNode(),a=n?`previous`:`next`,o=t.Gt(r,a);if(r.type===`element`&&t.vt(i)&&(t.ri(i)||t.et(i))){let e=o.getNodeAtCaret();return!(e===null||!C(e))&&(w(e.__key),!0)}let s=t.B(t.vt(i)?i:i.getParentOrThrow(),e=>t.vt(e)&&!e.isInline()&&t.J(e.getParent()));if(s===null)return!1;let c=t.f(s,a).getNodeAtCaret();if(c===null||!C(c))return!1;if(s.getTextContentSize()===0)return w(c.__key),!0;let l=t.s().getRootElement();if(l===null)return!1;let u=t.M(l.ownerDocument.defaultView);if(u===null||u.rangeCount===0)return!1;let d=u.anchorNode,f=u.anchorOffset,p=u.focusNode,m=u.focusOffset;u.modify(`move`,n?`backward`:`forward`,`line`);let h=u.anchorNode,g=u.anchorOffset;if(h===null)return E(u,d,f,p,m),!1;let _=t.Yt(h);return E(u,d,f,p,m),_!==null&&(h===d&&g===f||!_.is(s)&&!t.i(_,s))&&(w(c.__key),!0)}function E(e,t,n,r,i){t!==null&&r!==null&&e.setBaseAndExtent(t,n,r,i)}function D(e,n){if(!e.isCollapsed())return!1;let i=e.focus.getNode(),a=t.B(t.vt(i)?i:i.getParentOrThrow(),e=>t.vt(e)&&!e.isInline());if(a===null)return!1;let o=t.s(),s=o.getRootElement();if(s===null)return!1;let c=s.ownerDocument.defaultView;if(c===null)return!1;let l=!1;for(let e of a.getChildren())if(t.vt(e)&&e.isInline()){let t=o.getElementByKey(e.getKey());if(t!==null){let e=c.getComputedStyle(t).display;if(e===`inline-grid`||e===`inline-flex`){l=!0;break}}}if(!l)return!1;let u=t.f(a,n?`previous`:`next`).getNodeAtCaret();if(u===null||!t.vt(u)){if(n){let e=a.getFirstDescendant();t.Jt(e)?e.select(0,0):a.select(0,0)}else{let e=a.getLastDescendant();if(t.Jt(e)){let t=e.getTextContentSize();e.select(t,t)}else{let e=a.getChildrenSize();a.select(e,e)}}return!0}let d=o.getElementByKey(u.getKey());if(d===null)return!1;let f=t.M(c);if(f===null||f.rangeCount===0)return!1;let p=f.getRangeAt(0).cloneRange();p.collapse(!0);let m=p.getBoundingClientRect(),h=d.getBoundingClientRect(),g=h.top+h.height/2;if(m.height>0){let t=r.m(m.left,g,s);if(t!==null&&d.contains(t.node)){let n=s.ownerDocument.createRange();return n.setStart(t.node,t.offset),n.collapse(!0),e.applyDOMRange(n),e.dirty=!0,!0}}let _=n?u.getLastDescendant():u.getFirstDescendant();if(t.Jt(_)){let e=n?_.getTextContentSize():0;_.select(e,e)}else{let e=u.getChildrenSize();u.select(n?e:0,n?e:0)}return!0}function O(e,n){let r=t.f(e,n),i=r.getAdjacentCaret();i!==null&&t.vt(i.origin)&&!i.origin.isInline()&&i.origin.isShadowRoot()?t.en(t.t(r)):n===`next`?e.selectNext(0,0):e.selectPrevious()}function k(e,n,r){r.preventDefault(),r.stopPropagation();let i=e.getNodes();if(i.length===0)return!0;let a=i.map(e=>t.f(e,`next`)).sort(t.Un),o=(n?a[0]:a[a.length-1]).origin,s=t.B(o,e=>e!==o&&t.vt(e)&&!e.isInline())??t.Dr(),c=n?0:s.getChildrenSize();return s.select(c,c),!0}function A(e,i=r.B(x)){return t.Yn(e.registerCommand(t.K,()=>{let e=t.tt();return t.Fr(e)?(e.clear(),!0):(t.bn(e)&&b(e,`click`,`both`,i.peek()),!1)},0),e.registerCommand(t.It,e=>{let n=t.tt();return t.bn(n)?(n.deleteCharacter(e),!0):!!t.Fr(n)&&(n.deleteNodes(),!0)},0),e.registerCommand(t.gr,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteWord(e),!0)},0),e.registerCommand(t.Zt,e=>{let n=t.tt();return!!t.bn(n)&&(n.deleteLine(e),!0)},0),e.registerCommand(t.V,n=>{let i=t.tt();if(typeof n==`string`)i!==null&&i.insertText(n);else{if(i===null)return!1;let a=n.dataTransfer;if(a!=null)r.h(a,i,e);else if(t.bn(i)){let e=n.data;return e&&i.insertText(e),!0}}return!0},0),e.registerCommand(t.zt,()=>{let e=t.tt();return!!t.bn(e)&&(e.removeText(),!0)},0),e.registerCommand(t.w,e=>{let n=t.tt();return!(!t.bn(n)&&!t.Fr(n))&&(t.Bn(n,e),!0)},0),e.registerCommand(t.Kt,e=>{let n=t.tt();return!(!t.bn(n)&&!t.Fr(n))&&(t.Tn(n,e),!0)},0),e.registerCommand(t.tr,e=>{let n=t.tt();if(!t.bn(n)&&!t.Fr(n))return!1;let r=n.getNodes();for(let n of r){let r=t.B(n,e=>t.vt(e)&&!e.isInline());r!==null&&r.setFormat(e)}return!0},0),e.registerCommand(t.n,e=>{let n=t.tt();return!!t.bn(n)&&(n.insertLineBreak(e),!0)},0),e.registerCommand(t.A,()=>{let e=t.tt();return!!t.bn(e)&&(e.insertParagraph(),!0)},0),e.registerCommand(t.Pn,()=>{let e=t.kr(),n=t.tt();return t.bn(n)&&(e.setFormat(n.format),e.setStyle(n.style)),t.W([e]),!0},0),e.registerCommand(t.on,()=>n.t(e=>{let t=e.getIndent();e.setIndent(t+1)}),0),e.registerCommand(t.pr,()=>n.t(e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),0),e.registerCommand(t.Cr,e=>{let n=t.tt();if(t.Fr(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],`previous`),!0}else if(t.bn(n)&&(!e.shiftKey&&S(n,`previous`)||!e.shiftKey&&T(n,!0)||!e.shiftKey&&D(n,!0)))return e.preventDefault(),!0;return!1},0),e.registerCommand(t.Qn,e=>{let n=t.tt();if(t.Fr(n)){let t=n.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],`next`),!0}else if(t.bn(n)&&(function(e){let n=e.focus;return n.key===`root`&&n.offset===t.Dr().getChildrenSize()}(n)||!e.shiftKey&&S(n,`next`)||!e.shiftKey&&T(n,!1)||!e.shiftKey&&D(n,!1)))return e.preventDefault(),!0;return!1},0),e.registerCommand(t.ur,e=>{let r=t.tt();if(t.Fr(r)){let t=r.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],n.O(t[0])?`next`:`previous`),!0}if(!t.bn(r))return!1;if(!e.shiftKey&&S(r,n.O(r.anchor.getNode())?`next`:`previous`))return e.preventDefault(),!0;if(e.shiftKey||b(r,`arrow`,`start`,i.peek()),n.F(r,!0)){let t=e.shiftKey;return e.preventDefault(),n.M(r,t,!0),!0}return!1},0),e.registerCommand(t.Dn,e=>{let r=t.tt();if(t.Fr(r)){let t=r.getNodes();if(t.length>0)return e.preventDefault(),O(t[0],n.O(t[0])?`previous`:`next`),!0}if(!t.bn(r))return!1;if(!e.shiftKey&&S(r,n.O(r.anchor.getNode())?`previous`:`next`))return e.preventDefault(),!0;if(e.shiftKey||b(r,`arrow`,`end`,i.peek()),n.F(r,!1)){let t=e.shiftKey;return e.preventDefault(),n.M(r,t,!1),!0}return!1},0),e.registerCommand(t.Nr,r=>{let i=t.tt();if(!t.Fr(i)&&y(r.target))return!1;if(t.bn(i)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:r}=e;if(r.offset!==0)return!1;let i=r.getNode();if(t.ri(i))return!1;let a=n.o(i);return a.getIndent()>0&&(a.is(i)||i.is(a.getFirstDescendant()))}(i))return r.preventDefault(),e.dispatchCommand(t.pr,void 0);if(t.Xn&&t.xr)return!1}else if(!t.Fr(i))return!1;return r.preventDefault(),e.dispatchCommand(t.It,!0)},0),e.registerCommand(t.wn,n=>{let r=t.tt();return!(!t.Fr(r)&&y(n.target))&&!(!t.bn(r)&&!t.Fr(r))&&(n.preventDefault(),e.dispatchCommand(t.It,!1))},0),e.registerCommand(t.yn,n=>{let r=t.tt();if(t.Fr(r)){let e=r.getNodes();e.length===1&&t.$(e[0])&&!e[0].isInline()&&(r=e[0].selectNext())}if(!t.bn(r))return!1;if(b(r,`enter`,`both`,i.peek()),n!==null){if((t.Xn||t.ln||t.xn)&&t.xr)return!1;if(n.preventDefault(),n.shiftKey)return e.dispatchCommand(t.n,!1)}return e.dispatchCommand(t.A,void 0)},0),e.registerCommand(t.jn,()=>!!t.bn(t.tt())&&(e.blur(),!0),0),e.registerCommand(t.Qr,i=>{let[,a]=n.i(i);if(a.length>0){let n=i.clientX,o=i.clientY,s=r.m(n,o,e.getRootElement());if(s!==null){let{offset:n,node:r}=s,i=t.Yt(r);if(i!==null){let e=t.h();if(t.Jt(i))e.anchor.set(i.getKey(),n,`text`),e.focus.set(i.getKey(),n,`text`);else{let t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,`element`),e.focus.set(t,n,`element`)}t.En(t.R(e))}e.dispatchCommand(c,a)}return i.preventDefault(),!0}return r.f(i,e)},0),e.registerCommand(t.qr,i=>{let[a]=n.i(i),o=t.tt();return!(a&&!t.bn(o))&&(t.bn(o)&&!o.isCollapsed()&&i.dataTransfer!==null&&(r.d(i.dataTransfer,r.u(o)),r.v(i.dataTransfer,e)),!0)},0),e.registerCommand(t.l,i=>{let[a]=n.i(i),o=t.tt();if(a&&!t.bn(o))return!1;let s=i.clientX,c=i.clientY,l=r.m(s,c,e.getRootElement());return l!==null&&t.$(t.Yt(l.node))&&i.preventDefault(),!0},0),e.registerCommand(t.qn,()=>{let e=t.tt();return t.Zr(t.bn(e)&&t.Tr(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(t.Rr,t=>(r.c(e,n.s(t,ClipboardEvent)?t:null),!0),0),e.registerCommand(t.Nt,i=>(async function(e,i){await r.c(i,n.s(e,ClipboardEvent)?e:null),i.update(()=>{let e=t.tt();t.bn(e)?e.removeText():t.Fr(e)&&e.getNodes().forEach(e=>e.remove())},{tag:`cut`})}(i,e),!0),0),e.registerCommand(t.Wn,i=>{let[,a,o]=n.i(i);return a.length>0&&!o?(e.dispatchCommand(c,a),!0):t.Ln(i.target)&&t.Gr(i.target)?!1:t.tt()!==null&&(function(e,i){e.preventDefault(),i.update(()=>{let a=t.tt(),o=n.s(e,InputEvent)||n.s(e,KeyboardEvent)?null:e.clipboardData;o!=null&&a!==null&&r.h(o,a,i)},{tag:`paste`})}(i,e),!0)},0),e.registerCommand(t.fn,()=>{let e=t.tt();return t.bn(e)&&b(e,`space`,`both`,i.peek()),!1},0),e.registerCommand(t.zn,()=>{let e=t.tt();return t.bn(e)&&b(e,`tab`,`both`,i.peek()),!1},0),e.registerCommand(t.sr,e=>{let n=t.tt();if(t.Fr(n))return k(n,!1,e);if(!t.bn(n))return!1;let{anchor:r}=n;if(r.type!==`element`||r.offset!==0)return!1;let i=r.getNode();if(!t.vt(i))return!1;let a=i.getFirstChild();if(!t.$(a)||!a.isInline())return!1;let o=i.getKey(),s=i.selectEnd();return e.shiftKey&&s.anchor.set(o,0,`element`),e.preventDefault(),e.stopPropagation(),!0},0),e.registerCommand(t.br,e=>{let n=t.tt();if(t.Fr(n))return k(n,!0,e);if(!t.bn(n))return!1;let{anchor:r,focus:i}=n,a=t.B(i.getNode(),e=>t.vt(e)&&!e.isInline());if(a===null)return!1;let o=a.getFirstChild();if(!t.$(o)||!o.isInline()||t.B(r.getNode(),e=>t.vt(e)&&!e.isInline())!==a)return!1;let s=a.getKey();return(i.type!==`element`||i.key!==s||i.offset!==0)&&(n.focus.set(s,0,`element`),e.shiftKey||n.anchor.set(s,0,`element`),e.preventDefault(),e.stopPropagation(),!0)},0))}var j=/^(\d+(?:\.\d+)?)px$/,M={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1},N=class e extends t.m{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return`tablecell`}static clone(t){return new e(t.__headerState,t.__colSpan,t.__width,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign,this.__colSpan=e.__colSpan,this.__headerState=e.__headerState,this.__width=e.__width}static importDOM(){return{td:e=>({conversion:ee,priority:0}),th:e=>({conversion:ee,priority:0})}}static importJSON(e){return F().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=M.NO_STATUS,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){let n=t.qt().createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),this.__colSpan>1&&(n.colSpan=this.__colSpan),this.__rowSpan>1&&(n.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(n.style.backgroundColor=this.__backgroundColor),P(this.__verticalAlign)&&(n.style.verticalAlign=this.__verticalAlign),t.Vr(n,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),n}exportDOM(e){let n=super.exportDOM(e);if(t.Sn(n.element)){let e=n.element;e.setAttribute(`data-temporary-table-cell-lexical-key`,this.getKey()),e.style.border=`1px solid black`,this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||`top`,e.style.textAlign=`start`,this.__backgroundColor===null&&this.hasHeader()&&(e.style.backgroundColor=`#f2f3f5`)}return n}exportJSON(){return{...super.exportJSON(),...P(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){let t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){let t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?`th`:`td`}setHeaderStyles(e,t=M.BOTH){let n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){let t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){let t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){let t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){let t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==M.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}};function P(e){return e===`middle`||e===`bottom`}function ee(e){let n=e,r=e.nodeName.toLowerCase(),i;j.test(n.style.width)&&(i=parseFloat(n.style.width));let a=M.NO_STATUS;if(r===`th`){let e=n.getAttribute(`scope`);if(e===`col`)a=M.COLUMN;else if(e===`row`)a=M.ROW;else{let e=n.parentElement,r=t.Sn(e)&&e.nodeName.toLowerCase()===`tr`&&t.Sn(e.parentElement)&&(e.parentElement.nodeName.toLowerCase()===`thead`||e.rowIndex===0),i=n.cellIndex===0;r&&(a|=M.ROW),i&&(a|=M.COLUMN),a===M.NO_STATUS&&(a=M.ROW)}}let o=F(a,n.colSpan,i);o.__rowSpan=n.rowSpan;let s=n.style.backgroundColor;s!==``&&(o.__backgroundColor=s);let c=n.style.verticalAlign;P(c)&&(o.__verticalAlign=c);let l=n.style,u=(l&&l.textDecoration||``).split(` `),d=l.fontWeight===`700`||l.fontWeight===`bold`,f=u.includes(`line-through`),p=l.fontStyle===`italic`,m=u.includes(`underline`),h=l.color;return{after:e=>{let n=[],r=null,i=()=>{if(r){let e=r.getFirstChild();t._r(e)&&r.getChildrenSize()===1&&e.remove()}};for(let a of e)if(t.S(a)||t.Jt(a)||t._r(a)){if(t.Jt(a)&&(d&&a.toggleFormat(`bold`),f&&a.toggleFormat(`strikethrough`),p&&a.toggleFormat(`italic`),m&&a.toggleFormat(`underline`),h)){let e=a.getStyle();e.includes(`color:`)||a.setStyle(e+`color: ${h};`)}r?r.append(a):(r=t.Ar().append(a),n.push(r))}else n.push(a),i(),r=null;return i(),n.length===0&&n.push(t.Ar()),n},node:o}}function F(e=M.NO_STATUS,n=1,r){return t.o(new N(e,n,r))}function I(e){return e instanceof N}var te=t.x(`INSERT_TABLE_COMMAND`);function L(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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.`)}var ne=class e extends t.m{__height;static getType(){return`tablerow`}static clone(t){return new e(t.__height,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__height=e.__height}static importDOM(){return{tr:e=>({conversion:re,priority:0})}}static importJSON(e){return ie().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){let e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){let n=t.qt().createElement(`tr`);return this.__height&&(n.style.height=`${this.__height}px`),t.Vr(n,e.theme.tableRow),n}extractWithChild(e,t,n){return n===`html`}isShadowRoot(){return!0}setHeight(e){let t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function re(e){let t=e,r;return j.test(t.style.height)&&(r=parseFloat(t.style.height)),{after:e=>n.f(e,I),node:ie(r)}}function ie(e){return t.o(new ne(e))}function R(e){return e instanceof ne}function ae(e,n,r=!0){let i=Et();for(let a=0;a<e;a++){let e=ie();for(let i=0;i<n;i++){let n=M.NO_STATUS;typeof r==`object`?(a===0&&r.rows&&(n|=M.ROW),i===0&&r.columns&&(n|=M.COLUMN)):r&&(a===0&&(n|=M.ROW),i===0&&(n|=M.COLUMN));let o=F(n),s=t.Ar();s.append(t.D()),o.append(s),e.append(o)}i.append(e)}return i}function oe(e){let n=t.B(e,e=>I(e));return I(n)?n:null}function se(e){let n=t.B(e,e=>R(e));if(R(n))return n;throw Error(`Expected table cell to be inside of table row.`)}function ce(e){let n=t.B(e,e=>G(e));if(G(n))return n;throw Error(`Expected table cell to be inside of table.`)}function le(e){let t=se(e);return ce(t).getChildren().findIndex(e=>e.is(t))}function ue(e){return se(e).getChildren().findIndex(t=>t.is(e))}var de=(e,t)=>e===M.BOTH||e===t?t:M.NO_STATUS;function fe(e=!0){let n=t.tt();t.bn(n)||H(n)||L(188);let r=n.anchor.getNode(),i=n.focus.getNode(),[a]=V(r),[o,,s]=V(i),[,c,l]=z(s,o,a),{startRow:u}=l,{startRow:d}=c;return e?pe(u+a.__rowSpan>d+o.__rowSpan?a:o,!0):pe(d<u?o:a,!1)}function pe(e,n=!0){let[,,r]=V(e),[i,a]=z(r,e,e),o=i[0].length,{startRow:s}=a,c=null;if(n){let n=s+e.__rowSpan-1,a=i[n],l=ie();for(let e=0;e<o;e++){let{cell:r,startRow:i}=a[e];if(i+r.__rowSpan-1<=n){let n=a[e].cell.__headerState,r=de(n,M.COLUMN);l.append(F(r).append(t.Ar()))}else r.setRowSpan(r.__rowSpan+1)}let u=r.getChildAtIndex(n);R(u)||L(256),u.insertAfter(l),c=l}else{let e=s,n=i[e],a=ie();for(let r=0;r<o;r++){let{cell:i,startRow:o}=n[r];if(o===e){let e=n[r].cell.__headerState,i=de(e,M.COLUMN);a.append(F(i).append(t.Ar()))}else i.setRowSpan(i.__rowSpan+1)}let l=r.getChildAtIndex(e);R(l)||L(257),l.insertBefore(a),c=a}return c}function me(e=!0){let n=t.tt();t.bn(n)||H(n)||L(188);let r=n.anchor.getNode(),i=n.focus.getNode(),[a]=V(r),[o,,s]=V(i),[,c,l]=z(s,o,a),{startColumn:u}=l,{startColumn:d}=c;return e?he(u+a.__colSpan>d+o.__colSpan?a:o,!0):he(d<u?o:a,!1)}function he(e,n=!0,r=!0){let[,,i]=V(e),[a,o]=z(i,e,e),s=a.length,{startColumn:c}=o,l=n?c+e.__colSpan-1:c-1,u=i.getFirstChild();R(u)||L(120);let d=null;function f(e=M.NO_STATUS){let n=F(e).append(t.Ar());return d===null&&(d=n),n}let p=u;e:for(let e=0;e<s;e++){if(e!==0){let e=p.getNextSibling();R(e)||L(121),p=e}let t=a[e],n=t[l<0?0:l].cell.__headerState,r=de(n,M.ROW);if(l<0){ye(p,f(r));continue}let{cell:i,startColumn:o,startRow:s}=t[l];if(o+i.__colSpan-1<=l){let n=i,a=s,o=l;for(;a!==e&&n.__rowSpan>1;){if(o-=i.__colSpan,!(o>=0)){p.append(f(r));continue e}{let{cell:e,startRow:r}=t[o];n=e,a=r}}n.insertAfter(f(r))}else i.setColSpan(i.__colSpan+1)}d!==null&&r&&ve(d);let m=i.getColWidths();if(m){let e=[...m],t=l<0?0:l,n=e[t];e.splice(t,0,n),i.setColWidths(e)}return d}function ge(){let e=t.tt();t.bn(e)||H(e)||L(188);let[n,r]=e.isBackward()?[e.focus.getNode(),e.anchor.getNode()]:[e.anchor.getNode(),e.focus.getNode()],[i,,a]=V(n),[o]=V(r),[s,c,l]=z(a,i,o),{startRow:u}=c,{startRow:d}=l,f=d+o.__rowSpan-1;if(s.length===f-u+1)return void a.remove();let p=s[0].length,m=s[f+1],h=a.getChildAtIndex(f+1);for(let e=f;e>=u;e--){for(let t=p-1;t>=0;t--){let{cell:n,startRow:r,startColumn:i}=s[e][t];if(i===t){if(r<u||r+n.__rowSpan-1>f){let e=Math.max(r,u),t=Math.min(n.__rowSpan+r-1,f),i=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-i)}if(r>=u&&r+n.__rowSpan-1>f&&e===f){R(h)||L(387);let r=null;for(let n=0;n<t;n++){let t=m[n],i=t.cell;t.startRow===e+1&&(r=i),i.__colSpan>1&&(n+=i.__colSpan-1)}r===null?ye(h,n):r.insertAfter(n)}}}let t=a.getChildAtIndex(e);R(t)||L(206,String(e)),t.remove()}if(m!==void 0){let{cell:e}=m[0];ve(e)}else{let{cell:e}=s[u-1][0];ve(e)}}function _e(){let e=t.tt();t.bn(e)||H(e)||L(188);let n=e.anchor.getNode(),r=e.focus.getNode(),[i,,a]=V(n),[o]=V(r),[s,c,l]=z(a,i,o),{startColumn:u}=c,{startRow:d,startColumn:f}=l,p=Math.min(u,f),m=Math.max(u+i.__colSpan-1,f+o.__colSpan-1),h=m-p+1;if(s[0].length===m-p+1)return a.selectPrevious(),void a.remove();let g=s.length;for(let e=0;e<g;e++)for(let t=p;t<=m;t++){let{cell:n,startColumn:r}=s[e][t];if(r<p){if(t===p){let e=p-r;n.setColSpan(n.__colSpan-Math.min(h,n.__colSpan-e))}}else if(r+n.__colSpan-1>m){if(t===m){let e=m-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}let _=s[d],v=u>f?_[u+i.__colSpan]:_[f+o.__colSpan];if(v!==void 0){let{cell:e}=v;ve(e)}else{let{cell:e}=f<u?_[f-1]:_[u-1];ve(e)}let y=a.getColWidths();if(y){let e=[...y];e.splice(p,h),a.setColWidths(e)}}function ve(e){let t=e.getFirstDescendant();t==null?e.selectStart():t.getParentOrThrow().selectStart()}function ye(e,t){let n=e.getFirstChild();n===null?e.append(t):n.insertBefore(t)}function be(e){if(e.length===0)return null;let[n]=B(ce(e[0]),null,null),r=1/0,i=-1/0,a=1/0,o=-1/0,s=new Set;for(let t of n)for(let n of t){if(!n||!n.cell)continue;let t=n.cell.getKey();if(!s.has(t)&&e.some(e=>e.is(n.cell))){s.add(t);let e=n.startRow,c=n.startColumn,l=n.cell.__rowSpan||1,u=n.cell.__colSpan||1;r=Math.min(r,e),i=Math.max(i,e+l-1),a=Math.min(a,c),o=Math.max(o,c+u-1)}}if(r===1/0||a===1/0)return null;let c=i-r+1,l=o-a+1,u=n[r][a];if(!u.cell)return null;let d=u.cell;d.setColSpan(l),d.setRowSpan(c);let f=new Set([d.getKey()]);for(let e=r;e<=i;e++)for(let t=a;t<=o;t++){let r=n[e][t];if(!r.cell)continue;let i=r.cell,a=i.getKey();f.has(a)||(f.add(a),xe(i)||d.append(...i.getChildren()),i.remove())}return d.getChildrenSize()===0&&d.append(t.Ar()),d}function xe(e){if(e.getChildrenSize()!==1)return!1;let n=e.getFirstChildOrThrow();return!(!t.kn(n)||!n.isEmpty())}function Se(){let e=t.tt();t.bn(e)||H(e)||L(188);let n=t.B(e.anchor.getNode(),I);return I(n)||L(148),Ce(n)}function Ce(e){let[n,r,i]=V(e),a=n.__colSpan,o=n.__rowSpan;if(a===1&&o===1)return;let[s,c]=z(i,n,n),{startColumn:l,startRow:u}=c,d=n.__headerState&M.COLUMN,f=Array.from({length:a},(e,t)=>{let n=d;for(let e=0;n!==0&&e<s.length;e++)n&=s[e][t+l].cell.__headerState;return n}),p=n.__headerState&M.ROW,m=Array.from({length:o},(e,t)=>{let n=p;for(let e=0;n!==0&&e<s[0].length;e++)n&=s[t+u][e].cell.__headerState;return n});if(a>1){for(let e=1;e<a;e++)n.insertAfter(F(f[e]|m[0]).append(t.Ar()));n.setColSpan(1)}if(o>1){let e;for(let n=1;n<o;n++){let i=u+n,o=s[i];e=(e||r).getNextSibling(),R(e)||L(125);let c=null;for(let e=0;e<l;e++){let t=o[e],n=t.cell;t.startRow===i&&(c=n),n.__colSpan>1&&(e+=n.__colSpan-1)}if(c===null)for(let r=a-1;r>=0;r--)ye(e,F(f[r]|m[n]).append(t.Ar()));else for(let e=a-1;e>=0;e--)c.insertAfter(F(f[e]|m[n]).append(t.Ar()))}n.setRowSpan(1)}}function z(e,t,n){let[r,i,a]=B(e,t,n);return i===null&&L(207),a===null&&L(208),[r,i,a]}function B(e,t,n){let r=[],i=null,a=null;function o(e){let t=r[e];return t===void 0&&(r[e]=t=[]),t}let s=e.getChildren();for(let e=0;e<s.length;e++){let r=s[e];R(r)||L(209);let c=o(e);for(let l=r.getFirstChild(),u=0;l!=null;l=l.getNextSibling()){for(I(l)||L(147);c[u]!==void 0;)u++;let r={cell:l,startColumn:u,startRow:e},{__rowSpan:d,__colSpan:f}=l;for(let t=0;t<d&&!(e+t>=s.length);t++){let n=o(e+t);for(let e=0;e<f;e++)n[u+e]=r}t!==null&&i===null&&t.is(l)&&(i=r),n!==null&&a===null&&n.is(l)&&(a=r)}}return[r,i,a]}function V(e){let n;if(e instanceof N)n=e;else if(`__type`in e){let r=t.B(e,I);I(r)||L(148),n=r}else{let r=t.B(e.getNode(),I);I(r)||L(148),n=r}let r=n.getParent();R(r)||L(149);let i=r.getParent();return G(i)||L(210),[n,r,i]}function we(e,t,n){let r,i=Math.min(t.startColumn,n.startColumn),a=Math.min(t.startRow,n.startRow),o=Math.max(t.startColumn+t.cell.__colSpan-1,n.startColumn+n.cell.__colSpan-1),s=Math.max(t.startRow+t.cell.__rowSpan-1,n.startRow+n.cell.__rowSpan-1);do{r=!1;for(let t=0;t<e.length;t++)for(let n=0;n<e[0].length;n++){let c=e[t][n];if(!c)continue;let l=c.startColumn+c.cell.__colSpan-1,u=c.startRow+c.cell.__rowSpan-1,d=c.startColumn<=o&&l>=i,f=c.startRow<=s&&u>=a;if(d&&f){let e=Math.min(i,c.startColumn),t=Math.max(o,l),n=Math.min(a,c.startRow),d=Math.max(s,u);e===i&&t===o&&n===a&&d===s||(i=e,o=t,a=n,s=d,r=!0)}}}while(r);return{maxColumn:o,maxRow:s,minColumn:i,minRow:a}}function Te(e){let[t,,n]=V(e),r=n.getChildren().filter(R),i=r.length,a=r[0].getChildren().length,o=Array(i);for(let e=0;e<i;e++)o[e]=Array(a);for(let e=0;e<i;e++){let n=r[e].getChildren().filter(I),i=0;for(let r=0;r<n.length;r++){for(;o[e][i];)i++;let a=n[r],s=a.__rowSpan||1,c=a.__colSpan||1;for(let t=0;t<s;t++)for(let n=0;n<c;n++)o[e+t][i+n]=a;if(t===a)return{colSpan:c,columnIndex:i,rowIndex:e,rowSpan:s};i+=c}}return null}function Ee(e,n){let r=n.getStartEndPoints(),i=H(n);if(r===null)return!1;let[a,o]=r,[s,c,l]=V(a),u=t.B(o.getNode(),e=>I(e));if(!(I(s)&&I(u)&&R(c)&&G(l)))return!1;let[d,f,p]=z(l,s,u),[m]=B(e,null,null),h=d.length,g=h>0?d[0].length:0,_=f.startRow,v=f.startColumn,y=m.length,b=y>0?m[0].length:0;if(i){let e=we(d,f,p),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;_=e.minRow,v=e.minColumn,y=Math.min(y,t),b=Math.min(b,n)}let x=!1,S=Math.min(h,_+y)-1,C=Math.min(g,v+b)-1,w=new Set;for(let e=_;e<=S;e++)for(let t=v;t<=C;t++){let n=d[e][t];w.has(n.cell.getKey())||n.cell.__rowSpan===1&&n.cell.__colSpan===1||(Ce(n.cell),w.add(n.cell.getKey()),x=!0)}let[T]=B(l.getWritable(),null,null),E=y-h+_;for(let e=0;e<E;e++)pe(T[h-1][0].cell);let D=b-g+v;for(let e=0;e<D;e++)he(T[0][g-1].cell,!0,!1);[T]=B(l.getWritable(),null,null);for(let e=_;e<_+y;e++)for(let n=v;n<v+b;n++){let r=e-_,i=n-v,a=m[r][i];if(a.startRow!==r||a.startColumn!==i)continue;let o=a.cell;if(o.__rowSpan!==1||o.__colSpan!==1){let t=[],r=Math.min(e+o.__rowSpan,_+y)-1,i=Math.min(n+o.__colSpan,v+b)-1;for(let a=e;a<=r;a++)for(let e=n;e<=i;e++){let n=T[a][e];t.push(n.cell)}be(t),x=!0}let{cell:s}=T[e][n],c=o.getBackgroundColor();c!=null&&s.setBackgroundColor(c);let l=s.getChildren();o.getChildren().forEach(e=>{t.Jt(e)&&t.Ar().append(e),s.append(e)}),l.forEach(e=>e.remove())}if(i&&x){let[e]=B(l.getWritable(),null,null);e[f.startRow][f.startColumn].cell.selectEnd()}return!0}function De(e){let[[n,r,i,a],[o,s,c,l]]=[`anchor`,`focus`].map(n=>{let r=e[n].getNode(),i=t.B(r,I);I(i)||L(238,n,r.getKey(),r.getType());let a=i.getParent();R(a)||L(239,n);let o=a.getParent();return G(o)||L(240,n),[r,i,a,o]});return a.is(l)||L(241),{anchorCell:r,anchorNode:n,anchorRow:i,anchorTable:a,focusCell:s,focusNode:o,focusRow:c,focusTable:l}}var Oe=class e{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey===`root`||this.anchor.key===`root`||this.anchor.type!==`element`||this.focus.key===`root`||this.focus.type!==`element`)return!1;let e=t.Ht(this.tableKey),n=t.Ht(this.anchor.key),r=t.Ht(this.focus.key);return e!==null&&n!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return H(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new e(this.tableKey,t.dr(this.anchor.key,this.anchor.offset,this.anchor.type),t.dr(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){if(e===``)return;let n=(e.endsWith(`
2
2
  `)?e.slice(0,-1):e).split(`
3
- `).map(e=>e.split(` `)),r=Tt();for(let e of n){let n=ie();for(let r of e){let e=F(M.NO_STATUS),i=t.Ar();r&&i.append(t.D(r)),e.append(i),n.append(e)}r.append(n)}let{anchorCell:i}=De(this);Ee(r,i.select(0,i.getChildrenSize()))}insertText(){}hasFormat(e){let n=0;this.getNodes().filter(I).forEach(e=>{let r=e.getFirstChild();t.kn(r)&&(n|=r.getTextFormat())});let r=t.ti[e];return(n&r)!==0}insertNodes(e){let n=this.focus.getNode();t.vt(n)||L(151),t.R(n.select(0,n.getChildrenSize())).insertNodes(e)}getShape(){let{anchorCell:e,focusCell:t}=De(this),n=Te(e);n===null&&L(153);let r=Te(t);r===null&&L(155);let i=Math.min(n.columnIndex,r.columnIndex),a=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),o=Math.min(n.rowIndex,r.rowIndex),s=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,a),fromY:Math.min(o,s),toX:Math.max(i,a),toY:Math.max(o,s)}}getNodes(){if(!this.isValid())return[];let e=this._cachedNodes;if(e!==null)return e;let{anchorTable:n,anchorCell:r,focusCell:i}=De(this),a=i.getParents()[1];if(a!==n){if(n.isParentOf(i)){let e=a.getParent();e??L(159),this.set(this.tableKey,i.getKey(),e.getKey())}else{let e=n.getParent();e??L(158),this.set(this.tableKey,e.getKey(),i.getKey())}return this.getNodes()}let[o,s,c]=z(n,r,i),{minColumn:l,maxColumn:u,minRow:d,maxRow:f}=we(o,s,c),p=new Map([[n.getKey(),n]]),m=null;for(let e=d;e<=f;e++)for(let t=l;t<=u;t++){let{cell:n}=o[e][t],r=n.getParent();R(r)||L(160),r!==m&&(p.set(r.getKey(),r),m=r),p.has(n.getKey())||je(n,e=>{p.set(e.getKey(),e)})}let h=Array.from(p.values());return t.dn()||(this._cachedNodes=h),h}getTextContent(){let e=this.getNodes().filter(e=>I(e)),t=``;for(let n=0;n<e.length;n++){let r=e[n],i=r.__parent,a=(e[n+1]||{}).__parent;t+=r.getTextContent()+(a===i?` `:`
4
- `)}return t}};function H(e){return e instanceof Oe}function ke(){return new Oe(`root`,t.dr(`root`,0,`element`),t.dr(`root`,0,`element`))}function Ae(e,n,r){e.getKey(),n.getKey(),r.getKey();let i=t.tt(),a=H(i)?i.clone():ke();return a.set(e.getKey(),n.getKey(),r.getKey()),a}function je(e,n){let r=[[e]];for(let e=r.at(-1);e!==void 0&&r.length>0;e=r.at(-1)){let i=e.pop();i===void 0?r.pop():!1!==n(i)&&t.vt(i)&&r.push(i.getChildren())}}function Me(e,n=t.s()){let r=t.Ht(e);K(r)||L(231,e);let i=U(r,n.getElementByKey(e));return i===null&&L(232,e),{tableElement:i,tableNode:r}}var Ne=class{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){let{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){let{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}removeObserver(e){let t=this.observers.get(e);return t!==void 0&&(t[0].removeListeners(),this.observers.delete(e),!0)}removeAllObservers(){for(let e of Array.from(this.observers.keys()))this.removeObserver(e)}$getTableNodesAndObservers(){let e=[];for(let[n,[r]]of Array.from(this.observers.entries())){let i=t.Ht(n);K(i)?e.push([i,r]):this.removeObserver(n)}return e}},Pe=class{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort(`removeListeners`),Array.from(this.listenersToRemove).forEach(e=>e()),this.listenersToRemove.clear()}$lookup(){return Me(this.tableNodeKey,this.editor)}trackTable(){let e=new MutationObserver(e=>{this.editor.read(`latest`,()=>{let t=!1;for(let n=0;n<e.length;n++){let r=e[n].target.nodeName;if(r===`TABLE`||r===`TBODY`||r===`THEAD`||r===`TR`){t=!0;break}}if(!t)return;let{tableNode:n,tableElement:r}=this.$lookup();this.table=Qe(n,r)})});this.editor.read(`latest`,()=>{let{tableNode:t,tableElement:n}=this.$lookup();this.table=Qe(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})})}$clearHighlight(e=!0){let n=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();let{tableNode:r,tableElement:i}=this.$lookup();$e(n,Qe(r,i),null),e&&t.tt()!==null&&(t.En(null),n.dispatchCommand(t.F,void 0))}$enableHighlightStyle(){let e=this.editor,{tableElement:n}=this.$lookup();t.Pt(n,e._config.theme.tableSelection),n.classList.remove(`disable-selection`),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){let{tableElement:e}=this.$lookup();t.Vr(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&L(233,e.tableKey,this.tableNodeKey);let t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),$e(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){let e=t.M(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,n=!1){let r=this.editor,{tableNode:i}=this.$lookup(),a=e.x,o=e.y;if(this.focusCell=e,!this.isHighlightingCells&&(n||this.anchorX!==a||this.anchorY!==o||this.tableSelection!=null&&this.anchorCellNodeKey!=null)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),this.focusX!==-1&&this.focusY!==-1&&a===this.focusX&&o===this.focusY)return!1;if(this.focusX=a,this.focusY=o,this.isHighlightingCells){let s=gt(i,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null){let e=s;if(e===null&&n&&(e=i.getCellNodeFromCords(a,o,this.table)),e!==null){let n=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=e.getKey(),this.tableSelection=Ae(i,n,e),t.En(this.tableSelection),r.dispatchCommand(t.F,void 0),$e(r,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){let e=this.anchorCellNodeKey?t.Ht(this.anchorCellNodeKey):null;return I(e)?e:null}$getAnchorTableCellOrThrow(){let e=this.$getAnchorTableCell();return e===null&&L(234),e}$getFocusTableCell(){let e=this.focusCellNodeKey?t.Ht(this.focusCellNodeKey):null;return I(e)?e:null}$getFocusTableCellOrThrow(){let e=this.$getFocusTableCell();return e===null&&L(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;let{tableNode:t}=this.$lookup(),n=gt(t,e.elem);if(n!==null){let e=n.getKey();this.tableSelection==null?this.tableSelection=Ae(t,n,n):(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),e,e)),this.anchorCellNodeKey=e}}$formatCells(e){let n=t.tt();H(n)||L(236);let r=t.h(),i=r.anchor,a=r.focus,o=n.getNodes().filter(I);o.length>0||L(237);let s=o[0].getFirstChild(),c=t.kn(s)?s.getFormatFlags(e,null):null;o.forEach(t=>{i.set(t.getKey(),0,`element`),a.set(t.getKey(),t.getChildrenSize(),`element`),r.formatText(e,c)}),t.En(n),this.editor.dispatchCommand(t.F,void 0)}$clearText(){let{editor:e}=this,n=t.Ht(this.tableNodeKey);if(!K(n))throw Error(`Expected TableNode.`);let r=t.tt();H(r)||L(253);let i=r.getNodes().filter(I),a=n.getFirstChild(),o=n.getLastChild();if(i.length>0&&a!==null&&o!==null&&R(a)&&R(o)&&i[0]===a.getFirstChild()&&i[i.length-1]===o.getLastChild()){n.selectPrevious();let r=n.getParent();n.remove(),t.ri(r)&&r.isEmpty()&&e.dispatchCommand(t.A,void 0);return}i.forEach(e=>{if(t.vt(e)){let n=t.Ar(),r=t.D();n.append(r),e.append(n),e.getChildren().forEach(e=>{e!==n&&e.remove()})}}),$e(e,this.table,null),t.En(null),e.dispatchCommand(t.F,void 0)}},Fe=`__lexicalTableSelection`;function Ie(e){let n=t.Ut(e);return K(n)||L(386,e),n}var Le=40;function Re(e,t,n){let r=e=>Math.max(1,Math.ceil(Math.min(Le,e)/Le*18));return e<=t+Le?-r(t+Le-e):e>=n-Le?r(e-(n-Le)):0}function ze(e){return t.Sn(e)&&e.nodeName===`TABLE`}function U(e,t){if(!t)return t;let n=ze(t)?t:t.querySelector(`table`);return ze(n)||L(341,e.constructor.name,e.getType(),e.getKey(),t.nodeName),n}function Be(e){return e._window}function Ve(e,t){for(let n=t,r=null;n!==null;n=n.getParent()){if(e.is(n))return r;I(n)&&(r=n)}return null}var He=[[t.Qn,`down`],[t.Cr,`up`],[t.ur,`backward`],[t.Dn,`forward`]],Ue=[t.gr,t.Zt,t.It],We=[t.Nr,t.wn];function Ge(e,n){return e.registerRootListener(r=>{if(r===null)return;let i=e._window;if(i!==null)return t.yt(i,`pointerdown`,i=>{let a=t.Zn(i);if(i.button!==0||!t.Ln(a)||!r.contains(a))return;let o=function(e){let t=Xe(e);if(t===null)return null;let n=t.elem;for(;n!=null;){if(n.nodeName===`TABLE`&&Fe in n&&n[Fe])return{cellElement:t,tableElement:n,tableObserver:n[Fe]};n=n.parentNode}return null}(a);e.update(()=>{if(H(t.tt())){for(let[e]of n.observers.values())e.$clearHighlight(!1);t.En(null),e.dispatchCommand(t.F,void 0)}if(!o)return;let{tableObserver:r,tableElement:a,cellElement:s}=o;(function(e,n,r,i,a,o){let s=e._window;if(!s)return;let c=r=>{if(a.isSelecting)return;a.isSelecting=!0,r!==null&&a.anchorCell===null&&e.update(()=>{a.$setAnchorCellForSelection(r)});let c=n.clientX,l=n.clientY,u=null,d=()=>{a.isSelecting=!1,u!==null&&(s.cancelAnimationFrame(u),u=null),s.removeEventListener(`pointerup`,b),s.removeEventListener(`pointermove`,x)},f=(e,n)=>{let r=i.getRootNode();if(!t.X(r)&&!t.Gn(r))return null;for(let t of r.elementsFromPoint(e,n)){let e=Ze(i,t);if(e)return e}return null},p=(n,r)=>{a.anchorCell===null&&e.update(()=>{a.$setAnchorCellForSelection(n)}),a.focusCell!==null&&n.elem===a.focusCell.elem||(o.setNextFocus({focusCell:n,override:r,tableKey:a.tableNodeKey}),e.dispatchCommand(t.F,void 0))},m=e=>{for(let t=i.parentElement;t;t=t.parentElement)if(e===`x`?t.scrollWidth>t.clientWidth:t.scrollHeight>t.clientHeight){let n=s.getComputedStyle(t),r=e===`x`?n.overflowX:n.overflowY;if(r===`auto`||r===`scroll`)return t}return null},h=(e,t,n)=>{let r,i;if(e===null)r=0,i=n===`x`?s.innerWidth:s.innerHeight;else{let t=e.getBoundingClientRect();r=n===`x`?t.left:t.top,i=n===`x`?t.right:t.bottom}let a=Re(t,r,i);if(a===0)return!1;if(e===null){let e=n===`x`?s.scrollX:s.scrollY;return s.scrollBy(n===`x`?a:0,n===`x`?0:a),(n===`x`?s.scrollX:s.scrollY)!==e}if(n===`x`){let t=e.scrollLeft;return e.scrollLeft+=a,e.scrollLeft!==t}let o=e.scrollTop;return e.scrollTop+=a,e.scrollTop!==o},g=(e,t)=>{let n=c,r=l;if(e===null)n=Math.min(Math.max(n,1),s.innerWidth-1);else{let t=e.getBoundingClientRect();n=Math.min(Math.max(n,t.left+1),t.right-1)}if(t===null)r=Math.min(Math.max(r,1),s.innerHeight-1);else{let e=t.getBoundingClientRect();r=Math.min(Math.max(r,e.top+1),e.bottom-1)}return[n,r]},_=()=>{let e=m(`x`);if(e!==null){let t=e.getBoundingClientRect();if(Re(c,t.left,t.right)!==0)return!0}let t=m(`y`),n=t===null?0:t.getBoundingClientRect().top,r=t===null?s.innerHeight:t.getBoundingClientRect().bottom;return Re(l,n,r)!==0},v=()=>{if(u=null,!a.isSelecting)return;let e=m(`x`),t=m(`y`),n=e!==null&&h(e,c,`x`),r=h(t,l,`y`);if(n||r){let[n,r]=g(e,t),i=f(n,r);i&&p(i,!1),u=s.requestAnimationFrame(v)}},y=()=>{u===null&&a.pointerType!==`touch`&&_()&&(u=s.requestAnimationFrame(v))},b=()=>{d()},x=e=>{if(!(e=>!(1&~e.buttons))(e)&&a.isSelecting)return void d();let n=t.Zn(e);if(!t.Ln(n))return;c=e.clientX,l=e.clientY;let r=null,o=!(t.Vn||i.contains(n));r=o?Ze(i,n):f(e.clientX,e.clientY),r&&p(r,o),y()};s.addEventListener(`pointerup`,b,a.listenerOptions),s.addEventListener(`pointermove`,x,a.listenerOptions)};a.pointerType=n.pointerType;let l=Ie(a.tableNodeKey),u=t.Y();if(t.Vn&&n.shiftKey&&W(u,l)&&(t.bn(u)||H(u))){let e=u.anchor.getNode(),t=Ve(l,u.anchor.getNode());t?(a.$setAnchorCellForSelection(ht(a,t)),a.$setFocusCellForSelection(r),G(n)):(l.isBefore(e)?l.selectStart():l.selectEnd()).anchor.set(u.anchor.key,u.anchor.offset,u.anchor.type)}else n.pointerType!==`touch`&&a.$setAnchorCellForSelection(r);c(r)})(e,i,s,a,r,n)})})})}function Ke(e,i,a,o,s){let c=a.getRootElement(),l=Be(a);c!==null&&l!==null||L(246);let u=new Pe(a,e.getKey()),d=U(e,i);(function(e,t){Ye(e)!==null&&L(205),e[Fe]=t})(d,u),u.listenersToRemove.add(()=>function(e,t){Ye(e)===t&&delete e[Fe]}(d,u)),u.listenersToRemove.add(t.yt(d,`mousedown`,e=>{let n=t.Zn(e);e.detail>=3&&t.Ln(n)&&Xe(n)!==null&&e.preventDefault()},u.listenerOptions));for(let[t,n]of He)u.listenersToRemove.add(a.registerCommand(t,t=>ft(a,t,n,e,u,s),3));u.listenersToRemove.add(a.registerCommand(t.jn,n=>{let r=t.tt();if(H(r)){let t=Ve(e,r.focus.getNode());if(t!==null)return G(n),t.selectEnd(),!0}return!1},3));let f=n=>()=>{let r=t.tt();if(!W(r,e))return!1;if(H(r))return u.$clearText(),!0;if(t.bn(r)){if(!I(Ve(e,r.anchor.getNode())))return!1;let i=r.anchor.getNode(),a=r.focus.getNode(),o=e.isParentOf(i),s=e.isParentOf(a);if(o&&!s||s&&!o)return u.$clearText(),!0;let c=t.B(r.anchor.getNode(),e=>t.vt(e)),l=c&&t.B(c,e=>t.vt(e)&&I(e.getParent()));if(!t.vt(l)||!t.vt(c))return!1;if(n===t.Zt&&l.getPreviousSibling()===null)return!0}return!1};for(let e of Ue)u.listenersToRemove.add(a.registerCommand(e,f(e),3));let p=n=>{let r=t.tt();if(!H(r)&&!t.bn(r))return!1;let i=e.isParentOf(r.anchor.getNode());if(i!==e.isParentOf(r.focus.getNode())){let t=i?`anchor`:`focus`,n=i?`focus`:`anchor`,{key:a,offset:o,type:s}=r[n];return e[r[t].isBefore(r[n])?`selectPrevious`:`selectNext`]()[n].set(a,o,s),!1}return!!W(r,e)&&!!H(r)&&(n&&(n.preventDefault(),n.stopPropagation()),u.$clearText(),!0)};for(let e of We)u.listenersToRemove.add(a.registerCommand(e,p,3));u.listenersToRemove.add(a.registerCommand(t.Nt,e=>{let i=t.tt();if(i){if(!H(i)&&!t.bn(i))return!1;r.c(a,n.s(e,ClipboardEvent)?e:null,r.u(i));let o=p(e);return t.bn(i)?(i.removeText(),!0):o}return!1},3));let m=c.ownerDocument;return u.listenersToRemove.add(t.yt(m,`paste`,n=>{n.defaultPrevented||a.read(`latest`,()=>{let n=t.tt();return c.contains(m.activeElement)&&H(n)&&W(n,e)})&&(n.preventDefault(),a.dispatchCommand(t.Wn,n))})),u.listenersToRemove.add(t.yt(m,`copy`,n=>{if(n.defaultPrevented)return;let r=t.Zn(n);r===c||t.Ln(r)&&c.contains(r)||a.read(`latest`,()=>{let n=t.tt();return c.contains(t.Hn(c))&&H(n)&&W(n,e)})&&(n.preventDefault(),a.dispatchCommand(t.Rr,n))})),u.listenersToRemove.add(a.registerCommand(t.w,n=>{let r=t.tt();return W(r,e)?H(r)?(u.$formatCells(n),!0):(t.bn(r)&&I(t.B(r.anchor.getNode(),e=>I(e))),!1):!1},3)),u.listenersToRemove.add(a.registerCommand(t.tr,n=>{let r=t.tt();if(!H(r)||!W(r,e))return!1;let i=r.anchor.getNode(),a=r.focus.getNode();if(!I(i)||!I(a))return!1;if(function(e,t){if(H(e)){let n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){let[e]=z(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(r,e))return e.setFormat(n),!0;let[o,s,c]=z(e,i,a),l=Math.max(s.startRow+s.cell.__rowSpan-1,c.startRow+c.cell.__rowSpan-1),u=Math.max(s.startColumn+s.cell.__colSpan-1,c.startColumn+c.cell.__colSpan-1),d=Math.min(s.startRow,c.startRow),f=Math.min(s.startColumn,c.startColumn),p=new Set;for(let e=d;e<=l;e++)for(let r=f;r<=u;r++){let i=o[e][r].cell;if(p.has(i))continue;p.add(i),i.setFormat(n);let a=i.getChildren();for(let e=0;e<a.length;e++){let r=a[e];t.vt(r)&&!r.isInline()&&r.setFormat(n)}}return!0},3)),u.listenersToRemove.add(a.registerCommand(t.V,n=>{let r=t.tt();if(!W(r,e))return!1;if(H(r))return u.$clearHighlight(),!1;if(t.bn(r)){if(!I(t.B(r.anchor.getNode(),e=>I(e))))return!1;if(typeof n==`string`){let i=mt(a,r,e);if(i)return pt(i,e,[t.D(n)]),!0}}return!1},3)),o&&u.listenersToRemove.add(a.registerCommand(t.zn,n=>{let r=t.tt();if(!t.bn(r)||!r.isCollapsed()||!W(r,e))return!1;let i=lt(r.anchor.getNode());return!(i===null||!e.is(ut(i)))&&(G(n),function(e,n){let r=n===`next`?`getNextSibling`:`getPreviousSibling`,i=n===`next`?`getFirstChild`:`getLastChild`,a=e[r]();if(t.vt(a))return a.selectEnd();let o=t.B(e,R);o===null&&L(247);for(let e=o[r]();R(e);e=e[r]()){let n=e[i]();if(t.vt(n))return n.selectEnd()}let s=t.B(o,K);s===null&&L(248),n===`next`?s.selectNext():s.selectPrevious()}(i,n.shiftKey?`previous`:`next`),!0)},3)),u.listenersToRemove.add(a.registerCommand(t.mt,t=>e.isSelected(),3)),u.listenersToRemove.add(a.registerCommand(t.A,()=>{let n=t.tt();if(!t.bn(n)||!n.isCollapsed()||!W(n,e))return!1;let r=mt(a,n,e);return!!r&&(pt(r,e),!0)},3)),u}function qe(e,n){let r=t.tt(),i=t.Y(),a=e.getAndClearNextFocus();if(a!==null){let{tableKey:t,focusCell:n}=a,i=e.observers.get(t);i||L(335,t);let[o]=i;if(H(r)&&r.tableKey===o.tableNodeKey)return(n.x!==o.focusX||n.y!==o.focusY)&&(o.$setFocusCellForSelection(n),!0);if(o.anchorCell!==null&&o.anchorCellNodeKey!==null&&n.elem!==o.anchorCell.elem&&o.tableSelection!==null)return o.$setFocusCellForSelection(n,!0),!0}let o=e.getAndClearShouldCheckSelectionForTable();if(o&&t.bn(i)&&t.bn(r)&&r.isCollapsed()){let e=t.Ht(o);if(K(e)){let n=r.anchor.getNode(),i=e.getFirstChild(),a=lt(n);if(a!==null&&R(i)){let n=i.getFirstChild();if(I(n)&&e.is(t.B(a,t=>t.is(e)||t.is(n))))return n.selectStart(),!0}}}H(r)&&function(e,n){let r=Be(e),i=t.Y();if(!n.is(i))return;let a=Ie(n.tableKey),o=t.M(r),s=o&&t.Er(o,e.getRootElement());if(o&&s&&s.anchorNode&&s.focusNode){let r=t.Yt(s.focusNode),i=r&&!a.isParentOf(r),c=t.Yt(s.anchorNode),l=c&&a.isParentOf(c);if(i&&l&&o.rangeCount>0){let r=t.C(o,e);r&&(r.anchor.set(a.getKey(),n.isBackward()?a.getChildrenSize():0,`element`),o.removeAllRanges(),t.En(r))}}}(n,r),t.bn(r)&&function(e,n){let r=t.Y(),{anchor:i,focus:a}=e,o=i.getNode(),s=a.getNode(),c=lt(o),l=lt(s),u=c?ut(c):null,d=l?ut(l):null,f=e.isBackward(),p=c&&l&&u&&d&&u.is(d),m=d&&(!u||u.isParentOf(d)),h=u&&(!d||d.isParentOf(u));if(m){let n=e.clone(),[r]=z(d,l,l),i=r[0][0].cell,a=r[r.length-1].at(-1).cell;n.focus.set(f?i.getKey():a.getKey(),f?0:a.getChildrenSize(),`element`),t.En(n)}else if(h){let n=e.clone(),[r]=z(u,c,c),i=r[0][0].cell,a=r[r.length-1].at(-1).cell;n.anchor.set(f?a.getKey():i.getKey(),f?a.getChildrenSize():0,`element`),t.En(n)}else if(p){let i=n.observers.get(u.getKey());i||L(335,u.getKey());let[a]=i;if(c.is(l)||(a.$setAnchorCellForSelection(ht(a,c)),a.$setFocusCellForSelection(ht(a,l),!0)),a.pointerType===`touch`&&a.isSelecting&&e.isCollapsed()&&t.bn(r)&&r.isCollapsed()){let e=lt(r.anchor.getNode());e&&!e.is(l)&&(a.$setAnchorCellForSelection(ht(a,e)),a.$setFocusCellForSelection(ht(a,l),!0),a.pointerType=null)}}}(r,e);for(let[t,r]of e.$getTableNodesAndObservers())Je(n,t,r);return!1}function Je(e,n,r){let i=t.tt(),a=t.Y();i&&!i.is(a)&&(H(i)||H(a))&&r.tableSelection&&!r.tableSelection.is(a)&&(H(i)&&i.tableKey===r.tableNodeKey?r.$updateTableTableSelection(i):!H(i)&&H(a)&&a.tableKey===r.tableNodeKey&&r.$updateTableTableSelection(null)),r.hasHijackedSelectionStyles&&!n.isSelected()?function(e,t){t.$enableHighlightStyle(),et(t.table,t=>{let n=t.elem;t.highlighted=!1,ct(e,t),n.getAttribute(`style`)||n.removeAttribute(`style`)})}(e,r):!r.hasHijackedSelectionStyles&&n.isSelected()&&function(e,t){t.$disableHighlightStyle(),et(t.table,t=>{t.highlighted=!0,st(e,t)})}(e,r)}function Ye(e){return e[Fe]||null}function Xe(e){let t=e;for(;t!=null;){let e=t.nodeName;if(e===`TD`||e===`TH`){let e=t._cell;return e===void 0?null:e}t=t.parentNode}return null}function Ze(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;r!=null;r=r.parentNode){if(r===e)return n;let t=r.nodeName;t!==`TD`&&t!==`TH`||(n=r._cell||null)}return null}function Qe(e,t){let n=[],r={columns:0,domRows:n,rows:0},i=U(e,t).querySelector(`tr`),a=0,o=0;for(n.length=0;i!=null;){let e=i.nodeName;if(e===`TD`||e===`TH`){let e={elem:i,hasBackgroundColor:i.style.backgroundColor!==``,highlighted:!1,x:a,y:o};i._cell=e;let t=n[o];t===void 0&&(t=n[o]=[]),t[a]=e}else{let e=i.firstChild;if(e!=null){i=e;continue}}let t=i.nextSibling;if(t!=null){a++,i=t;continue}let r=i.parentNode;if(r!=null){let e=r.nextSibling;if(e==null)break;o++,a=0,i=e}}return r.columns=a+1,r.rows=o+1,r}function $e(e,t,n){let r=new Set(n?n.getNodes():[]);et(t,(t,n)=>{let i=t.elem;r.has(n)?(t.highlighted=!0,st(e,t)):(t.highlighted=!1,ct(e,t),i.getAttribute(`style`)||i.removeAttribute(`style`))})}function et(e,n){let{domRows:r}=e;for(let e=0;e<r.length;e++){let i=r[e];if(i)for(let r=0;r<i.length;r++){let a=i[r];if(!a)continue;let o=t.Yt(a.elem);o!==null&&n(a,o,{x:r,y:e})}}}var tt=(e,t,n,r,i)=>{let a=i===`forward`;switch(i){case`backward`:case`forward`:return n===(a?e.table.columns-1:0)?r===(a?e.table.rows-1:0)?a?t.selectNext():t.selectPrevious():ot(t.getCellNodeFromCordsOrThrow(a?0:e.table.columns-1,r+(a?1:-1),e.table),a):ot(t.getCellNodeFromCordsOrThrow(n+(a?1:-1),r,e.table),a),!0;case`up`:return r===0?t.selectPrevious():ot(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1),!0;case`down`:return r===e.table.rows-1?t.selectNext():ot(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0),!0;default:return!1}};function nt(e,t){let n,r;if(t.startColumn===e.minColumn)n=`minColumn`;else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n=`maxColumn`}if(t.startRow===e.minRow)r=`minRow`;else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r=`maxRow`}return[n,r]}function rt([e,t]){return[e===`minColumn`?`maxColumn`:`minColumn`,t===`minRow`?`maxRow`:`minRow`]}function it(e,t,[n,r]){let i=t[r],a=e[i];a===void 0&&L(250,r,String(i));let o=t[n],s=a[o];return s===void 0&&L(250,n,String(o)),s}function at(e,t,n,r,i){let a=we(t,n,r),{topSpan:o,leftSpan:s,bottomSpan:c,rightSpan:l}=function(e,t){let{minColumn:n,maxColumn:r,minRow:i,maxRow:a}=t,o=1,s=1,c=1,l=1,u=e[i],d=e[a];for(let e=n;e<=r;e++)o=Math.max(o,u[e].cell.__rowSpan),l=Math.max(l,d[e].cell.__rowSpan);for(let t=i;t<=a;t++)s=Math.max(s,e[t][n].cell.__colSpan),c=Math.max(c,e[t][r].cell.__colSpan);return{bottomSpan:l,leftSpan:s,rightSpan:c,topSpan:o}}(t,a),[u,d]=rt(function(e,t){let n=nt(e,t);return n===null&&L(249,t.cell.getKey()),n}(a,n)),f=a[u],p=a[d];i===`forward`?f+=u===`maxColumn`?1:s:i===`backward`?f-=u===`minColumn`?1:l:i===`down`?p+=d===`maxRow`?1:o:i===`up`&&(p-=d===`minRow`?1:c);let m=t[p];if(m===void 0)return!1;let h=m[f];if(h===void 0)return!1;let[g,_]=function(e,t,n){let r=we(e,t,n),i=nt(r,t);if(i)return[it(e,r,i),it(e,r,rt(i))];let a=nt(r,n);if(a)return[it(e,r,rt(a)),it(e,r,a)];let o=[`minColumn`,`minRow`];return[it(e,r,o),it(e,r,rt(o))]}(t,n,h),v=ht(e,g.cell),y=ht(e,_.cell);return e.$setAnchorCellForSelection(v),e.$setFocusCellForSelection(y,!0),!0}function W(e,n){if(t.bn(e)||H(e)){let t=n.isParentOf(e.anchor.getNode()),r=n.isParentOf(e.focus.getNode());return t&&r}return!1}function ot(e,t){t?e.selectStart():e.selectEnd()}function st(e,n){let r=n.elem,i=e._config.theme;I(t.Yt(r))||L(131),t.Vr(r,i.tableCellSelected)}function ct(e,n){let r=n.elem;I(t.Yt(r))||L(131);let i=e._config.theme;t.Pt(r,i.tableCellSelected)}function lt(e){let n=t.B(e,I);return I(n)?n:null}function ut(e){let n=t.B(e,K);return K(n)?n:null}function dt(e,n,r,i,a,o,s){let c=t.Gt(r.focus,a?`previous`:`next`);if(t.$n(c))return!1;let l=c;for(let e of t.Ft(c).iterNodeCarets(`shadowRoot`)){if(!t.Hr(e)||!t.vt(e.origin))return!1;l=e}let u=l.getParentAtCaret();if(!I(u))return!1;let d=u,f=function(e){for(let n of t.Ft(e).iterNodeCarets(`root`)){let{origin:r}=n;if(I(r)){if(t._(n))return t.Z(r,e.direction)}else if(!R(r))break}return null}(t.f(d,l.direction)),p=t.B(d,K);if(!p||!p.is(o))return!1;let m=e.getElementByKey(d.getKey()),h=Xe(m);if(!m||!h)return!1;if(s.table=Ct(e,p),f)if(i===`extend`){let t=Xe(e.getElementByKey(f.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(t,!0)}else{let e=t.wr(f);t.Ct(r.anchor,e),t.Ct(r.focus,e)}else if(i===`extend`)s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{let e=function(e){let n=t.ni(e);return t._(n)?t.wr(n):e}(t.f(p,c.direction));t.Ct(r.anchor,e),t.Ct(r.focus,e)}return G(n),!0}function ft(e,n,r,i,a,o){if((r===`up`||r===`down`)&&function(e){let t=e.getRootElement();return t?t.hasAttribute(`aria-controls`)&&t.getAttribute(`aria-controls`)===`typeahead-menu`:!1}(e))return!1;let s=t.tt();if(!W(s,i)){if(t.bn(s)){if(r===`backward`){if(s.focus.offset>0)return!1;let e=function(e){for(let n=e,r=e;r!==null;n=r,r=r.getParent())if(t.vt(r)){if(r!==n&&r.getFirstChild()!==n)return null;if(!r.isInline())return r}return null}(s.focus.getNode());if(!e)return!1;let r=e.getPreviousSibling();return!!K(r)&&(G(n),n.shiftKey?s.focus.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent(),`element`):r.selectEnd(),!0)}if(n.shiftKey&&(r===`up`||r===`down`)){let e=s.focus.getNode();if(!s.isCollapsed()&&(r===`up`&&!s.isBackward()||r===`down`&&s.isBackward())){let a=t.B(e,e=>K(e));if(I(a)&&(a=t.B(a,K)),a!==i||!a)return!1;let o=r===`down`?a.getNextSibling():a.getPreviousSibling();if(!o)return!1;let c=0;r===`up`&&t.vt(o)&&(c=o.getChildrenSize());let l=o;r===`up`&&t.vt(o)&&(l=o.getLastChild()||o,c=t.Jt(l)?l.getTextContentSize():0);let u=s.clone();return u.focus.set(l.getKey(),c,t.Jt(l)?`text`:`element`),t.En(u),G(n),!0}if(t.J(e)){let e=r===`up`?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(e&&Ve(i,e)!==null){let e=i.getFirstDescendant(),t=i.getLastDescendant();if(!e||!t)return!1;let[n]=V(e),[r]=V(t),o=i.getCordsFromCellNode(n,a.table),s=i.getCordsFromCellNode(r,a.table),c=i.getDOMCellFromCordsOrThrow(o.x,o.y,a.table),l=i.getDOMCellFromCordsOrThrow(s.x,s.y,a.table);return a.$setAnchorCellForSelection(c),a.$setFocusCellForSelection(l,!0),!0}return!1}{let i=t.B(e,e=>t.vt(e)&&!e.isInline());if(I(i)&&(i=t.B(i,K)),!i)return!1;let o=r===`down`?i.getNextSibling():i.getPreviousSibling();if(K(o)&&a.tableNodeKey===o.getKey()){let e=o.getFirstDescendant(),i=o.getLastDescendant();if(!e||!i)return!1;let[a]=V(e),[c]=V(i),l=s.clone();return l.focus.set((r===`up`?a:c).getKey(),r===`up`?0:c.getChildrenSize(),`element`),G(n),t.En(l),!0}}}}return r===`down`&&bt(e)&&o.setShouldCheckSelectionForTable(i.getKey()),!1}if(t.bn(s)){if(r===`backward`||r===`forward`)return dt(e,n,s,n.shiftKey?`extend`:`move`,r===`backward`,i,a);if(s.isCollapsed()){let{anchor:c,focus:l}=s,u=t.B(c.getNode(),I),d=t.B(l.getNode(),I);if(!I(u)||!u.is(d))return!1;let f=ut(u);if(f!==i&&f!=null){let t=U(f,e.getElementByKey(f.getKey()));if(t!=null)return a.table=Qe(f,t),ft(e,n,r,f,a,o)}let p=e.getElementByKey(u.__key),m=e.getElementByKey(c.key);if(m==null||p==null)return!1;let h;if(c.type===`element`)h=m.getBoundingClientRect();else{let n=t.M(Be(e));if(n===null||n.rangeCount===0)return!1;let r=t.rn(n,e.getRootElement());if(r===null)return!1;h=r.getBoundingClientRect()}let g=r===`up`?u.getFirstChild():u.getLastChild();if(g==null)return!1;let _=e.getElementByKey(g.__key);if(_==null)return!1;let v=_.getBoundingClientRect();if(r===`up`?v.top>h.top-h.height:h.bottom+h.height>v.bottom){G(n);let e=i.getCordsFromCellNode(u,a.table);if(!n.shiftKey)return tt(a,i,e.x,e.y,r);{let t=i.getDOMCellFromCordsOrThrow(e.x,e.y,a.table);a.$setAnchorCellForSelection(t),a.$setFocusCellForSelection(t,!0)}return!0}}}else if(H(s)){let{anchor:o,focus:c,tableKey:l}=s;if(l!==i.getKey())return!1;let u=t.B(o.getNode(),I),d=t.B(c.getNode(),I),[f]=s.getNodes();K(f)||L(251);let p=U(f,e.getElementByKey(f.getKey()));if(!I(u)||!I(d)||!K(f)||p==null)return!1;a.$updateTableTableSelection(s);let m=Qe(f,p),h=i.getCordsFromCellNode(u,m),g=i.getDOMCellFromCordsOrThrow(h.x,h.y,m);if(a.$setAnchorCellForSelection(g),G(n),n.shiftKey){let[e,t,n]=z(i,u,d);return at(a,e,t,n,r)}return d.selectEnd(),!0}return!1}function G(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function pt(e,n,r){let i=t.Ar();e===`first`?n.insertBefore(i):n.insertAfter(i),i.append(...r||[]),i.selectEnd()}function mt(e,n,r){let i=r.getParent();if(!i)return;let a=t.M(Be(e));if(!a)return;let o=t.Er(a,e.getRootElement()).anchorNode,s=e.getElementByKey(i.getKey()),c=U(r,e.getElementByKey(r.getKey()));if(!o||!s||!c||!s.contains(o)||c.contains(o))return;let l=t.B(n.anchor.getNode(),e=>I(e));if(!l)return;let u=t.B(l,e=>K(e));if(!K(u)||!u.is(r))return;let[d,f]=z(r,l,l),p=d[0][0],m=d[d.length-1][d[0].length-1],{startRow:h,startColumn:g}=f,_=h===p.startRow&&g===p.startColumn,v=h===m.startRow&&g===m.startColumn;return _?`first`:v?`last`:void 0}function ht(e,t){let{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function gt(e,n,r){return Ve(e,t.Yt(n,r))}function _t(e,n,r){let i=e.querySelector(`colgroup`);if(!i)return;let a=[];for(let e=0;e<n;e++){let n=t.qt().createElement(`col`),i=r&&r[e];i&&(n.style.width=`${i}px`),a.push(n)}i.replaceChildren(...a)}function vt(e,n,r){if(!n.theme.tableAlignment)return;let i=[],a=[];for(let e of[`center`,`right`]){let t=n.theme.tableAlignment[e];t&&(e===r?a:i).push(t)}t.Pt(e,...i),t.Vr(e,...a)}var yt=new WeakSet;function bt(e=t.s()){return yt.has(e)}function xt(e,t){t?yt.add(e):yt.delete(e)}var St=class e extends t.m{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return`table`}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let t=this.getWritable();return t.__colWidths=e,t}static clone(t){return new e(t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:wt,priority:1})}}static importJSON(e){return Tt().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return n===`html`}getDOMSlot(e){let t=ze(e)?e:e.querySelector(`table`);return ze(t)||L(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector(`colgroup`))}createDOM(e,n){let r=t.qt().createElement(`table`);this.__style&&t.bt(r.style,this.__style);let i=t.qt().createElement(`colgroup`);if(r.appendChild(i),t.P(i),t.Vr(r,e.theme.table),this.updateTableElement(null,r,e),bt(n)){let n=t.qt().createElement(`div`),i=e.theme.tableScrollableWrapper;return i?t.Vr(n,i):n.style.overflowX=`auto`,n.appendChild(r),this.updateTableWrapper(null,n,r,e),n}return r}updateTableWrapper(e,n,r,i){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,n,r,i){i>0?(t.Vr(e,r.theme.tableFrozenColumn),n.setAttribute(`data-lexical-frozen-column`,`true`)):(t.Pt(e,r.theme.tableFrozenColumn),n.removeAttribute(`data-lexical-frozen-column`))}(n,r,i,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,n,r,i){i>0?(t.Vr(e,r.theme.tableFrozenRow),n.setAttribute(`data-lexical-frozen-row`,`true`)):(t.Pt(e,r.theme.tableFrozenRow),n.removeAttribute(`data-lexical-frozen-row`))}(n,r,i,this.__frozenRowCount)}updateTableElement(e,n,r){this.__style!==(e?e.__style:``)&&t.bt(n.style,this.__style,e?e.__style:``),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,n,r){r?(t.Vr(e,n.theme.tableRowStriping),e.setAttribute(`data-lexical-row-striping`,`true`)):(t.Pt(e,n.theme.tableRowStriping),e.removeAttribute(`data-lexical-row-striping`))}(n,r,this.__rowStriping);let i=e?e.getColumnCount():0,a=e?e.__colWidths:void 0;this.getColumnCount()===i&&this.getColWidths()===a||_t(n,this.getColumnCount(),this.getColWidths()),vt(n,r,this.getFormatType())}updateDOM(e,n,r){let i=U(this,n);return n===i===bt()||(t.Sn(a=n)&&a.nodeName===`DIV`&&this.updateTableWrapper(e,n,i,r),this.updateTableElement(e,i,r),!1);var a}scaleDOMColWidths(e,t){let n=this.getColWidths();n&&_t(U(this,e),this.getColumnCount(),n.map(e=>e*t))}exportDOM(e){let n=super.exportDOM(e),{element:r}=n;return{after:r=>{if(n.after&&(r=n.after(r)),!ze(r)&&t.Sn(r)&&(r=r.querySelector(`table`)),!ze(r))return null;vt(r,e._config,this.getFormatType());let[i]=B(this,null,null),a=new Map;for(let e of i)for(let t of e){let e=t.cell.getKey();a.has(e)||a.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}let o=new Set;for(let e of r.querySelectorAll(`:scope > tr > [data-temporary-table-cell-lexical-key]`)){let t=e.getAttribute(`data-temporary-table-cell-lexical-key`);if(t){let n=a.get(t);if(e.removeAttribute(`data-temporary-table-cell-lexical-key`),n){a.delete(t);for(let e=0;e<n.colSpan;e++)o.add(e+n.startColumn)}}}let s=r.querySelector(`:scope > colgroup`);if(s){let e=Array.from(r.querySelectorAll(`:scope > colgroup > col`)).filter((e,t)=>o.has(t));s.replaceChildren(...e)}let c=r.querySelectorAll(`:scope > tr`);if(c.length>0){let e=t.qt().createElement(`tbody`);for(let t of c)e.appendChild(t);r.append(e)}return r},element:!ze(r)&&t.Sn(r)?r.querySelector(`table`):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){let{rows:n,domRows:r}=t;for(let t=0;t<n;t++){let n=r[t];if(n!=null)for(let r=0;r<n.length;r++){let i=n[r];if(i==null)continue;let{elem:a}=i,o=gt(this,a);if(o!==null&&e.is(o))return{x:r,y:t}}}throw Error(`Cell not found in table.`)}getDOMCellFromCords(e,t,n){let{domRows:r}=n,i=r[t];return i==null?null:i[e<i.length?e:i.length-1]??null}getDOMCellFromCordsOrThrow(e,t,n){let r=this.getDOMCellFromCords(e,t,n);if(!r)throw Error(`Cell not found at cords.`);return r}getCellNodeFromCords(e,n,r){let i=this.getDOMCellFromCords(e,n,r);if(i==null)return null;let a=t.Yt(i.elem);return I(a)?a:null}getCellNodeFromCordsOrThrow(e,t,n){let r=this.getCellNodeFromCords(e,t,n);if(!r)throw Error(`Node at cords not TableCellNode.`);return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){let t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!R(e))return 0;let t=0;return e.getChildren().forEach(e=>{I(e)&&(t+=e.getColSpan())}),t}};function Ct(e,t){let n=e.getElementByKey(t.getKey());return n===null&&L(230),Qe(t,n)}function wt(e){let t=Tt();e.hasAttribute(`data-lexical-row-striping`)&&t.setRowStriping(!0),e.hasAttribute(`data-lexical-frozen-column`)&&t.setFrozenColumns(1),e.hasAttribute(`data-lexical-frozen-row`)&&t.setFrozenRows(1);let r=e.querySelector(`:scope > colgroup`);if(r){let e=[];for(let t of r.querySelectorAll(`:scope > col`)){let n=t.style.width||``;if(!j.test(n)&&(n=t.getAttribute(`width`)||``,!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>n.f(e,R),node:t}}function Tt(){return t.o(new St)}function K(e){return e instanceof St}function Et(e){R(e.getParent())?e.isEmpty()&&e.append(t.Ar()):e.remove()}function Dt(e){K(e.getParent())?n.T(e,I):e.remove()}function Ot(e){n.T(e,R);let[r]=B(e,null,null),i=r.reduce((e,t)=>Math.max(e,t.length),0),a=e.getChildren();for(let e=0;e<r.length;++e){let n=a[e];if(!n)continue;R(n)||L(254,n.constructor.name,n.getType());let o=r[e].reduce((e,t)=>t?1+e:e,0);if(o!==i)for(let e=o;e<i;++e){let e=F();e.append(t.Ar()),n.append(e)}}let o=e.getColWidths(),s=e.getColumnCount();if(o&&o.length!==s){let t;if(s<o.length)t=o.slice(0,s);else if(o.length>0){let e=o[o.length-1];t=[...o,...Array(s-o.length).fill(e)]}e.setColWidths(t)}}function kt(e){if(e.detail<3||!t.Ln(e.target))return!1;let n=t.Yt(e.target);if(n===null)return!1;let r=t.B(n,e=>t.vt(e)&&!e.isInline());return r!==null&&!!I(r.getParent())&&(r.select(0),!0)}function At(){let e=t.tt();if(!t.bn(e))return!1;let n=ut(e.anchor.getNode());if(n===null)return!1;let r=t.Dr();if(!r.is(n.getParent())||r.getChildrenSize()!==1)return!1;let[i]=B(n,null,null);if(i.length===0||i[0].length===0)return!1;let a=i[0][0];if(!a||!a.cell)return!1;let o=i[i.length-1],s=o[o.length-1];return!s||!s.cell?!1:(t.En(Ae(n,a.cell,s.cell)),!0)}function jt(e){return e.registerNodeTransform(N,e=>{if(e.getColSpan()>1||e.getRowSpan()>1){let[,,t]=V(e),[r]=z(t,e,e),i=r.length,a=r[0].length,o=t.getFirstChild();R(o)||L(175);let s=[];for(let e=0;e<i;e++){e!==0&&(o=o.getNextSibling(),R(o)||L(175));let t=null;for(let i=0;i<a;i++){let a=r[e][i],c=a.cell;if(a.startRow===e&&a.startColumn===i)t=c,s.push(c);else if(c.getColSpan()>1||c.getRowSpan()>1){I(c)||L(176);let e=F(c.__headerState);t===null?n.a(o,e):t.insertAfter(e)}}}for(let e of s)e.setColSpan(1),e.setRowSpan(1)}})}function Mt(e,n=!0){let r=new Ne,i=(t,i,a)=>{let o=U(t,a),s=Ke(t,o,e,n,r);r.observers.set(i,[s,o])};return t.Yn(Ge(e,r),e.registerCommand(t.F,()=>qe(r,e),3),e.registerMutationListener(St,t=>{e.read(`latest`,()=>{for(let[e,n]of t){let t=r.observers.get(e);if(n===`created`||n===`updated`){let{tableNode:n,tableElement:a}=Me(e);t===void 0?i(n,e,a):a!==t[1]&&(r.removeObserver(e),i(n,e,a))}else n===`destroyed`&&r.removeObserver(e)}})},{skipInitialization:!1}),()=>{r.removeAllObservers()})}function Nt(e,i){e.hasNodes([St])||L(255);let{hasNestedTables:a=r.B(!1)}=i??{};return t.Yn(e.registerCommand(te,e=>function({rows:e,columns:r,includeHeaders:i},a){let o=t.tt()||t.Y();if(!o||!t.bn(o)||!a&&ut(o.anchor.getNode()))return!1;let s=ae(Number(e),Number(r),i);n.n(s);let c=s.getFirstDescendant();return t.Jt(c)&&c.select(),!0}(e,a.peek()),0),e.registerCommand(t.Q,(r,i)=>e===i&&function(e,r){let{nodes:i,selection:a}=e;if(!i.some(e=>K(e)||n.g(e).some(e=>K(e.node)))){if(H(a)){let e=``,n=!1;for(let r of i){let i=t.vt(r)&&!r.isInline();e.length>0&&(i||n)&&(e+=`
5
- `),e+=r.getTextContent(),n=i}return a.insertRawText(e),!0}return!1}let o=H(a),s=t.bn(a);return s&&t.B(a.anchor.getNode(),e=>I(e))!==null&&t.B(a.focus.getNode(),e=>I(e))!==null||o?i.length===1&&K(i[0])?Ee(i[0],a):!(s&&r.peek()&&!function(e){return!!(H(e)&&!e.focus.getNode().is(e.anchor.getNode())||t.bn(e)&&I(e.anchor.getNode())&&!e.anchor.getNode().is(e.focus.getNode()))}(a)):!1}(r,a),0),e.registerCommand(t.qn,At,1),e.registerCommand(t.K,kt,0),e.registerNodeTransform(St,Ot),e.registerNodeTransform(ne,Dt),e.registerNodeTransform(N,Et))}r.y.tag(`table`),r.y.tag(`tr`),r.y.tag(`td`,`th`);var Pt=(0,a.createContext)({});function Ft({children:e,revealFile:t}){let n=(0,a.useMemo)(()=>({revealFile:t}),[t]);return(0,o.jsx)(Pt.Provider,{value:n,children:e})}function It(){return(0,a.useContext)(Pt)}var Lt=(0,a.createContext)({});function Rt({children:e,shortToVerseData:t,verseFullTextToListShorts:n,changeBibleKey:r}){let i=(0,a.useMemo)(()=>({shortToVerseData:t,verseFullTextToListShorts:n,changeBibleKey:r}),[t,n,r]);return(0,o.jsx)(Lt.Provider,{value:i,children:e})}function zt(){return(0,a.useContext)(Lt)}var Bt=new Set([`concept`,`deity`,`group`,`life`,`month`,`person`,`place`,`supernatural`,`unknown`]);function Vt(e){let t=(e??``).trim().toLowerCase();return Bt.has(t)?t:`person`}function q(e){let t=J(e.kjvName);return t===``||t===e.name.trim()?null:t}function J(e){return typeof e==`string`?e.trim():``}function Ht(e){let t=J(e);return t===``?null:t}function Y(e){return Array.isArray(e)?e.map(J).filter(e=>e!==``):[]}function Ut(e){return typeof e==`number`&&Number.isFinite(e)?e:1/0}function Wt(e){return Array.isArray(e)?e:typeof e==`object`&&e?Object.values(e):[]}function Gt(e){return Array.isArray(e)?e.reduce((e,t)=>{if(typeof t!=`object`||!t)return e;let n=t,r=J(n.type);return r===``||typeof n.start!=`number`||typeof n.end!=`number`||e.push({type:r,start:n.start,end:n.end}),e},[]):[]}function Kt(e){return Array.isArray(e)?e.reduce((e,t)=>{if(typeof t!=`object`||!t)return e;let n=t,r=J(n.type),i=J(n.url);return r===``||i===``||e.push({type:r,url:i}),e},[]):[]}function qt(e){if(typeof e!=`object`||!e)return null;let{latitude:t,longitude:n}=e;return typeof t!=`number`||!Number.isFinite(t)||typeof n!=`number`||!Number.isFinite(n)?null:{latitude:t,longitude:n}}function Jt(e){if(typeof e!=`object`||!e)return null;let t=e,n=J(t.id),r=J(t.name);return n===``||n===`id`||r===``?null:{id:n,name:r,kjvName:Ht(t.kjvName),oldName:Ht(t.oldName),title:J(t.title),description:J(t.description),gender:J(t.gender),age:J(t.age),years:Gt(t.years),locations:Y(t.locations),spouses:Y(t.spouses),children:Y(t.children),parents:Y(t.parents),siblings:Y(t.siblings),cousin:Y(t.cousin),type:J(t.type),verses:Y(t.verses),links:Kt(t.links),wikipedia:Ht(t.wikipedia),matterRange:Ut(t.matterRange)}}function Yt(e){if(typeof e!=`object`||!e)return null;let t=e,n=J(t.id),r=J(t.name);return n===``||n===`id`||r===``?null:{id:n,name:r,kjvName:Ht(t.kjvName),oldName:Ht(t.oldName),title:J(t.title),description:J(t.description),type:J(t.type),relatedLocations:Y(t.relatedLocations),modernIdentification:Ht(t.modernIdentification),coordinates:qt(t.coordinates),verses:Y(t.verses),links:Kt(t.links),wikipedia:Ht(t.wikipedia),uncertainty:t.uncertainty===!0,matterRange:Ut(t.matterRange)}}function Xt(e){return Wt(e).reduce((e,t)=>{let n=Jt(t);return n!==null&&e.push(n),e},[])}function Zt(e){return Wt(e).reduce((e,t)=>{let n=Yt(t);return n!==null&&e.push(n),e},[])}function Qt(e){return typeof e!=`object`||!e?{}:Object.entries(e).reduce((e,[t,n])=>{let r=t.trim(),i=Y(n);return r!==``&&i.length>0&&(e[r]=i),e},{})}var $t=20,en=200;function tn(e,t){return e.matterRange===t.matterRange?e.name.localeCompare(t.name):e.matterRange-t.matterRange}function nn(e,t){return e===t?0:e.startsWith(t)?1:e.includes(t)?2:3}function rn(e,t,n){let r=nn(e,n);return t===``?r:Math.min(r,nn(t,n))}function an(e,t){let n=[...e].sort(tn),r=new Map,i=new Map,a=[],o=[],s=[];for(let e of n){r.has(e.id)||r.set(e.id,e);let t=i.get(e.name);t===void 0?i.set(e.name,[e]):t.push(e);let n=e.name.toLowerCase(),c=e.kjvName===null||e.kjvName===e.name?``:e.kjvName.toLowerCase();o.push(n),s.push(c),a.push([n,c,e.oldName?.toLowerCase()??``].filter(e=>e!==``).join(` `))}return{sorted:n,byId:r,byName:i,searchText:a,nameLower:o,kjvNameLower:s,verseRecordIds:t,queryCache:new Map}}var on=class{dataMap;currentDefaultLang;currentStyle;indexes=new Map;constructor(e,t,n,r){if(e[t]===void 0)throw Error(`Default language ${t} not found in ${n}`);this.currentDefaultLang=t,this.currentStyle=r,this.dataMap=e}get style(){return this.currentStyle}set style(e){this.currentStyle=e}get defaultLang(){return this.currentDefaultLang}set defaultLang(e){if(this.dataMap[e]===void 0)throw Error(`Language ${e} not found in this lookup manager`);this.currentDefaultLang=e}get langs(){return Object.keys(this.dataMap)}getRecordCount(e){return this.getIndex(e).sorted.length}getAllRecords(e){return[...this.getIndex(e).sorted]}getRecordById(e,t){return this.getIndex(t).byId.get(e.trim())??null}getRecordsByIds(e,t){let{byId:n}=this.getIndex(t),r=new Set;return e.reduce((e,t)=>{let i=t.trim();if(r.has(i))return e;r.add(i);let a=n.get(i);return a!==void 0&&e.push(a),e},[])}getRecordsByName(e,t){return[...this.getIndex(t).byName.get(e.trim())??[]]}searchRecords(e,t={}){let n=this.getIndex(t.lang),r=e.trim().toLowerCase(),i=r===``?n.sorted:this.getRankedMatches(n,r);return t.limit===void 0?[...i]:i.slice(0,Math.max(0,t.limit))}paginateRecords(e,t,n){let r=Math.max(1,Math.trunc(n.pageSize??$t)),i=e.length,a=Math.max(1,Math.ceil(i/r)),o=Math.min(a,Math.max(1,Math.trunc(n.page??1))),s=(o-1)*r;return{lang:t,totalRecords:i,page:o,totalPages:a,pageSize:r,records:e.slice(s,s+r)}}searchRecordsByShortVerse(e,t){let n=this.getIndex(t).verseRecordIds[e.trim()];return n===void 0?[]:this.getRecordsByIds(n,t).sort(tn)}resolveLang(e){return e!==void 0&&this.dataMap[e]!==void 0?e:this.currentDefaultLang}getIndex(e){let t=this.resolveLang(e),n=this.indexes.get(t);if(n!==void 0)return n;let r=this.dataMap[t],i=an(r.records,this.getVerseRecordIds(r));return this.indexes.set(t,i),i}getRankedMatches(e,t){let n=e.queryCache.get(t);if(n!==void 0)return n;let r=[];for(let n=0;n<e.sorted.length;n+=1)e.searchText[n].includes(t)&&r.push({record:e.sorted[n],rank:rn(e.nameLower[n],e.kjvNameLower[n],t)});r.sort((e,t)=>e.rank-t.rank);let i=r.map(e=>e.record);return e.queryCache.size>=en&&e.queryCache.clear(),e.queryCache.set(t,i),i}},sn=class e extends on{nameTypeCounts=new Map;constructor(e,t,n){super(e,t,`dataNamesMap`,n)}static fromRawDataset(t,n,r){let i=Object.entries(t).reduce((e,[t,n])=>{let r=typeof n==`object`&&n?n:{};return e[t]={records:Xt(r.namesMap??n),versePersonsMap:Qt(r.versePersonsMap)},e},{});return new e(i,n,r)}static createEmpty(){return new e({en:{records:[]}},`en`)}getNameTypes(e){let t=this.resolveLang(e),n=this.nameTypeCounts.get(t);if(n!==void 0)return n;let r=new Map;for(let e of this.getIndex(t).sorted){let t=Vt(e.type);r.set(t,(r.get(t)??0)+1)}let i=Array.from(r.entries()).map(([e,t])=>({type:e,count:t})).sort((e,t)=>e.count===t.count?e.type.localeCompare(t.type):t.count-e.count);return this.nameTypeCounts.set(t,i),i}get nameTypes(){return this.getNameTypes()}searchNames(e,t={}){let{type:n,limit:r,...i}=t;if(n===void 0)return this.searchRecords(e,t);let a=this.searchRecords(e,i).filter(e=>Vt(e.type)===n);return r===void 0?a:a.slice(0,Math.max(0,r))}searchNamesPagination(e={}){return this.paginateRecords(this.searchNames(e.query??``,{lang:e.lang,type:e.type}),this.resolveLang(e.lang),e)}searchByShortVerse(e,t){return this.searchRecordsByShortVerse(e,t)}getVerseRecordIds(e){return e.versePersonsMap??{}}},cn=class e extends on{constructor(e,t,n){super(e,t,`dataLocationsMap`,n)}static fromRawDataset(t,n,r){let i=Object.entries(t).reduce((e,[t,n])=>{let r=typeof n==`object`&&n?n:{};return e[t]={records:Zt(r.locationsMap??r.namesMap??n),verseLocationsMap:Qt(r.verseLocationsMap)},e},{});return new e(i,n,r)}static createEmpty(){return new e({en:{records:[]}},`en`)}searchLocations(e,t={}){return this.searchRecords(e,t)}searchLocationsPagination(e={}){return this.paginateRecords(this.searchLocations(e.query??``,{lang:e.lang}),this.resolveLang(e.lang),e)}searchByShortVerse(e,t){return this.searchRecordsByShortVerse(e,t)}getVerseRecordIds(e){return e.verseLocationsMap??{}}},ln=sn.createEmpty(),un=cn.createEmpty(),dn=(0,a.createContext)({locationsLookupManager:un,namesLookupManager:ln});function fn({children:e,locationsLookupManager:t,namesLookupManager:n}){let r=(0,a.useMemo)(()=>({locationsLookupManager:t??un,namesLookupManager:n??ln}),[t,n]);return(0,o.jsx)(dn.Provider,{value:r,children:e})}function pn(){return(0,a.useContext)(dn)}function mn(){return(0,a.useContext)(dn).namesLookupManager}function hn(){return(0,a.useContext)(dn).locationsLookupManager}var gn=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),_n=class e extends t.m{__url;__target;__rel;__title;static getType(){return`link`}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){let n=t.qt().createElement(`a`);return this.updateLinkDOM(null,n,e),t.Vr(n,e.theme.link),n}updateLinkDOM(e,n,r){if(t.un(n)){e&&e.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(let t of[`target`,`rel`,`title`]){let r=`__${t}`,i=this[r];e&&e[r]===i||(i?n[t]=i:n.removeAttribute(t))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:xn,priority:1})}}static importJSON(e){return Sn().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){let t=e;e=kn(e);try{let t=new URL(kn(e));if(!gn.has(t.protocol))return`about:blank`}catch{let e=t.replace(/[\u0000-\u001F\u007F\s]/g,``).match(/^([a-z][a-z0-9+.-]*):/i);if(e!=null&&!gn.has(`${e[1].toLowerCase()}:`))return`about:blank`}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){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,n=!0){let r=t.ii(this);return this.insertAfter(r,n),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,r){if(!t.bn(n))return!1;let i=n.anchor.getNode(),a=n.focus.getNode();return(this.is(i)||this.isParentOf(i))&&(this.is(a)||this.isParentOf(a))&&n.getTextContent().length>0}isEmailURI(){return this.__url.startsWith(`mailto:`)}isWebSiteURI(){return this.__url.startsWith(`https://`)||this.__url.startsWith(`http://`)}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function vn(e){let n=t.Gt(e,`next`);return[n,n.getFlipped()]}function yn(e,n){for(let r of n)if(r.origin.isAttached()){t.Ct(e,t.wr(r));return}}function bn(e){let n=t.tt(),r=null,i=null;function a(){t.bn(n)&&(yn(n.anchor,r),yn(n.focus,i),t.R(n))}t.bn(n)&&(r=vn(n.anchor),i=vn(n.focus));let o=!1;for(let n of t.Z(e,`next`)){let r=n.origin;if(t.vt(r)&&!r.isInline()){let i=r.getChildren();if(i.length>0){let n=t.ii(e);n.append(...i),r.append(n),o=!0}t.cn(r,t.cr(n),{$shouldSplit:()=>!1})}}function s(e,n,r){let[i,a]=e,o=e=>t.Hr(e)&&e.origin.is(n);if(!o(i)&&!o(a))return e;let s=t.wr(t.Z(r,`next`));return[s,s.getFlipped()]}if(e.isAttached()){let t=e.getPreviousSibling();if(X(t)&&t.shouldMergeAdjacentLink(e))return r&&=s(r,t,e),i&&=s(i,t,e),t.append(...e.getChildren()),e.remove(),void a();let n=e.getNextSibling();X(n)&&e.shouldMergeAdjacentLink(n)&&(r&&=s(r,e,n),i&&=s(i,e,n),e.append(...n.getChildren()),n.remove(),o=!0)}if(o){if(!e.canBeEmpty()&&e.isEmpty()){let t=e.getParent();e.remove(),t&&t.isEmpty()&&t.remove()}a()}}function xn(e){let n=null;if(t.un(e)){let t=e.textContent;(t!==null&&t!==``||e.children.length>0)&&(n=Sn(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:n}}function Sn(e=``,n){return t.o(new _n(e,n))}function X(e){return e instanceof _n}var Cn=class e extends _n{__isUnlinked;constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}static getType(){return`autolink`}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?t.qt().createElement(`span`):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return wn().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){let n=wn(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function wn(e=``,n){return t.o(new Cn(e,n))}function Z(e){return e instanceof Cn}var Tn=t.x(`TOGGLE_LINK_COMMAND`);function En(e,n){if(e.type===`element`){let r=e.getNode();return t.vt(r)||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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),r.getChildren()[e.offset+n]||null}return null}function Dn(e,n={}){let r;if(e&&typeof e==`object`){let{url:t,...i}=e;r=t,n={...i,...n}}else r=e;let{target:i,title:a}=n,o=n.rel===void 0?`noreferrer`:n.rel,s=t.tt();if(s===null||!t.bn(s)&&!t.Fr(s))return;if(t.Fr(s)){let e=s.getNodes();if(e.length===0)return;e.forEach(e=>{if(r===null){let n=t.B(e,e=>!Z(e)&&X(e));n&&(n.insertBefore(e),n.getChildren().length===0&&n.remove())}else{let n=t.B(e,e=>!Z(e)&&X(e));if(n)n.setURL(r),i!==void 0&&n.setTarget(i),o!==void 0&&n.setRel(o);else{let t=Sn(r,{rel:o,target:i});e.insertBefore(t),t.append(e)}}});return}if(s.isCollapsed()&&r===null)for(let e of s.getNodes()){let n=t.B(e,e=>!Z(e)&&X(e));n!==null&&(n.getParentOrThrow().splice(n.getIndexWithinParent(),0,n.getChildren()),n.remove());return}let c=s.extract();if(r===null){let e=new Set;c.forEach(n=>{let r=t.B(n,e=>!Z(e)&&X(e));if(r!==null){let n=r.getKey();if(e.has(n))return;(function(e,n){let r=new Set(n.filter(t=>e.isParentOf(t)).map(e=>e.getKey())),i=e.getChildren(),a=i=>r.has(i.getKey())||t.vt(i)&&n.some(t=>e.isParentOf(t)&&i.isParentOf(t)),o=i.filter(a);if(o.length===i.length)return i.forEach(t=>e.insertBefore(t)),void e.remove();let s=i.findIndex(a),c=i.findLastIndex(a),l=s===0,u=c===i.length-1;if(l)o.forEach(t=>e.insertBefore(t));else if(u)for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);else{for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);let n=i.slice(c+1);if(n.length>0){let r=t.ii(e);o[o.length-1].insertAfter(r),n.forEach(e=>r.append(e))}}})(r,c),e.add(n)}});return}let l=new Set,u=e=>{l.has(e.getKey())||(l.add(e.getKey()),e.setURL(r),i!==void 0&&e.setTarget(i),o!==void 0&&e.setRel(o),a!==void 0&&e.setTitle(a))};if(c.length===1){let e=c[0],n=t.B(e,X);if(n!==null)return u(n)}(function(e){let n=t.tt();if(!t.bn(n))return e();let r=t.R(n),i=r.isBackward(),a=En(r.anchor,i?-1:0),o=En(r.focus,i?0:-1);if(e(),a||o){let e=t.tt();if(t.bn(e)){let n=e.clone();if(a){let e=a.getParent();e&&n.anchor.set(e.getKey(),a.getIndexWithinParent()+ +!!i,`element`)}if(o){let e=o.getParent();e&&n.focus.set(e.getKey(),o.getIndexWithinParent()+ +!i,`element`)}t.En(t.R(n))}}})(()=>{let e=null;for(let n of c){if(!n.isAttached())continue;let s=t.B(n,X);if(s){u(s);continue}if(t.vt(n)){if(!n.isInline())continue;if(X(n)){if(!(Z(n)||e!==null&&e.getParentOrThrow().isParentOf(n))){u(n),e=n;continue}for(let e of n.getChildren())n.insertBefore(e);n.remove();continue}}let c=n.getPreviousSibling();X(c)&&c.is(e)?c.append(n):(e=Sn(r,{rel:o,target:i,title:a}),n.insertAfter(e),e.append(n))}})}var On=/^\+?[0-9\s()-]{5,}$/;function kn(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:On.test(e)?`tel:${e}`:`https://${e}`}r.y.tag(`a`);function An(e,i){return t.Yn(e.registerNodeTransform(_n,bn),e.registerCommand(Tn,e=>{let t=i.validateUrl.peek(),n=i.attributes.peek();if(e===null)return Dn(null),!0;if(typeof e==`string`)return!(t!==void 0&&!t(e))&&(Dn(e,n),!0);{let{url:t,target:r,rel:i,title:a}=e;return Dn(t,{...n,rel:i,target:r,title:a}),!0}},0),r.H(()=>{let r=i.validateUrl.value;if(!r)return;let a=i.attributes.value;return e.registerCommand(t.Wn,i=>{let o=t.tt();if(!t.bn(o)||o.isCollapsed()||!n.s(i,ClipboardEvent)||i.clipboardData===null)return!1;let s=i.clipboardData.getData(`text`);return r(s)?!o.getNodes().some(e=>t.vt(e)||t.Jt(e)&&!e.isSimpleText())&&(e.dispatchCommand(Tn,{...a,url:s}),i.preventDefault(),!0):!1},1)}))}function jn(e,n,r={}){let i=r=>{let i=r.target;if(!t.Ln(i))return;let a=t.a(i);if(a===null)return;let o=null,s=null,c=!1;if(a.update(()=>{let e=t.Yt(i);if(e!==null){let r=t.B(e,t.vt);if(!n.disabled.peek())if(X(r))c=Z(r)&&r.getIsUnlinked(),o=r.sanitizeUrl(r.getURL()),s=r.getTarget();else{let e=function(e,t){let n=e;for(;n!=null;){if(t(n))return n;n=n.parentNode}return null}(i,t.un);e!==null&&(o=e.href,s=e.target)}}}),o===null||o===``||c)return;let l=e.read(`latest`,t.tt);if(t.bn(l)&&!l.isCollapsed())return void r.preventDefault();let u=r.type===`auxclick`&&r.button===1;window.open(o,n.newTab.peek()||u||r.metaKey||r.ctrlKey||s===`_blank`?`_blank`:`_self`),r.preventDefault()},a=e=>{e.button===1&&i(e)};return e.registerRootListener(e=>{if(e)return t.vn(e,{click:i,mouseup:a},r)})}function Mn(e,t=e=>e){return n=>{let r=e.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function Nn(e,t){for(let n=0;n<t.length;n++){let r=t[n](e);if(r)return r}return null}var Pn=/[.,;\s]/;function Fn(e,t){return t.test(e)}function In(e,t){return Fn(e[e.length-1],t)}function Ln(e,t){return Fn(e[0],t)}function Rn(e,n){let r=e.getPreviousSibling();return t.vt(r)&&(r=r.getLastDescendant()),r===null||t._r(r)||t.Jt(r)&&In(r.getTextContent(),n)}function zn(e,n){let r=e.getNextSibling();return t.vt(r)&&(r=r.getFirstDescendant()),r===null||t._r(r)||t.Jt(r)&&Ln(r.getTextContent(),n)}function Bn(e,t,n,r,i){return(e>0?Fn(r[e-1],n):Rn(i[0],n))?t<r.length?Fn(r[t],n):zn(i[i.length-1],n):!1}function Vn(e,t,n){let r=[],i=[],a=[],o=0,s=0,c=[...e];for(;c.length>0;){let e=c[0],l=e.getTextContent().length,u=s;s+l<=t?(r.push(e),o+=l):u>=n?a.push(e):i.push(e),s+=l,c.shift()}return[o,r,i,a]}function Hn(e,n,r,i){let a=wn(i.url,i.attributes);if(e.length===1){let o,s=e[0];n===0?[o,s]=s.splitText(r):[,o,s]=s.splitText(n,r);let c=t.D(i.text);return c.setFormat(o.getFormat()),c.setDetail(o.getDetail()),c.setStyle(o.getStyle()),a.append(c),o.replace(a),s}if(e.length>1){let i=e[0],o,s=i.getTextContent().length;n===0?o=i:[,o]=i.splitText(n);let c=[],l;for(let t=1;t<e.length;t++){let n=e[t],i=n.getTextContent().length,a=s;if(a<r)if(s+i<=r)c.push(n);else{let[e,t]=n.splitText(r-a);c.push(e),l=t}s+=i}let u=t.tt(),d=u?u.getNodes().find(t.Jt):void 0,f=t.D(o.getTextContent());return f.setFormat(o.getFormat()),f.setDetail(o.getDetail()),f.setStyle(o.getStyle()),a.append(f,...c),d&&d===o&&(t.bn(u)?f.select(u.anchor.offset,u.focus.offset):t.Fr(u)&&f.select(0,f.getTextContent().length)),o.replace(a),l}}function Un(e,n,r,i){let a=e.getChildren(),o=a.length;for(let n=0;n<o;n++){let i=a[n];if(!t.Jt(i)||!i.isSimpleText())return Wn(e),void r(null,e.getURL())}let s=e.getTextContent(),c=Nn(s,n);if(c===null||c.text!==s||!Rn(e,i)||!zn(e,i))return Wn(e),void r(null,e.getURL());let l=e.getURL();if(l!==c.url&&(e.setURL(c.url),r(c.url,l)),c.attributes){let t=e.getRel();t!==c.attributes.rel&&(e.setRel(c.attributes.rel||null),r(c.attributes.rel||null,t));let n=e.getTarget();n!==c.attributes.target&&(e.setTarget(c.attributes.target||null),r(c.attributes.target||null,n))}}function Wn(e){let t=e.getChildren();for(let n=t.length-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map(e=>e.getLatest())}var Gn={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:Pn};function Kn(e,n=Gn){let{matchers:r,changeHandlers:i,excludeParents:a,separatorRegex:o=Pn}=n,s=(e,t)=>{for(let n of i)n(e,t)};return t.Yn(e.registerNodeTransform(t.Wt,e=>{let n=e.getParentOrThrow(),i=e.getPreviousSibling();Z(n)?Un(n,r,s,o):!X(n)&&!a.some(e=>e(n))&&(e.isSimpleText()&&(Ln(e.getTextContent(),o)||!Z(i))&&(function(e,t,n,r){for(let t of e){let e=t.getParent();if(Z(e)&&!e.getIsUnlinked())return}let i=[...e],a=i.map(e=>e.getTextContent()).join(``),o,s=a,c=0;for(;(o=Nn(s,t))&&o!==null;){let e=o.index,t=e+o.length;if(Bn(c+e,c+t,r,a,i)){let[r,,a,l]=Vn(i,c+e,c+t),u=!1;for(let e of a){let t=e.getParent();if(Z(t)&&!t.getIsUnlinked()){u=!0;break}}if(u){c+=t,s=s.substring(t);continue}let d=Hn(a,c+e-r,c+t-r,o);i=d?[d,...l]:l,n(o.url,null),c=0}else c+=t;s=s.substring(t)}})(function(e){let n=[e],r=e.getNextSibling();for(;r!==null&&t.Jt(r)&&r.isSimpleText()&&(n.push(r),!/[\s]/.test(r.getTextContent()));)r=r.getNextSibling();return n}(e),r,s,o),(function(e,t,n,r){let i=e.getParent(),a=e.getPreviousSibling(),o=e.getNextSibling(),s=e.getTextContent();if(!Z(i)||i.getIsUnlinked()){if(Z(a)&&!a.getIsUnlinked()&&a.is(e.getPreviousSibling())&&e.getParent()===a.getParent()){if(!Ln(s,r))return Wn(a),void n(null,a.getURL());if(c=s,a.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(c):/^\.[a-zA-Z0-9]{1,}/.test(c)){let i=a.getTextContent()+s,o=Nn(i,t);o!==null&&o.text===i&&(a.append(e),Un(a,t,n,r),n(null,a.getURL()))}}var c;!Z(o)||o.getIsUnlinked()||In(s,r)||o.is(e.getNextSibling())&&e.getParent()===o.getParent()&&(Wn(o),n(null,o.getURL()))}})(e,r,s,o))}),e.registerCommand(Tn,e=>{let n=t.tt();return e!==null||!t.bn(n)||n.extract().forEach(e=>{let t=e.getParent();Z(t)&&(t.setIsUnlinked(!t.getIsUnlinked()),t.markDirty())}),!1},1))}function qn(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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.`)}var Jn=t.ar?a.useLayoutEffect:a.useEffect;function Yn({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,a.useState)(()=>e.getDecorators());return Jn(()=>e.registerDecoratorListener(e=>{(0,s.flushSync)(()=>{r(e)})}),[e]),(0,a.useEffect)(()=>{r(e.getDecorators())},[e]),(0,a.useMemo)(()=>{let r=[],i=Object.keys(n);for(let c=0;c<i.length;c++){let l=i[c],u=(0,o.jsx)(t,{onError:t=>e._onError(t),children:(0,o.jsx)(a.Suspense,{fallback:null,children:n[l]})}),d=e.getElementByKey(l);d!==null&&r.push((0,s.createPortal)(u,d,l))}return r},[t,n,e])}(e,t)}function Xn({editor:e,ErrorBoundary:t}){return function(e){let t=r.K.maybeFromEditor(e);if(t&&t.hasExtensionByName(r.M.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&qn(320,e);return!0}return!1}(e)?null:(0,o.jsx)(Yn,{editor:e,ErrorBoundary:t})}function Zn(e){return e.read(`latest`,r.I(e.isComposing()))}function Qn({contentEditable:e,placeholder:n=null,ErrorBoundary:i}){let[a]=t.oi();return function(e){Jn(()=>t.Yn(A(e),r.s(e)),[e])}(a),(0,o.jsxs)(o.Fragment,{children:[e,(0,o.jsx)($n,{content:n}),(0,o.jsx)(Xn,{editor:a,ErrorBoundary:i})]})}function $n({content:e}){let[n]=t.oi(),r=function(e){let[n,r]=(0,a.useState)(()=>Zn(e));return Jn(()=>{function n(){let t=Zn(e);r(t)}return n(),t.Yn(e.registerUpdateListener(()=>{n()}),e.registerEditableListener(()=>{n()}))},[e]),n}(n),o=i.t();return r?typeof e==`function`?e(o):e:null}var er=`bible-note:open-mention-bible-verse-advanced-panel`;function tr(e){window.dispatchEvent(new CustomEvent(er,{detail:e}))}var nr=`bible-note:open-mention-location-advanced-panel`;function rr(e){window.dispatchEvent(new CustomEvent(nr,{detail:e}))}var ir=`bible-note:open-mention-person-advanced-panel`;function ar(e){window.dispatchEvent(new CustomEvent(ir,{detail:e}))}var or=/\[([^\]]+)\]\((?:name-id|location-id|verse-key|chapter-key|book-key):\/\/[^)]*\)/g;function sr(e){return e.replace(or,`$1`)}var cr=/\[([^\]]+)\]\((name-id|location-id|verse-key|chapter-key|book-key):\/\/([^)]*)\)/g;function lr(e){let t=[],n=new RegExp(cr),r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push({kind:`text`,text:e.slice(r,i.index)});let a=i[1],o=i[2],s=i[3].trim();s===``||o===`chapter-key`||o===`book-key`?t.push({kind:`text`,text:a}):o===`name-id`?t.push({kind:`name`,label:a,target:s}):o===`location-id`?t.push({kind:`location`,label:a,target:s}):t.push({kind:`verse`,label:a,target:s}),r=n.lastIndex}return r<e.length&&t.push({kind:`text`,text:e.slice(r)}),t}function ur({locationsLookupManager:e,namesLookupManager:t},n,r){if(n.kind===`name`){ar({anchorElement:r,id:n.target,name:t.getRecordById(n.target)?.name??n.label});return}if(n.kind===`location`){rr({anchorElement:r,id:n.target,name:e.getRecordById(n.target)?.name??n.label});return}tr({anchorElement:r,shortVerse:n.target})}function Q({value:e}){let t=pn();return(0,o.jsx)(o.Fragment,{children:(0,a.useMemo)(()=>lr(e),[e]).map((e,n)=>e.kind===`text`?(0,o.jsx)(a.Fragment,{children:e.text},n):(0,o.jsx)(`button`,{className:`mention-reference-link mention-reference-link--${e.kind}`,type:`button`,onClick:n=>{n.preventDefault(),n.stopPropagation(),ur(t,e,n.currentTarget)},children:e.label},n))})}var dr=320,fr=120,pr=220,mr=10,hr=22,gr=32,_r=1e3;function vr(){return _r+=1,_r}function yr(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function br(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}async function xr(e,t){if(typeof ClipboardItem<`u`&&navigator.clipboard!==void 0&&typeof navigator.clipboard.write==`function`)try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:`text/html`}),"text/plain":new Blob([e],{type:`text/plain`})})]);return}catch{}if(navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}br(e)}function Sr(e,t){let n=t.getBoundingClientRect();if(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)return!1;let r=window.getComputedStyle(t),i=Number.parseFloat(r.paddingLeft),a=Number.isFinite(i)&&i>0?Math.min(i+6,gr):hr;return e.clientX<=n.left+a}function Cr(){return{bottom:window.innerHeight,height:window.innerHeight,left:0,right:window.innerWidth,top:0,width:window.innerWidth}}function wr(e){let t=e?.closest(`.editor-container`)??document.querySelector(`.editor-container`);if(t instanceof HTMLElement){let e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return e}return Cr()}function Tr(e,t,n){return Math.min(Math.max(e,t),n)}function Er(e,t){return r.n(e??t?.closest(`.editor-zoom-surface`)??document.querySelector(`.editor-zoom-surface`))}var Dr=420,Or=10,kr=12;function Ar(e,t){let n=Er(null,e),r=e.getBoundingClientRect(),i=t*n,a=Math.min(Dr*n,window.innerWidth-kr*2),o=Math.max(kr,window.innerWidth-a-kr),s=Math.min(Math.max(r.left,kr),o),c=window.innerHeight-r.bottom-Or-kr,l=r.top-Or-kr,u=c<i&&l>c,d=u?r.top-Or:r.bottom+Or,f=Math.max(kr,u?l:c);return{left:s/n,maxHeight:f/n,maxWidth:a/n,position:`fixed`,top:d/n,transform:u?`translateY(-100%)`:void 0,zoom:n}}function jr(e,t,n){let r=wr(n),i=Er(t,n),a=Math.max(pr,t?.offsetWidth??dr)*i,o=Math.max(96,t?.offsetHeight??fr)*i,s=Math.max(r.left,r.right-Math.min(a,r.width)),c=Math.max(r.top,r.bottom-Math.min(o,r.height));return{left:Tr(e.left,r.left,s),top:Tr(e.top,r.top,c)}}function Mr(e){let t=wr(e),n=fr*Er(null,e),r=e.getBoundingClientRect(),i=r.left,a=r.bottom+mr,o=r.top-n-mr;return jr({left:i,top:a+n>t.bottom&&o>=t.top?o:a},null,e)}function Nr(e){let t=J(e);return t===``?``:t.toLowerCase()===`unknown`?`Unknown`:t}function Pr(e){let t=J(e);return t!==``&&t.toLowerCase()!==`unknown`}function Fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ir(e){return`${e.type}: ${e.start} to ${e.end}`}function Lr(e){let t=new Map;return e.links.forEach(e=>{t.set(e.url,e)}),e.wikipedia!==null&&!t.has(e.wikipedia)&&t.set(e.wikipedia,{type:`wikipedia`,url:e.wikipedia}),Array.from(t.values())}function Rr(e,t){let n=e.getRecordById(t);if(n!==null)return n;let r=e.getRecordsByName(t);return r.length===1?r[0]:null}function zr(e,t){return t.map(t=>e.getRecordById(t)?.name??t)}function Br(e,t){return t.map(t=>Rr(e,t)?.name??t)}function Vr(e){return e.map(e=>`${Fr(e.type)}: ${e.url}`).join(`, `)}async function Hr(e,t){return t===void 0?[...e]:Promise.all(e.map(e=>t(e)))}function Ur(e,t){for(let[n,r]of t)r.length>0&&e.push([n,r.join(`, `)])}function Wr(e){return e.filter(e=>e!==``&&e.toLowerCase()!==`unknown`)}async function Gr({locationsLookupManager:e,namesLookupManager:t},n,r){let i=[],a=q(n);a!==null&&i.push([`KJV name`,a]),Pr(n.oldName)&&i.push([`Also called`,Nr(n.oldName)]),n.years.length>0&&i.push([`Years`,n.years.map(Ir).join(`, `)]),Ur(i,[[`Locations`,Br(e,n.locations)],[`Parents`,zr(t,n.parents)],[`Spouses`,zr(t,n.spouses)],[`Children`,zr(t,n.children)],[`Siblings`,zr(t,n.siblings)],[`Cousins`,zr(t,n.cousin)],[`Verses`,await Hr(n.verses,r)]]);let o=Lr(n);return o.length>0&&i.push([`Links`,Vr(o)]),{name:n.name,title:sr(n.title),description:sr(n.description),facts:Wr([n.type,n.gender,n.age]),detailRows:i}}async function Kr(e,t,n){let r=[],i=q(t);i!==null&&r.push([`KJV name`,i]),Pr(t.oldName)&&r.push([`Also called`,Nr(t.oldName)]),Pr(t.modernIdentification)&&r.push([`Modern identification`,Nr(t.modernIdentification)]),Ur(r,[[`Related locations`,Br(e,t.relatedLocations)],[`Verses`,await Hr(t.verses,n)]]);let a=Lr(t);return a.length>0&&r.push([`Links`,Vr(a)]),t.coordinates!==null&&r.push([`Coordinates`,`${t.coordinates.latitude}, ${t.coordinates.longitude}`]),{name:t.name,title:sr(t.title),description:sr(t.description),facts:Wr([t.type]),detailRows:r}}function qr(e){let t=[e.name],n=[`<p><strong>${yr(e.name)}</strong></p>`];if(e.title!==``&&(t.push(e.title),n.push(`<p><em>${yr(e.title)}</em></p>`)),e.description!==``&&(t.push(e.description),n.push(`<p>${yr(e.description)}</p>`)),e.facts.length>0){let r=e.facts.join(`, `);t.push(r),n.push(`<p>${yr(r)}</p>`)}return e.detailRows.length>0&&(t.push(e.detailRows.map(([e,t])=>`${e}: ${t}`).join(`
3
+ `).map(e=>e.split(` `)),r=Et();for(let e of n){let n=ie();for(let r of e){let e=F(M.NO_STATUS),i=t.Ar();r&&i.append(t.D(r)),e.append(i),n.append(e)}r.append(n)}let{anchorCell:i}=De(this);Ee(r,i.select(0,i.getChildrenSize()))}insertText(){}hasFormat(e){let n=0;this.getNodes().filter(I).forEach(e=>{let r=e.getFirstChild();t.kn(r)&&(n|=r.getTextFormat())});let r=t.ti[e];return(n&r)!==0}insertNodes(e){let n=this.focus.getNode();t.vt(n)||L(151),t.R(n.select(0,n.getChildrenSize())).insertNodes(e)}getShape(){let{anchorCell:e,focusCell:t}=De(this),n=Te(e);n===null&&L(153);let r=Te(t);r===null&&L(155);let i=Math.min(n.columnIndex,r.columnIndex),a=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),o=Math.min(n.rowIndex,r.rowIndex),s=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(i,a),fromY:Math.min(o,s),toX:Math.max(i,a),toY:Math.max(o,s)}}getNodes(){if(!this.isValid())return[];let e=this._cachedNodes;if(e!==null)return e;let{anchorTable:n,anchorCell:r,focusCell:i}=De(this),a=i.getParents()[1];if(a!==n){if(n.isParentOf(i)){let e=a.getParent();e??L(159),this.set(this.tableKey,i.getKey(),e.getKey())}else{let e=n.getParent();e??L(158),this.set(this.tableKey,e.getKey(),i.getKey())}return this.getNodes()}let[o,s,c]=z(n,r,i),{minColumn:l,maxColumn:u,minRow:d,maxRow:f}=we(o,s,c),p=new Map([[n.getKey(),n]]),m=null;for(let e=d;e<=f;e++)for(let t=l;t<=u;t++){let{cell:n}=o[e][t],r=n.getParent();R(r)||L(160),r!==m&&(p.set(r.getKey(),r),m=r),p.has(n.getKey())||je(n,e=>{p.set(e.getKey(),e)})}let h=Array.from(p.values());return t.dn()||(this._cachedNodes=h),h}getTextContent(){let e=this.getNodes().filter(e=>I(e)),t=``;for(let n=0;n<e.length;n++){let r=e[n],i=r.__parent,a=(e[n+1]||{}).__parent;t+=r.getTextContent()+(a===i?` `:`
4
+ `)}return t}};function H(e){return e instanceof Oe}function ke(){return new Oe(`root`,t.dr(`root`,0,`element`),t.dr(`root`,0,`element`))}function Ae(e,n,r){e.getKey(),n.getKey(),r.getKey();let i=t.tt(),a=H(i)?i.clone():ke();return a.set(e.getKey(),n.getKey(),r.getKey()),a}function je(e,n){let r=[[e]];for(let e=r.at(-1);e!==void 0&&r.length>0;e=r.at(-1)){let i=e.pop();i===void 0?r.pop():!1!==n(i)&&t.vt(i)&&r.push(i.getChildren())}}function Me(e,n=t.s()){let r=t.Ht(e);G(r)||L(231,e);let i=U(r,n.getElementByKey(e));return i===null&&L(232,e),{tableElement:i,tableNode:r}}var Ne=class{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){let{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){let{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}removeObserver(e){let t=this.observers.get(e);return t!==void 0&&(t[0].removeListeners(),this.observers.delete(e),!0)}removeAllObservers(){for(let e of Array.from(this.observers.keys()))this.removeObserver(e)}$getTableNodesAndObservers(){let e=[];for(let[n,[r]]of Array.from(this.observers.entries())){let i=t.Ht(n);G(i)?e.push([i,r]):this.removeObserver(n)}return e}},Pe=class{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort(`removeListeners`),Array.from(this.listenersToRemove).forEach(e=>e()),this.listenersToRemove.clear()}$lookup(){return Me(this.tableNodeKey,this.editor)}trackTable(){let e=new MutationObserver(e=>{this.editor.read(`latest`,()=>{let t=!1;for(let n=0;n<e.length;n++){let r=e[n].target.nodeName;if(r===`TABLE`||r===`TBODY`||r===`THEAD`||r===`TR`){t=!0;break}}if(!t)return;let{tableNode:n,tableElement:r}=this.$lookup();this.table=Qe(n,r)})});this.editor.read(`latest`,()=>{let{tableNode:t,tableElement:n}=this.$lookup();this.table=Qe(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})})}$clearHighlight(e=!0){let n=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();let{tableNode:r,tableElement:i}=this.$lookup();$e(n,Qe(r,i),null),e&&t.tt()!==null&&(t.En(null),n.dispatchCommand(t.F,void 0))}$enableHighlightStyle(){let e=this.editor,{tableElement:n}=this.$lookup();t.Pt(n,e._config.theme.tableSelection),n.classList.remove(`disable-selection`),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){let{tableElement:e}=this.$lookup();t.Vr(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&L(233,e.tableKey,this.tableNodeKey);let t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),$e(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){let e=t.M(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,n=!1){let r=this.editor,{tableNode:i}=this.$lookup(),a=e.x,o=e.y;if(this.focusCell=e,!this.isHighlightingCells&&(n||this.anchorX!==a||this.anchorY!==o||this.tableSelection!=null&&this.anchorCellNodeKey!=null)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),this.focusX!==-1&&this.focusY!==-1&&a===this.focusX&&o===this.focusY)return!1;if(this.focusX=a,this.focusY=o,this.isHighlightingCells){let s=_t(i,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null){let e=s;if(e===null&&n&&(e=i.getCellNodeFromCords(a,o,this.table)),e!==null){let n=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=e.getKey(),this.tableSelection=Ae(i,n,e),t.En(this.tableSelection),r.dispatchCommand(t.F,void 0),$e(r,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){let e=this.anchorCellNodeKey?t.Ht(this.anchorCellNodeKey):null;return I(e)?e:null}$getAnchorTableCellOrThrow(){let e=this.$getAnchorTableCell();return e===null&&L(234),e}$getFocusTableCell(){let e=this.focusCellNodeKey?t.Ht(this.focusCellNodeKey):null;return I(e)?e:null}$getFocusTableCellOrThrow(){let e=this.$getFocusTableCell();return e===null&&L(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;let{tableNode:t}=this.$lookup(),n=_t(t,e.elem);if(n!==null){let e=n.getKey();this.tableSelection==null?this.tableSelection=Ae(t,n,n):(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),e,e)),this.anchorCellNodeKey=e}}$formatCells(e){let n=t.tt();H(n)||L(236);let r=t.h(),i=r.anchor,a=r.focus,o=n.getNodes().filter(I);o.length>0||L(237);let s=o[0].getFirstChild(),c=t.kn(s)?s.getFormatFlags(e,null):null;o.forEach(t=>{i.set(t.getKey(),0,`element`),a.set(t.getKey(),t.getChildrenSize(),`element`),r.formatText(e,c)}),t.En(n),this.editor.dispatchCommand(t.F,void 0)}$clearText(){let{editor:e}=this,n=t.Ht(this.tableNodeKey);if(!G(n))throw Error(`Expected TableNode.`);let r=t.tt();H(r)||L(253);let i=r.getNodes().filter(I),a=n.getFirstChild(),o=n.getLastChild();if(i.length>0&&a!==null&&o!==null&&R(a)&&R(o)&&i[0]===a.getFirstChild()&&i[i.length-1]===o.getLastChild()){n.selectPrevious();let r=n.getParent();n.remove(),t.ri(r)&&r.isEmpty()&&e.dispatchCommand(t.A,void 0);return}i.forEach(e=>{if(t.vt(e)){let n=t.Ar(),r=t.D();n.append(r),e.append(n),e.getChildren().forEach(e=>{e!==n&&e.remove()})}}),$e(e,this.table,null),t.En(null),e.dispatchCommand(t.F,void 0)}},Fe=`__lexicalTableSelection`;function Ie(e){let n=t.Ut(e);return G(n)||L(386,e),n}var Le=40;function Re(e,t,n){let r=e=>Math.max(1,Math.ceil(Math.min(Le,e)/Le*18));return e<=t+Le?-r(t+Le-e):e>=n-Le?r(e-(n-Le)):0}function ze(e){return t.Sn(e)&&e.nodeName===`TABLE`}function U(e,t){if(!t)return t;let n=ze(t)?t:t.querySelector(`table`);return ze(n)||L(341,e.constructor.name,e.getType(),e.getKey(),t.nodeName),n}function Be(e){return e._window}function Ve(e,t){for(let n=t,r=null;n!==null;n=n.getParent()){if(e.is(n))return r;I(n)&&(r=n)}return null}var He=[[t.Qn,`down`],[t.Cr,`up`],[t.ur,`backward`],[t.Dn,`forward`]],Ue=[t.gr,t.Zt,t.It],We=[t.Nr,t.wn];function Ge(e,n){return e.registerRootListener(r=>{if(r===null)return;let i=e._window;if(i!==null)return t.yt(i,`pointerdown`,i=>{let a=t.Zn(i);if(i.button!==0||!t.Ln(a)||!r.contains(a))return;let o=function(e){let t=Xe(e);if(t===null)return null;let n=t.elem;for(;n!=null;){if(n.nodeName===`TABLE`&&Fe in n&&n[Fe])return{cellElement:t,tableElement:n,tableObserver:n[Fe]};n=n.parentNode}return null}(a);e.update(()=>{if(H(t.tt())){for(let[e]of n.observers.values())e.$clearHighlight(!1);t.En(null),e.dispatchCommand(t.F,void 0)}if(!o)return;let{tableObserver:r,tableElement:a,cellElement:s}=o;(function(e,n,r,i,a,o){let s=e._window;if(!s)return;let c=r=>{if(a.isSelecting)return;a.isSelecting=!0,r!==null&&a.anchorCell===null&&e.update(()=>{a.$setAnchorCellForSelection(r)});let c=n.clientX,l=n.clientY,u=null,d=()=>{a.isSelecting=!1,u!==null&&(s.cancelAnimationFrame(u),u=null),s.removeEventListener(`pointerup`,b),s.removeEventListener(`pointermove`,x)},f=(e,n)=>{let r=i.getRootNode();if(!t.X(r)&&!t.Gn(r))return null;for(let t of r.elementsFromPoint(e,n)){let e=Ze(i,t);if(e)return e}return null},p=(n,r)=>{a.anchorCell===null&&e.update(()=>{a.$setAnchorCellForSelection(n)}),a.focusCell!==null&&n.elem===a.focusCell.elem||(o.setNextFocus({focusCell:n,override:r,tableKey:a.tableNodeKey}),e.dispatchCommand(t.F,void 0))},m=e=>{for(let t=i.parentElement;t;t=t.parentElement)if(e===`x`?t.scrollWidth>t.clientWidth:t.scrollHeight>t.clientHeight){let n=s.getComputedStyle(t),r=e===`x`?n.overflowX:n.overflowY;if(r===`auto`||r===`scroll`)return t}return null},h=(e,t,n)=>{let r,i;if(e===null)r=0,i=n===`x`?s.innerWidth:s.innerHeight;else{let t=e.getBoundingClientRect();r=n===`x`?t.left:t.top,i=n===`x`?t.right:t.bottom}let a=Re(t,r,i);if(a===0)return!1;if(e===null){let e=n===`x`?s.scrollX:s.scrollY;return s.scrollBy(n===`x`?a:0,n===`x`?0:a),(n===`x`?s.scrollX:s.scrollY)!==e}if(n===`x`){let t=e.scrollLeft;return e.scrollLeft+=a,e.scrollLeft!==t}let o=e.scrollTop;return e.scrollTop+=a,e.scrollTop!==o},g=(e,t)=>{let n=c,r=l;if(e===null)n=Math.min(Math.max(n,1),s.innerWidth-1);else{let t=e.getBoundingClientRect();n=Math.min(Math.max(n,t.left+1),t.right-1)}if(t===null)r=Math.min(Math.max(r,1),s.innerHeight-1);else{let e=t.getBoundingClientRect();r=Math.min(Math.max(r,e.top+1),e.bottom-1)}return[n,r]},_=()=>{let e=m(`x`);if(e!==null){let t=e.getBoundingClientRect();if(Re(c,t.left,t.right)!==0)return!0}let t=m(`y`),n=t===null?0:t.getBoundingClientRect().top,r=t===null?s.innerHeight:t.getBoundingClientRect().bottom;return Re(l,n,r)!==0},v=()=>{if(u=null,!a.isSelecting)return;let e=m(`x`),t=m(`y`),n=e!==null&&h(e,c,`x`),r=h(t,l,`y`);if(n||r){let[n,r]=g(e,t),i=f(n,r);i&&p(i,!1),u=s.requestAnimationFrame(v)}},y=()=>{u===null&&a.pointerType!==`touch`&&_()&&(u=s.requestAnimationFrame(v))},b=()=>{d()},x=e=>{if(!(e=>!(1&~e.buttons))(e)&&a.isSelecting)return void d();let n=t.Zn(e);if(!t.Ln(n))return;c=e.clientX,l=e.clientY;let r=null,o=!(t.Vn||i.contains(n));r=o?Ze(i,n):f(e.clientX,e.clientY),r&&p(r,o),y()};s.addEventListener(`pointerup`,b,a.listenerOptions),s.addEventListener(`pointermove`,x,a.listenerOptions)};a.pointerType=n.pointerType;let l=Ie(a.tableNodeKey),u=t.Y();if(t.Vn&&n.shiftKey&&W(u,l)&&(t.bn(u)||H(u))){let e=u.anchor.getNode(),t=Ve(l,u.anchor.getNode());t?(a.$setAnchorCellForSelection(gt(a,t)),a.$setFocusCellForSelection(r),pt(n)):(l.isBefore(e)?l.selectStart():l.selectEnd()).anchor.set(u.anchor.key,u.anchor.offset,u.anchor.type)}else n.pointerType!==`touch`&&a.$setAnchorCellForSelection(r);c(r)})(e,i,s,a,r,n)})})})}function Ke(e,i,a,o,s){let c=a.getRootElement(),l=Be(a);c!==null&&l!==null||L(246);let u=new Pe(a,e.getKey()),d=U(e,i);(function(e,t){Ye(e)!==null&&L(205),e[Fe]=t})(d,u),u.listenersToRemove.add(()=>function(e,t){Ye(e)===t&&delete e[Fe]}(d,u)),u.listenersToRemove.add(t.yt(d,`mousedown`,e=>{let n=t.Zn(e);e.detail>=3&&t.Ln(n)&&Xe(n)!==null&&e.preventDefault()},u.listenerOptions));for(let[t,n]of He)u.listenersToRemove.add(a.registerCommand(t,t=>ft(a,t,n,e,u,s),3));u.listenersToRemove.add(a.registerCommand(t.jn,n=>{let r=t.tt();if(H(r)){let t=Ve(e,r.focus.getNode());if(t!==null)return pt(n),t.selectEnd(),!0}return!1},3));let f=n=>()=>{let r=t.tt();if(!W(r,e))return!1;if(H(r))return u.$clearText(),!0;if(t.bn(r)){if(!I(Ve(e,r.anchor.getNode())))return!1;let i=r.anchor.getNode(),a=r.focus.getNode(),o=e.isParentOf(i),s=e.isParentOf(a);if(o&&!s||s&&!o)return u.$clearText(),!0;let c=t.B(r.anchor.getNode(),e=>t.vt(e)),l=c&&t.B(c,e=>t.vt(e)&&I(e.getParent()));if(!t.vt(l)||!t.vt(c))return!1;if(n===t.Zt&&l.getPreviousSibling()===null)return!0}return!1};for(let e of Ue)u.listenersToRemove.add(a.registerCommand(e,f(e),3));let p=n=>{let r=t.tt();if(!H(r)&&!t.bn(r))return!1;let i=e.isParentOf(r.anchor.getNode());if(i!==e.isParentOf(r.focus.getNode())){let t=i?`anchor`:`focus`,n=i?`focus`:`anchor`,{key:a,offset:o,type:s}=r[n];return e[r[t].isBefore(r[n])?`selectPrevious`:`selectNext`]()[n].set(a,o,s),!1}return!!W(r,e)&&!!H(r)&&(n&&(n.preventDefault(),n.stopPropagation()),u.$clearText(),!0)};for(let e of We)u.listenersToRemove.add(a.registerCommand(e,p,3));u.listenersToRemove.add(a.registerCommand(t.Nt,e=>{let i=t.tt();if(i){if(!H(i)&&!t.bn(i))return!1;r.c(a,n.s(e,ClipboardEvent)?e:null,r.u(i));let o=p(e);return t.bn(i)?(i.removeText(),!0):o}return!1},3));let m=c.ownerDocument;return u.listenersToRemove.add(t.yt(m,`paste`,n=>{n.defaultPrevented||a.read(`latest`,()=>{let n=t.tt();return c.contains(m.activeElement)&&H(n)&&W(n,e)})&&(n.preventDefault(),a.dispatchCommand(t.Wn,n))})),u.listenersToRemove.add(t.yt(m,`copy`,n=>{if(n.defaultPrevented)return;let r=t.Zn(n);r===c||t.Ln(r)&&c.contains(r)||a.read(`latest`,()=>{let n=t.tt();return c.contains(t.Hn(c))&&H(n)&&W(n,e)})&&(n.preventDefault(),a.dispatchCommand(t.Rr,n))})),u.listenersToRemove.add(a.registerCommand(t.w,n=>{let r=t.tt();return W(r,e)?H(r)?(u.$formatCells(n),!0):(t.bn(r)&&I(t.B(r.anchor.getNode(),e=>I(e))),!1):!1},3)),u.listenersToRemove.add(a.registerCommand(t.tr,n=>{let r=t.tt();if(!H(r)||!W(r,e))return!1;let i=r.anchor.getNode(),a=r.focus.getNode();if(!I(i)||!I(a))return!1;if(function(e,t){if(H(e)){let n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){let[e]=z(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(r,e))return e.setFormat(n),!0;let[o,s,c]=z(e,i,a),l=Math.max(s.startRow+s.cell.__rowSpan-1,c.startRow+c.cell.__rowSpan-1),u=Math.max(s.startColumn+s.cell.__colSpan-1,c.startColumn+c.cell.__colSpan-1),d=Math.min(s.startRow,c.startRow),f=Math.min(s.startColumn,c.startColumn),p=new Set;for(let e=d;e<=l;e++)for(let r=f;r<=u;r++){let i=o[e][r].cell;if(p.has(i))continue;p.add(i),i.setFormat(n);let a=i.getChildren();for(let e=0;e<a.length;e++){let r=a[e];t.vt(r)&&!r.isInline()&&r.setFormat(n)}}return!0},3)),u.listenersToRemove.add(a.registerCommand(t.V,n=>{let r=t.tt();if(!W(r,e))return!1;if(H(r))return u.$clearHighlight(),!1;if(t.bn(r)){if(!I(t.B(r.anchor.getNode(),e=>I(e))))return!1;if(typeof n==`string`){let i=ht(a,r,e);if(i)return mt(i,e,[t.D(n)]),!0}}return!1},3)),o&&u.listenersToRemove.add(a.registerCommand(t.zn,n=>{let r=t.tt();if(!t.bn(r)||!r.isCollapsed()||!W(r,e))return!1;let i=lt(r.anchor.getNode());return!(i===null||!e.is(ut(i)))&&(pt(n),function(e,n){let r=n===`next`?`getNextSibling`:`getPreviousSibling`,i=n===`next`?`getFirstChild`:`getLastChild`,a=e[r]();if(t.vt(a))return a.selectEnd();let o=t.B(e,R);o===null&&L(247);for(let e=o[r]();R(e);e=e[r]()){let n=e[i]();if(t.vt(n))return n.selectEnd()}let s=t.B(o,G);s===null&&L(248),n===`next`?s.selectNext():s.selectPrevious()}(i,n.shiftKey?`previous`:`next`),!0)},3)),u.listenersToRemove.add(a.registerCommand(t.mt,t=>e.isSelected(),3)),u.listenersToRemove.add(a.registerCommand(t.A,()=>{let n=t.tt();if(!t.bn(n)||!n.isCollapsed()||!W(n,e))return!1;let r=ht(a,n,e);return!!r&&(mt(r,e),!0)},3)),u}function qe(e,n){let r=t.tt(),i=t.Y(),a=e.getAndClearNextFocus();if(a!==null){let{tableKey:t,focusCell:n}=a,i=e.observers.get(t);i||L(335,t);let[o]=i;if(H(r)&&r.tableKey===o.tableNodeKey)return(n.x!==o.focusX||n.y!==o.focusY)&&(o.$setFocusCellForSelection(n),!0);if(o.anchorCell!==null&&o.anchorCellNodeKey!==null&&n.elem!==o.anchorCell.elem&&o.tableSelection!==null)return o.$setFocusCellForSelection(n,!0),!0}let o=e.getAndClearShouldCheckSelectionForTable();if(o&&t.bn(i)&&t.bn(r)&&r.isCollapsed()){let e=t.Ht(o);if(G(e)){let n=r.anchor.getNode(),i=e.getFirstChild(),a=lt(n);if(a!==null&&R(i)){let n=i.getFirstChild();if(I(n)&&e.is(t.B(a,t=>t.is(e)||t.is(n))))return n.selectStart(),!0}}}H(r)&&function(e,n){let r=Be(e),i=t.Y();if(!n.is(i))return;let a=Ie(n.tableKey),o=t.M(r),s=o&&t.Er(o,e.getRootElement());if(o&&s&&s.anchorNode&&s.focusNode){let r=t.Yt(s.focusNode),i=r&&!a.isParentOf(r),c=t.Yt(s.anchorNode),l=c&&a.isParentOf(c);if(i&&l&&o.rangeCount>0){let r=t.C(o,e);r&&(r.anchor.set(a.getKey(),n.isBackward()?a.getChildrenSize():0,`element`),o.removeAllRanges(),t.En(r))}}}(n,r),t.bn(r)&&function(e,n){let r=t.Y(),{anchor:i,focus:a}=e,o=i.getNode(),s=a.getNode(),c=lt(o),l=lt(s),u=c?ut(c):null,d=l?ut(l):null,f=e.isBackward(),p=c&&l&&u&&d&&u.is(d),m=d&&(!u||u.isParentOf(d)),h=u&&(!d||d.isParentOf(u));if(m){let n=e.clone(),[r]=z(d,l,l),i=r[0][0].cell,a=r[r.length-1].at(-1).cell;n.focus.set(f?i.getKey():a.getKey(),f?0:a.getChildrenSize(),`element`),t.En(n)}else if(h){let n=e.clone(),[r]=z(u,c,c),i=r[0][0].cell,a=r[r.length-1].at(-1).cell;n.anchor.set(f?a.getKey():i.getKey(),f?a.getChildrenSize():0,`element`),t.En(n)}else if(p){let i=n.observers.get(u.getKey());i||L(335,u.getKey());let[a]=i;if(c.is(l)||(a.$setAnchorCellForSelection(gt(a,c)),a.$setFocusCellForSelection(gt(a,l),!0)),a.pointerType===`touch`&&a.isSelecting&&e.isCollapsed()&&t.bn(r)&&r.isCollapsed()){let e=lt(r.anchor.getNode());e&&!e.is(l)&&(a.$setAnchorCellForSelection(gt(a,e)),a.$setFocusCellForSelection(gt(a,l),!0),a.pointerType=null)}}}(r,e);for(let[t,r]of e.$getTableNodesAndObservers())Je(n,t,r);return!1}function Je(e,n,r){let i=t.tt(),a=t.Y();i&&!i.is(a)&&(H(i)||H(a))&&r.tableSelection&&!r.tableSelection.is(a)&&(H(i)&&i.tableKey===r.tableNodeKey?r.$updateTableTableSelection(i):!H(i)&&H(a)&&a.tableKey===r.tableNodeKey&&r.$updateTableTableSelection(null)),r.hasHijackedSelectionStyles&&!n.isSelected()?function(e,t){t.$enableHighlightStyle(),et(t.table,t=>{let n=t.elem;t.highlighted=!1,ct(e,t),n.getAttribute(`style`)||n.removeAttribute(`style`)})}(e,r):!r.hasHijackedSelectionStyles&&n.isSelected()&&function(e,t){t.$disableHighlightStyle(),et(t.table,t=>{t.highlighted=!0,st(e,t)})}(e,r)}function Ye(e){return e[Fe]||null}function Xe(e){let t=e;for(;t!=null;){let e=t.nodeName;if(e===`TD`||e===`TH`){let e=t._cell;return e===void 0?null:e}t=t.parentNode}return null}function Ze(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;r!=null;r=r.parentNode){if(r===e)return n;let t=r.nodeName;t!==`TD`&&t!==`TH`||(n=r._cell||null)}return null}function Qe(e,t){let n=[],r={columns:0,domRows:n,rows:0},i=U(e,t).querySelector(`tr`),a=0,o=0;for(n.length=0;i!=null;){let e=i.nodeName;if(e===`TD`||e===`TH`){let e={elem:i,hasBackgroundColor:i.style.backgroundColor!==``,highlighted:!1,x:a,y:o};i._cell=e;let t=n[o];t===void 0&&(t=n[o]=[]),t[a]=e}else{let e=i.firstChild;if(e!=null){i=e;continue}}let t=i.nextSibling;if(t!=null){a++,i=t;continue}let r=i.parentNode;if(r!=null){let e=r.nextSibling;if(e==null)break;o++,a=0,i=e}}return r.columns=a+1,r.rows=o+1,r}function $e(e,t,n){let r=new Set(n?n.getNodes():[]);et(t,(t,n)=>{let i=t.elem;r.has(n)?(t.highlighted=!0,st(e,t)):(t.highlighted=!1,ct(e,t),i.getAttribute(`style`)||i.removeAttribute(`style`))})}function et(e,n){let{domRows:r}=e;for(let e=0;e<r.length;e++){let i=r[e];if(i)for(let r=0;r<i.length;r++){let a=i[r];if(!a)continue;let o=t.Yt(a.elem);o!==null&&n(a,o,{x:r,y:e})}}}var tt=(e,t,n,r,i)=>{let a=i===`forward`;switch(i){case`backward`:case`forward`:return n===(a?e.table.columns-1:0)?r===(a?e.table.rows-1:0)?a?t.selectNext():t.selectPrevious():ot(t.getCellNodeFromCordsOrThrow(a?0:e.table.columns-1,r+(a?1:-1),e.table),a):ot(t.getCellNodeFromCordsOrThrow(n+(a?1:-1),r,e.table),a),!0;case`up`:return r===0?t.selectPrevious():ot(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1),!0;case`down`:return r===e.table.rows-1?t.selectNext():ot(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0),!0;default:return!1}};function nt(e,t){let n,r;if(t.startColumn===e.minColumn)n=`minColumn`;else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n=`maxColumn`}if(t.startRow===e.minRow)r=`minRow`;else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r=`maxRow`}return[n,r]}function rt([e,t]){return[e===`minColumn`?`maxColumn`:`minColumn`,t===`minRow`?`maxRow`:`minRow`]}function it(e,t,[n,r]){let i=t[r],a=e[i];a===void 0&&L(250,r,String(i));let o=t[n],s=a[o];return s===void 0&&L(250,n,String(o)),s}function at(e,t,n,r,i){let a=we(t,n,r),{topSpan:o,leftSpan:s,bottomSpan:c,rightSpan:l}=function(e,t){let{minColumn:n,maxColumn:r,minRow:i,maxRow:a}=t,o=1,s=1,c=1,l=1,u=e[i],d=e[a];for(let e=n;e<=r;e++)o=Math.max(o,u[e].cell.__rowSpan),l=Math.max(l,d[e].cell.__rowSpan);for(let t=i;t<=a;t++)s=Math.max(s,e[t][n].cell.__colSpan),c=Math.max(c,e[t][r].cell.__colSpan);return{bottomSpan:l,leftSpan:s,rightSpan:c,topSpan:o}}(t,a),[u,d]=rt(function(e,t){let n=nt(e,t);return n===null&&L(249,t.cell.getKey()),n}(a,n)),f=a[u],p=a[d];i===`forward`?f+=u===`maxColumn`?1:s:i===`backward`?f-=u===`minColumn`?1:l:i===`down`?p+=d===`maxRow`?1:o:i===`up`&&(p-=d===`minRow`?1:c);let m=t[p];if(m===void 0)return!1;let h=m[f];if(h===void 0)return!1;let[g,_]=function(e,t,n){let r=we(e,t,n),i=nt(r,t);if(i)return[it(e,r,i),it(e,r,rt(i))];let a=nt(r,n);if(a)return[it(e,r,rt(a)),it(e,r,a)];let o=[`minColumn`,`minRow`];return[it(e,r,o),it(e,r,rt(o))]}(t,n,h),v=gt(e,g.cell),y=gt(e,_.cell);return e.$setAnchorCellForSelection(v),e.$setFocusCellForSelection(y,!0),!0}function W(e,n){if(t.bn(e)||H(e)){let t=n.isParentOf(e.anchor.getNode()),r=n.isParentOf(e.focus.getNode());return t&&r}return!1}function ot(e,t){t?e.selectStart():e.selectEnd()}function st(e,n){let r=n.elem,i=e._config.theme;I(t.Yt(r))||L(131),t.Vr(r,i.tableCellSelected)}function ct(e,n){let r=n.elem;I(t.Yt(r))||L(131);let i=e._config.theme;t.Pt(r,i.tableCellSelected)}function lt(e){let n=t.B(e,I);return I(n)?n:null}function ut(e){let n=t.B(e,G);return G(n)?n:null}function dt(e,n,r,i,a,o,s){let c=t.Gt(r.focus,a?`previous`:`next`);if(t.$n(c))return!1;let l=c;for(let e of t.Ft(c).iterNodeCarets(`shadowRoot`)){if(!t.Hr(e)||!t.vt(e.origin))return!1;l=e}let u=l.getParentAtCaret();if(!I(u))return!1;let d=u,f=function(e){for(let n of t.Ft(e).iterNodeCarets(`root`)){let{origin:r}=n;if(I(r)){if(t._(n))return t.Z(r,e.direction)}else if(!R(r))break}return null}(t.f(d,l.direction)),p=t.B(d,G);if(!p||!p.is(o))return!1;let m=e.getElementByKey(d.getKey()),h=Xe(m);if(!m||!h)return!1;if(s.table=wt(e,p),f)if(i===`extend`){let t=Xe(e.getElementByKey(f.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(t,!0)}else{let e=t.wr(f);t.Ct(r.anchor,e),t.Ct(r.focus,e)}else if(i===`extend`)s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{let e=function(e){let n=t.ni(e);return t._(n)?t.wr(n):e}(t.f(p,c.direction));t.Ct(r.anchor,e),t.Ct(r.focus,e)}return pt(n),!0}function ft(e,n,r,i,a,o){if((r===`up`||r===`down`)&&function(e){let t=e.getRootElement();return t?t.hasAttribute(`aria-controls`)&&t.getAttribute(`aria-controls`)===`typeahead-menu`:!1}(e))return!1;let s=t.tt();if(!W(s,i)){if(t.bn(s)){if(r===`backward`){if(s.focus.offset>0)return!1;let e=function(e){for(let n=e,r=e;r!==null;n=r,r=r.getParent())if(t.vt(r)){if(r!==n&&r.getFirstChild()!==n)return null;if(!r.isInline())return r}return null}(s.focus.getNode());if(!e)return!1;let r=e.getPreviousSibling();return!!G(r)&&(pt(n),n.shiftKey?s.focus.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent(),`element`):r.selectEnd(),!0)}if(n.shiftKey&&(r===`up`||r===`down`)){let e=s.focus.getNode();if(!s.isCollapsed()&&(r===`up`&&!s.isBackward()||r===`down`&&s.isBackward())){let a=t.B(e,e=>G(e));if(I(a)&&(a=t.B(a,G)),a!==i||!a)return!1;let o=r===`down`?a.getNextSibling():a.getPreviousSibling();if(!o)return!1;let c=0;r===`up`&&t.vt(o)&&(c=o.getChildrenSize());let l=o;r===`up`&&t.vt(o)&&(l=o.getLastChild()||o,c=t.Jt(l)?l.getTextContentSize():0);let u=s.clone();return u.focus.set(l.getKey(),c,t.Jt(l)?`text`:`element`),t.En(u),pt(n),!0}if(t.J(e)){let e=r===`up`?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(e&&Ve(i,e)!==null){let e=i.getFirstDescendant(),t=i.getLastDescendant();if(!e||!t)return!1;let[n]=V(e),[r]=V(t),o=i.getCordsFromCellNode(n,a.table),s=i.getCordsFromCellNode(r,a.table),c=i.getDOMCellFromCordsOrThrow(o.x,o.y,a.table),l=i.getDOMCellFromCordsOrThrow(s.x,s.y,a.table);return a.$setAnchorCellForSelection(c),a.$setFocusCellForSelection(l,!0),!0}return!1}{let i=t.B(e,e=>t.vt(e)&&!e.isInline());if(I(i)&&(i=t.B(i,G)),!i)return!1;let o=r===`down`?i.getNextSibling():i.getPreviousSibling();if(G(o)&&a.tableNodeKey===o.getKey()){let e=o.getFirstDescendant(),i=o.getLastDescendant();if(!e||!i)return!1;let[a]=V(e),[c]=V(i),l=s.clone();return l.focus.set((r===`up`?a:c).getKey(),r===`up`?0:c.getChildrenSize(),`element`),pt(n),t.En(l),!0}}}}return r===`down`&&xt(e)&&o.setShouldCheckSelectionForTable(i.getKey()),!1}if(t.bn(s)){if(r===`backward`||r===`forward`)return dt(e,n,s,n.shiftKey?`extend`:`move`,r===`backward`,i,a);if(s.isCollapsed()){let{anchor:c,focus:l}=s,u=t.B(c.getNode(),I),d=t.B(l.getNode(),I);if(!I(u)||!u.is(d))return!1;let f=ut(u);if(f!==i&&f!=null){let t=U(f,e.getElementByKey(f.getKey()));if(t!=null)return a.table=Qe(f,t),ft(e,n,r,f,a,o)}let p=e.getElementByKey(u.__key),m=e.getElementByKey(c.key);if(m==null||p==null)return!1;let h;if(c.type===`element`)h=m.getBoundingClientRect();else{let n=t.M(Be(e));if(n===null||n.rangeCount===0)return!1;let r=t.rn(n,e.getRootElement());if(r===null)return!1;h=r.getBoundingClientRect()}let g=r===`up`?u.getFirstChild():u.getLastChild();if(g==null)return!1;let _=e.getElementByKey(g.__key);if(_==null)return!1;let v=_.getBoundingClientRect();if(r===`up`?v.top>h.top-h.height:h.bottom+h.height>v.bottom){pt(n);let e=i.getCordsFromCellNode(u,a.table);if(!n.shiftKey)return tt(a,i,e.x,e.y,r);{let t=i.getDOMCellFromCordsOrThrow(e.x,e.y,a.table);a.$setAnchorCellForSelection(t),a.$setFocusCellForSelection(t,!0)}return!0}}}else if(H(s)){let{anchor:o,focus:c,tableKey:l}=s;if(l!==i.getKey())return!1;let u=t.B(o.getNode(),I),d=t.B(c.getNode(),I),[f]=s.getNodes();G(f)||L(251);let p=U(f,e.getElementByKey(f.getKey()));if(!I(u)||!I(d)||!G(f)||p==null)return!1;a.$updateTableTableSelection(s);let m=Qe(f,p),h=i.getCordsFromCellNode(u,m),g=i.getDOMCellFromCordsOrThrow(h.x,h.y,m);if(a.$setAnchorCellForSelection(g),pt(n),n.shiftKey){let[e,t,n]=z(i,u,d);return at(a,e,t,n,r)}return d.selectEnd(),!0}return!1}function pt(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function mt(e,n,r){let i=t.Ar();e===`first`?n.insertBefore(i):n.insertAfter(i),i.append(...r||[]),i.selectEnd()}function ht(e,n,r){let i=r.getParent();if(!i)return;let a=t.M(Be(e));if(!a)return;let o=t.Er(a,e.getRootElement()).anchorNode,s=e.getElementByKey(i.getKey()),c=U(r,e.getElementByKey(r.getKey()));if(!o||!s||!c||!s.contains(o)||c.contains(o))return;let l=t.B(n.anchor.getNode(),e=>I(e));if(!l)return;let u=t.B(l,e=>G(e));if(!G(u)||!u.is(r))return;let[d,f]=z(r,l,l),p=d[0][0],m=d[d.length-1][d[0].length-1],{startRow:h,startColumn:g}=f,_=h===p.startRow&&g===p.startColumn,v=h===m.startRow&&g===m.startColumn;return _?`first`:v?`last`:void 0}function gt(e,t){let{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function _t(e,n,r){return Ve(e,t.Yt(n,r))}function vt(e,n,r){let i=e.querySelector(`colgroup`);if(!i)return;let a=[];for(let e=0;e<n;e++){let n=t.qt().createElement(`col`),i=r&&r[e];i&&(n.style.width=`${i}px`),a.push(n)}i.replaceChildren(...a)}function yt(e,n,r){if(!n.theme.tableAlignment)return;let i=[],a=[];for(let e of[`center`,`right`]){let t=n.theme.tableAlignment[e];t&&(e===r?a:i).push(t)}t.Pt(e,...i),t.Vr(e,...a)}var bt=new WeakSet;function xt(e=t.s()){return bt.has(e)}function St(e,t){t?bt.add(e):bt.delete(e)}var Ct=class e extends t.m{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return`table`}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){let t=this.getWritable();return t.__colWidths=e,t}static clone(t){return new e(t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Tt,priority:1})}}static importJSON(e){return Et().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return n===`html`}getDOMSlot(e){let t=ze(e)?e:e.querySelector(`table`);return ze(t)||L(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector(`colgroup`))}createDOM(e,n){let r=t.qt().createElement(`table`);this.__style&&t.bt(r.style,this.__style);let i=t.qt().createElement(`colgroup`);if(r.appendChild(i),t.P(i),t.Vr(r,e.theme.table),this.updateTableElement(null,r,e),xt(n)){let n=t.qt().createElement(`div`),i=e.theme.tableScrollableWrapper;return i?t.Vr(n,i):n.style.overflowX=`auto`,n.appendChild(r),this.updateTableWrapper(null,n,r,e),n}return r}updateTableWrapper(e,n,r,i){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,n,r,i){i>0?(t.Vr(e,r.theme.tableFrozenColumn),n.setAttribute(`data-lexical-frozen-column`,`true`)):(t.Pt(e,r.theme.tableFrozenColumn),n.removeAttribute(`data-lexical-frozen-column`))}(n,r,i,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,n,r,i){i>0?(t.Vr(e,r.theme.tableFrozenRow),n.setAttribute(`data-lexical-frozen-row`,`true`)):(t.Pt(e,r.theme.tableFrozenRow),n.removeAttribute(`data-lexical-frozen-row`))}(n,r,i,this.__frozenRowCount)}updateTableElement(e,n,r){this.__style!==(e?e.__style:``)&&t.bt(n.style,this.__style,e?e.__style:``),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,n,r){r?(t.Vr(e,n.theme.tableRowStriping),e.setAttribute(`data-lexical-row-striping`,`true`)):(t.Pt(e,n.theme.tableRowStriping),e.removeAttribute(`data-lexical-row-striping`))}(n,r,this.__rowStriping);let i=e?e.getColumnCount():0,a=e?e.__colWidths:void 0;this.getColumnCount()===i&&this.getColWidths()===a||vt(n,this.getColumnCount(),this.getColWidths()),yt(n,r,this.getFormatType())}updateDOM(e,n,r){let i=U(this,n);return n===i===xt()||(t.Sn(a=n)&&a.nodeName===`DIV`&&this.updateTableWrapper(e,n,i,r),this.updateTableElement(e,i,r),!1);var a}scaleDOMColWidths(e,t){let n=this.getColWidths();n&&vt(U(this,e),this.getColumnCount(),n.map(e=>e*t))}exportDOM(e){let n=super.exportDOM(e),{element:r}=n;return{after:r=>{if(n.after&&(r=n.after(r)),!ze(r)&&t.Sn(r)&&(r=r.querySelector(`table`)),!ze(r))return null;yt(r,e._config,this.getFormatType());let[i]=B(this,null,null),a=new Map;for(let e of i)for(let t of e){let e=t.cell.getKey();a.has(e)||a.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}let o=new Set;for(let e of r.querySelectorAll(`:scope > tr > [data-temporary-table-cell-lexical-key]`)){let t=e.getAttribute(`data-temporary-table-cell-lexical-key`);if(t){let n=a.get(t);if(e.removeAttribute(`data-temporary-table-cell-lexical-key`),n){a.delete(t);for(let e=0;e<n.colSpan;e++)o.add(e+n.startColumn)}}}let s=r.querySelector(`:scope > colgroup`);if(s){let e=Array.from(r.querySelectorAll(`:scope > colgroup > col`)).filter((e,t)=>o.has(t));s.replaceChildren(...e)}let c=r.querySelectorAll(`:scope > tr`);if(c.length>0){let e=t.qt().createElement(`tbody`);for(let t of c)e.appendChild(t);r.append(e)}return r},element:!ze(r)&&t.Sn(r)?r.querySelector(`table`):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){let{rows:n,domRows:r}=t;for(let t=0;t<n;t++){let n=r[t];if(n!=null)for(let r=0;r<n.length;r++){let i=n[r];if(i==null)continue;let{elem:a}=i,o=_t(this,a);if(o!==null&&e.is(o))return{x:r,y:t}}}throw Error(`Cell not found in table.`)}getDOMCellFromCords(e,t,n){let{domRows:r}=n,i=r[t];return i==null?null:i[e<i.length?e:i.length-1]??null}getDOMCellFromCordsOrThrow(e,t,n){let r=this.getDOMCellFromCords(e,t,n);if(!r)throw Error(`Cell not found at cords.`);return r}getCellNodeFromCords(e,n,r){let i=this.getDOMCellFromCords(e,n,r);if(i==null)return null;let a=t.Yt(i.elem);return I(a)?a:null}getCellNodeFromCordsOrThrow(e,t,n){let r=this.getCellNodeFromCords(e,t,n);if(!r)throw Error(`Node at cords not TableCellNode.`);return r}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){let t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){let t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){let t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){let e=this.getFirstChild();if(!R(e))return 0;let t=0;return e.getChildren().forEach(e=>{I(e)&&(t+=e.getColSpan())}),t}};function wt(e,t){let n=e.getElementByKey(t.getKey());return n===null&&L(230),Qe(t,n)}function Tt(e){let t=Et();e.hasAttribute(`data-lexical-row-striping`)&&t.setRowStriping(!0),e.hasAttribute(`data-lexical-frozen-column`)&&t.setFrozenColumns(1),e.hasAttribute(`data-lexical-frozen-row`)&&t.setFrozenRows(1);let r=e.querySelector(`:scope > colgroup`);if(r){let e=[];for(let t of r.querySelectorAll(`:scope > col`)){let n=t.style.width||``;if(!j.test(n)&&(n=t.getAttribute(`width`)||``,!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>n.f(e,R),node:t}}function Et(){return t.o(new Ct)}function G(e){return e instanceof Ct}function Dt(e){R(e.getParent())?e.isEmpty()&&e.append(t.Ar()):e.remove()}function Ot(e){G(e.getParent())?n.w(e,I):e.remove()}function kt(e){n.w(e,R);let[r]=B(e,null,null),i=r.reduce((e,t)=>Math.max(e,t.length),0),a=e.getChildren();for(let e=0;e<r.length;++e){let n=a[e];if(!n)continue;R(n)||L(254,n.constructor.name,n.getType());let o=r[e].reduce((e,t)=>t?1+e:e,0);if(o!==i)for(let e=o;e<i;++e){let e=F();e.append(t.Ar()),n.append(e)}}let o=e.getColWidths(),s=e.getColumnCount();if(o&&o.length!==s){let t;if(s<o.length)t=o.slice(0,s);else if(o.length>0){let e=o[o.length-1];t=[...o,...Array(s-o.length).fill(e)]}e.setColWidths(t)}}function At(e){if(e.detail<3||!t.Ln(e.target))return!1;let n=t.Yt(e.target);if(n===null)return!1;let r=t.B(n,e=>t.vt(e)&&!e.isInline());return r!==null&&!!I(r.getParent())&&(r.select(0),!0)}function jt(){let e=t.tt();if(!t.bn(e))return!1;let n=ut(e.anchor.getNode());if(n===null)return!1;let r=t.Dr();if(!r.is(n.getParent())||r.getChildrenSize()!==1)return!1;let[i]=B(n,null,null);if(i.length===0||i[0].length===0)return!1;let a=i[0][0];if(!a||!a.cell)return!1;let o=i[i.length-1],s=o[o.length-1];return!s||!s.cell?!1:(t.En(Ae(n,a.cell,s.cell)),!0)}function Mt(e){return e.registerNodeTransform(N,e=>{if(e.getColSpan()>1||e.getRowSpan()>1){let[,,t]=V(e),[r]=z(t,e,e),i=r.length,a=r[0].length,o=t.getFirstChild();R(o)||L(175);let s=[];for(let e=0;e<i;e++){e!==0&&(o=o.getNextSibling(),R(o)||L(175));let t=null;for(let i=0;i<a;i++){let a=r[e][i],c=a.cell;if(a.startRow===e&&a.startColumn===i)t=c,s.push(c);else if(c.getColSpan()>1||c.getRowSpan()>1){I(c)||L(176);let e=F(c.__headerState);t===null?n.a(o,e):t.insertAfter(e)}}}for(let e of s)e.setColSpan(1),e.setRowSpan(1)}})}function Nt(e,n=!0){let r=new Ne,i=(t,i,a)=>{let o=U(t,a),s=Ke(t,o,e,n,r);r.observers.set(i,[s,o])};return t.Yn(Ge(e,r),e.registerCommand(t.F,()=>qe(r,e),3),e.registerMutationListener(Ct,t=>{e.read(`latest`,()=>{for(let[e,n]of t){let t=r.observers.get(e);if(n===`created`||n===`updated`){let{tableNode:n,tableElement:a}=Me(e);t===void 0?i(n,e,a):a!==t[1]&&(r.removeObserver(e),i(n,e,a))}else n===`destroyed`&&r.removeObserver(e)}})},{skipInitialization:!1}),()=>{r.removeAllObservers()})}function Pt(e,i){e.hasNodes([Ct])||L(255);let{hasNestedTables:a=r.B(!1)}=i??{};return t.Yn(e.registerCommand(te,e=>function({rows:e,columns:r,includeHeaders:i},a){let o=t.tt()||t.Y();if(!o||!t.bn(o)||!a&&ut(o.anchor.getNode()))return!1;let s=ae(Number(e),Number(r),i);n.n(s);let c=s.getFirstDescendant();return t.Jt(c)&&c.select(),!0}(e,a.peek()),0),e.registerCommand(t.Q,(r,i)=>e===i&&function(e,r){let{nodes:i,selection:a}=e;if(!i.some(e=>G(e)||n.g(e).some(e=>G(e.node)))){if(H(a)){let e=``,n=!1;for(let r of i){let i=t.vt(r)&&!r.isInline();e.length>0&&(i||n)&&(e+=`
5
+ `),e+=r.getTextContent(),n=i}return a.insertRawText(e),!0}return!1}let o=H(a),s=t.bn(a);return s&&t.B(a.anchor.getNode(),e=>I(e))!==null&&t.B(a.focus.getNode(),e=>I(e))!==null||o?i.length===1&&G(i[0])?Ee(i[0],a):!(s&&r.peek()&&!function(e){return!!(H(e)&&!e.focus.getNode().is(e.anchor.getNode())||t.bn(e)&&I(e.anchor.getNode())&&!e.anchor.getNode().is(e.focus.getNode()))}(a)):!1}(r,a),0),e.registerCommand(t.qn,jt,1),e.registerCommand(t.K,At,0),e.registerNodeTransform(Ct,kt),e.registerNodeTransform(ne,Ot),e.registerNodeTransform(N,Dt))}r.y.tag(`table`),r.y.tag(`tr`),r.y.tag(`td`,`th`);var Ft=(0,a.createContext)({});function It({children:e,revealFile:t}){let n=(0,a.useMemo)(()=>({revealFile:t}),[t]);return(0,o.jsx)(Ft.Provider,{value:n,children:e})}function Lt(){return(0,a.useContext)(Ft)}var Rt=(0,a.createContext)({});function zt({children:e,shortToVerseData:t,verseFullTextToListShorts:n,changeBibleKey:r}){let i=(0,a.useMemo)(()=>({shortToVerseData:t,verseFullTextToListShorts:n,changeBibleKey:r}),[t,n,r]);return(0,o.jsx)(Rt.Provider,{value:i,children:e})}function Bt(){return(0,a.useContext)(Rt)}var Vt=new Set([`concept`,`deity`,`group`,`life`,`month`,`person`,`place`,`supernatural`,`unknown`]);function Ht(e){let t=(e??``).trim().toLowerCase();return Vt.has(t)?t:`person`}function K(e){let t=q(e.kjvName);return t===``||t===e.name.trim()?null:t}function q(e){return typeof e==`string`?e.trim():``}function J(e){let t=q(e);return t===``?null:t}function Y(e){return Array.isArray(e)?e.map(q).filter(e=>e!==``):[]}function Ut(e){return typeof e==`number`&&Number.isFinite(e)?e:1/0}function Wt(e){return Array.isArray(e)?e:typeof e==`object`&&e?Object.values(e):[]}function Gt(e){return Array.isArray(e)?e.reduce((e,t)=>{if(typeof t!=`object`||!t)return e;let n=t,r=q(n.type);return r===``||typeof n.start!=`number`||typeof n.end!=`number`||e.push({type:r,start:n.start,end:n.end}),e},[]):[]}function Kt(e){return Array.isArray(e)?e.reduce((e,t)=>{if(typeof t!=`object`||!t)return e;let n=t,r=q(n.type),i=q(n.url);return r===``||i===``||e.push({type:r,url:i}),e},[]):[]}function qt(e){if(typeof e!=`object`||!e)return null;let{latitude:t,longitude:n}=e;return typeof t!=`number`||!Number.isFinite(t)||typeof n!=`number`||!Number.isFinite(n)?null:{latitude:t,longitude:n}}function Jt(e){if(typeof e!=`object`||!e)return null;let t=e,n=q(t.id),r=q(t.name);return n===``||n===`id`||r===``?null:{id:n,name:r,kjvName:J(t.kjvName),oldName:J(t.oldName),title:q(t.title),description:q(t.description),gender:q(t.gender),age:q(t.age),years:Gt(t.years),locations:Y(t.locations),spouses:Y(t.spouses),children:Y(t.children),parents:Y(t.parents),siblings:Y(t.siblings),cousin:Y(t.cousin),type:q(t.type),verses:Y(t.verses),links:Kt(t.links),wikipedia:J(t.wikipedia),matterRange:Ut(t.matterRange)}}function Yt(e){if(typeof e!=`object`||!e)return null;let t=e,n=q(t.id),r=q(t.name);return n===``||n===`id`||r===``?null:{id:n,name:r,kjvName:J(t.kjvName),oldName:J(t.oldName),title:q(t.title),description:q(t.description),type:q(t.type),relatedLocations:Y(t.relatedLocations),modernIdentification:J(t.modernIdentification),coordinates:qt(t.coordinates),verses:Y(t.verses),links:Kt(t.links),wikipedia:J(t.wikipedia),uncertainty:t.uncertainty===!0,matterRange:Ut(t.matterRange)}}function Xt(e){return Wt(e).reduce((e,t)=>{let n=Jt(t);return n!==null&&e.push(n),e},[])}function Zt(e){return Wt(e).reduce((e,t)=>{let n=Yt(t);return n!==null&&e.push(n),e},[])}function Qt(e){return typeof e!=`object`||!e?{}:Object.entries(e).reduce((e,[t,n])=>{let r=t.trim(),i=Y(n);return r!==``&&i.length>0&&(e[r]=i),e},{})}var $t=20,en=200;function tn(e,t){return e.matterRange===t.matterRange?e.name.localeCompare(t.name):e.matterRange-t.matterRange}function nn(e,t){return e===t?0:e.startsWith(t)?1:e.includes(t)?2:3}function rn(e,t,n){let r=nn(e,n);return t===``?r:Math.min(r,nn(t,n))}function an(e,t){let n=[...e].sort(tn),r=new Map,i=new Map,a=[],o=[],s=[];for(let e of n){r.has(e.id)||r.set(e.id,e);let t=i.get(e.name);t===void 0?i.set(e.name,[e]):t.push(e);let n=e.name.toLowerCase(),c=e.kjvName===null||e.kjvName===e.name?``:e.kjvName.toLowerCase();o.push(n),s.push(c),a.push([n,c,e.oldName?.toLowerCase()??``].filter(e=>e!==``).join(` `))}return{sorted:n,byId:r,byName:i,searchText:a,nameLower:o,kjvNameLower:s,verseRecordIds:t,queryCache:new Map}}var on=class{dataMap;currentDefaultLang;currentStyle;indexes=new Map;constructor(e,t,n,r){if(e[t]===void 0)throw Error(`Default language ${t} not found in ${n}`);this.currentDefaultLang=t,this.currentStyle=r,this.dataMap=e}get style(){return this.currentStyle}set style(e){this.currentStyle=e}get defaultLang(){return this.currentDefaultLang}set defaultLang(e){if(this.dataMap[e]===void 0)throw Error(`Language ${e} not found in this lookup manager`);this.currentDefaultLang=e}get langs(){return Object.keys(this.dataMap)}getRecordCount(e){return this.getIndex(e).sorted.length}getAllRecords(e){return[...this.getIndex(e).sorted]}getRecordById(e,t){return this.getIndex(t).byId.get(e.trim())??null}getRecordsByIds(e,t){let{byId:n}=this.getIndex(t),r=new Set;return e.reduce((e,t)=>{let i=t.trim();if(r.has(i))return e;r.add(i);let a=n.get(i);return a!==void 0&&e.push(a),e},[])}getRecordsByName(e,t){return[...this.getIndex(t).byName.get(e.trim())??[]]}searchRecords(e,t={}){let n=this.getIndex(t.lang),r=e.trim().toLowerCase(),i=r===``?n.sorted:this.getRankedMatches(n,r);return t.limit===void 0?[...i]:i.slice(0,Math.max(0,t.limit))}paginateRecords(e,t,n){let r=Math.max(1,Math.trunc(n.pageSize??$t)),i=e.length,a=Math.max(1,Math.ceil(i/r)),o=Math.min(a,Math.max(1,Math.trunc(n.page??1))),s=(o-1)*r;return{lang:t,totalRecords:i,page:o,totalPages:a,pageSize:r,records:e.slice(s,s+r)}}searchRecordsByShortVerse(e,t){let n=this.getIndex(t).verseRecordIds[e.trim()];return n===void 0?[]:this.getRecordsByIds(n,t).sort(tn)}resolveLang(e){return e!==void 0&&this.dataMap[e]!==void 0?e:this.currentDefaultLang}getIndex(e){let t=this.resolveLang(e),n=this.indexes.get(t);if(n!==void 0)return n;let r=this.dataMap[t],i=an(r.records,this.getVerseRecordIds(r));return this.indexes.set(t,i),i}getRankedMatches(e,t){let n=e.queryCache.get(t);if(n!==void 0)return n;let r=[];for(let n=0;n<e.sorted.length;n+=1)e.searchText[n].includes(t)&&r.push({record:e.sorted[n],rank:rn(e.nameLower[n],e.kjvNameLower[n],t)});r.sort((e,t)=>e.rank-t.rank);let i=r.map(e=>e.record);return e.queryCache.size>=en&&e.queryCache.clear(),e.queryCache.set(t,i),i}},sn=class e extends on{nameTypeCounts=new Map;constructor(e,t,n){super(e,t,`dataNamesMap`,n)}static fromRawDataset(t,n,r){let i=Object.entries(t).reduce((e,[t,n])=>{let r=typeof n==`object`&&n?n:{};return e[t]={records:Xt(r.namesMap??n),versePersonsMap:Qt(r.versePersonsMap)},e},{});return new e(i,n,r)}static createEmpty(){return new e({en:{records:[]}},`en`)}getNameTypes(e){let t=this.resolveLang(e),n=this.nameTypeCounts.get(t);if(n!==void 0)return n;let r=new Map;for(let e of this.getIndex(t).sorted){let t=Ht(e.type);r.set(t,(r.get(t)??0)+1)}let i=Array.from(r.entries()).map(([e,t])=>({type:e,count:t})).sort((e,t)=>e.count===t.count?e.type.localeCompare(t.type):t.count-e.count);return this.nameTypeCounts.set(t,i),i}get nameTypes(){return this.getNameTypes()}searchNames(e,t={}){let{type:n,limit:r,...i}=t;if(n===void 0)return this.searchRecords(e,t);let a=this.searchRecords(e,i).filter(e=>Ht(e.type)===n);return r===void 0?a:a.slice(0,Math.max(0,r))}searchNamesPagination(e={}){return this.paginateRecords(this.searchNames(e.query??``,{lang:e.lang,type:e.type}),this.resolveLang(e.lang),e)}searchByShortVerse(e,t){return this.searchRecordsByShortVerse(e,t)}getVerseRecordIds(e){return e.versePersonsMap??{}}},cn=class e extends on{constructor(e,t,n){super(e,t,`dataLocationsMap`,n)}static fromRawDataset(t,n,r){let i=Object.entries(t).reduce((e,[t,n])=>{let r=typeof n==`object`&&n?n:{};return e[t]={records:Zt(r.locationsMap??r.namesMap??n),verseLocationsMap:Qt(r.verseLocationsMap)},e},{});return new e(i,n,r)}static createEmpty(){return new e({en:{records:[]}},`en`)}searchLocations(e,t={}){return this.searchRecords(e,t)}searchLocationsPagination(e={}){return this.paginateRecords(this.searchLocations(e.query??``,{lang:e.lang}),this.resolveLang(e.lang),e)}searchByShortVerse(e,t){return this.searchRecordsByShortVerse(e,t)}getVerseRecordIds(e){return e.verseLocationsMap??{}}},ln=sn.createEmpty(),un=cn.createEmpty(),dn=(0,a.createContext)({locationsLookupManager:un,namesLookupManager:ln});function fn({children:e,locationsLookupManager:t,namesLookupManager:n}){let r=(0,a.useMemo)(()=>({locationsLookupManager:t??un,namesLookupManager:n??ln}),[t,n]);return(0,o.jsx)(dn.Provider,{value:r,children:e})}function pn(){return(0,a.useContext)(dn)}function mn(){return(0,a.useContext)(dn).namesLookupManager}function hn(){return(0,a.useContext)(dn).locationsLookupManager}var gn=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),_n=class e extends t.m{__url;__target;__rel;__title;static getType(){return`link`}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){let n=t.qt().createElement(`a`);return this.updateLinkDOM(null,n,e),t.Vr(n,e.theme.link),n}updateLinkDOM(e,n,r){if(t.un(n)){e&&e.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(let t of[`target`,`rel`,`title`]){let r=`__${t}`,i=this[r];e&&e[r]===i||(i?n[t]=i:n.removeAttribute(t))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:xn,priority:1})}}static importJSON(e){return Sn().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){let t=e;e=kn(e);try{let t=new URL(kn(e));if(!gn.has(t.protocol))return`about:blank`}catch{let e=t.replace(/[\u0000-\u001F\u007F\s]/g,``).match(/^([a-z][a-z0-9+.-]*):/i);if(e!=null&&!gn.has(`${e[1].toLowerCase()}:`))return`about:blank`}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){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,n=!0){let r=t.ii(this);return this.insertAfter(r,n),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,r){if(!t.bn(n))return!1;let i=n.anchor.getNode(),a=n.focus.getNode();return(this.is(i)||this.isParentOf(i))&&(this.is(a)||this.isParentOf(a))&&n.getTextContent().length>0}isEmailURI(){return this.__url.startsWith(`mailto:`)}isWebSiteURI(){return this.__url.startsWith(`https://`)||this.__url.startsWith(`http://`)}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function vn(e){let n=t.Gt(e,`next`);return[n,n.getFlipped()]}function yn(e,n){for(let r of n)if(r.origin.isAttached()){t.Ct(e,t.wr(r));return}}function bn(e){let n=t.tt(),r=null,i=null;function a(){t.bn(n)&&(yn(n.anchor,r),yn(n.focus,i),t.R(n))}t.bn(n)&&(r=vn(n.anchor),i=vn(n.focus));let o=!1;for(let n of t.Z(e,`next`)){let r=n.origin;if(t.vt(r)&&!r.isInline()){let i=r.getChildren();if(i.length>0){let n=t.ii(e);n.append(...i),r.append(n),o=!0}t.cn(r,t.cr(n),{$shouldSplit:()=>!1})}}function s(e,n,r){let[i,a]=e,o=e=>t.Hr(e)&&e.origin.is(n);if(!o(i)&&!o(a))return e;let s=t.wr(t.Z(r,`next`));return[s,s.getFlipped()]}if(e.isAttached()){let t=e.getPreviousSibling();if(X(t)&&t.shouldMergeAdjacentLink(e))return r&&=s(r,t,e),i&&=s(i,t,e),t.append(...e.getChildren()),e.remove(),void a();let n=e.getNextSibling();X(n)&&e.shouldMergeAdjacentLink(n)&&(r&&=s(r,e,n),i&&=s(i,e,n),e.append(...n.getChildren()),n.remove(),o=!0)}if(o){if(!e.canBeEmpty()&&e.isEmpty()){let t=e.getParent();e.remove(),t&&t.isEmpty()&&t.remove()}a()}}function xn(e){let n=null;if(t.un(e)){let t=e.textContent;(t!==null&&t!==``||e.children.length>0)&&(n=Sn(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:n}}function Sn(e=``,n){return t.o(new _n(e,n))}function X(e){return e instanceof _n}var Cn=class e extends _n{__isUnlinked;constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}static getType(){return`autolink`}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?t.qt().createElement(`span`):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return wn().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){let n=wn(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}};function wn(e=``,n){return t.o(new Cn(e,n))}function Z(e){return e instanceof Cn}var Tn=t.x(`TOGGLE_LINK_COMMAND`);function En(e,n){if(e.type===`element`){let r=e.getNode();return t.vt(r)||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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),r.getChildren()[e.offset+n]||null}return null}function Dn(e,n={}){let r;if(e&&typeof e==`object`){let{url:t,...i}=e;r=t,n={...i,...n}}else r=e;let{target:i,title:a}=n,o=n.rel===void 0?`noreferrer`:n.rel,s=t.tt();if(s===null||!t.bn(s)&&!t.Fr(s))return;if(t.Fr(s)){let e=s.getNodes();if(e.length===0)return;e.forEach(e=>{if(r===null){let n=t.B(e,e=>!Z(e)&&X(e));n&&(n.insertBefore(e),n.getChildren().length===0&&n.remove())}else{let n=t.B(e,e=>!Z(e)&&X(e));if(n)n.setURL(r),i!==void 0&&n.setTarget(i),o!==void 0&&n.setRel(o);else{let t=Sn(r,{rel:o,target:i});e.insertBefore(t),t.append(e)}}});return}if(s.isCollapsed()&&r===null)for(let e of s.getNodes()){let n=t.B(e,e=>!Z(e)&&X(e));n!==null&&(n.getParentOrThrow().splice(n.getIndexWithinParent(),0,n.getChildren()),n.remove());return}let c=s.extract();if(r===null){let e=new Set;c.forEach(n=>{let r=t.B(n,e=>!Z(e)&&X(e));if(r!==null){let n=r.getKey();if(e.has(n))return;(function(e,n){let r=new Set(n.filter(t=>e.isParentOf(t)).map(e=>e.getKey())),i=e.getChildren(),a=i=>r.has(i.getKey())||t.vt(i)&&n.some(t=>e.isParentOf(t)&&i.isParentOf(t)),o=i.filter(a);if(o.length===i.length)return i.forEach(t=>e.insertBefore(t)),void e.remove();let s=i.findIndex(a),c=i.findLastIndex(a),l=s===0,u=c===i.length-1;if(l)o.forEach(t=>e.insertBefore(t));else if(u)for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);else{for(let t=o.length-1;t>=0;t--)e.insertAfter(o[t]);let n=i.slice(c+1);if(n.length>0){let r=t.ii(e);o[o.length-1].insertAfter(r),n.forEach(e=>r.append(e))}}})(r,c),e.add(n)}});return}let l=new Set,u=e=>{l.has(e.getKey())||(l.add(e.getKey()),e.setURL(r),i!==void 0&&e.setTarget(i),o!==void 0&&e.setRel(o),a!==void 0&&e.setTitle(a))};if(c.length===1){let e=c[0],n=t.B(e,X);if(n!==null)return u(n)}(function(e){let n=t.tt();if(!t.bn(n))return e();let r=t.R(n),i=r.isBackward(),a=En(r.anchor,i?-1:0),o=En(r.focus,i?0:-1);if(e(),a||o){let e=t.tt();if(t.bn(e)){let n=e.clone();if(a){let e=a.getParent();e&&n.anchor.set(e.getKey(),a.getIndexWithinParent()+ +!!i,`element`)}if(o){let e=o.getParent();e&&n.focus.set(e.getKey(),o.getIndexWithinParent()+ +!i,`element`)}t.En(t.R(n))}}})(()=>{let e=null;for(let n of c){if(!n.isAttached())continue;let s=t.B(n,X);if(s){u(s);continue}if(t.vt(n)){if(!n.isInline())continue;if(X(n)){if(!(Z(n)||e!==null&&e.getParentOrThrow().isParentOf(n))){u(n),e=n;continue}for(let e of n.getChildren())n.insertBefore(e);n.remove();continue}}let c=n.getPreviousSibling();X(c)&&c.is(e)?c.append(n):(e=Sn(r,{rel:o,target:i,title:a}),n.insertAfter(e),e.append(n))}})}var On=/^\+?[0-9\s()-]{5,}$/;function kn(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:On.test(e)?`tel:${e}`:`https://${e}`}r.y.tag(`a`);function An(e,i){return t.Yn(e.registerNodeTransform(_n,bn),e.registerCommand(Tn,e=>{let t=i.validateUrl.peek(),n=i.attributes.peek();if(e===null)return Dn(null),!0;if(typeof e==`string`)return!(t!==void 0&&!t(e))&&(Dn(e,n),!0);{let{url:t,target:r,rel:i,title:a}=e;return Dn(t,{...n,rel:i,target:r,title:a}),!0}},0),r.H(()=>{let r=i.validateUrl.value;if(!r)return;let a=i.attributes.value;return e.registerCommand(t.Wn,i=>{let o=t.tt();if(!t.bn(o)||o.isCollapsed()||!n.s(i,ClipboardEvent)||i.clipboardData===null)return!1;let s=i.clipboardData.getData(`text`);return r(s)?!o.getNodes().some(e=>t.vt(e)||t.Jt(e)&&!e.isSimpleText())&&(e.dispatchCommand(Tn,{...a,url:s}),i.preventDefault(),!0):!1},1)}))}function jn(e,n,r={}){let i=r=>{let i=r.target;if(!t.Ln(i))return;let a=t.a(i);if(a===null)return;let o=null,s=null,c=!1;if(a.update(()=>{let e=t.Yt(i);if(e!==null){let r=t.B(e,t.vt);if(!n.disabled.peek())if(X(r))c=Z(r)&&r.getIsUnlinked(),o=r.sanitizeUrl(r.getURL()),s=r.getTarget();else{let e=function(e,t){let n=e;for(;n!=null;){if(t(n))return n;n=n.parentNode}return null}(i,t.un);e!==null&&(o=e.href,s=e.target)}}}),o===null||o===``||c)return;let l=e.read(`latest`,t.tt);if(t.bn(l)&&!l.isCollapsed())return void r.preventDefault();let u=r.type===`auxclick`&&r.button===1;window.open(o,n.newTab.peek()||u||r.metaKey||r.ctrlKey||s===`_blank`?`_blank`:`_self`),r.preventDefault()},a=e=>{e.button===1&&i(e)};return e.registerRootListener(e=>{if(e)return t.vn(e,{click:i,mouseup:a},r)})}function Mn(e,t=e=>e){return n=>{let r=e.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function Nn(e,t){for(let n=0;n<t.length;n++){let r=t[n](e);if(r)return r}return null}var Pn=/[.,;\s]/;function Fn(e,t){return t.test(e)}function In(e,t){return Fn(e[e.length-1],t)}function Ln(e,t){return Fn(e[0],t)}function Rn(e,n){let r=e.getPreviousSibling();return t.vt(r)&&(r=r.getLastDescendant()),r===null||t._r(r)||t.Jt(r)&&In(r.getTextContent(),n)}function zn(e,n){let r=e.getNextSibling();return t.vt(r)&&(r=r.getFirstDescendant()),r===null||t._r(r)||t.Jt(r)&&Ln(r.getTextContent(),n)}function Bn(e,t,n,r,i){return(e>0?Fn(r[e-1],n):Rn(i[0],n))?t<r.length?Fn(r[t],n):zn(i[i.length-1],n):!1}function Vn(e,t,n){let r=[],i=[],a=[],o=0,s=0,c=[...e];for(;c.length>0;){let e=c[0],l=e.getTextContent().length,u=s;s+l<=t?(r.push(e),o+=l):u>=n?a.push(e):i.push(e),s+=l,c.shift()}return[o,r,i,a]}function Hn(e,n,r,i){let a=wn(i.url,i.attributes);if(e.length===1){let o,s=e[0];n===0?[o,s]=s.splitText(r):[,o,s]=s.splitText(n,r);let c=t.D(i.text);return c.setFormat(o.getFormat()),c.setDetail(o.getDetail()),c.setStyle(o.getStyle()),a.append(c),o.replace(a),s}if(e.length>1){let i=e[0],o,s=i.getTextContent().length;n===0?o=i:[,o]=i.splitText(n);let c=[],l;for(let t=1;t<e.length;t++){let n=e[t],i=n.getTextContent().length,a=s;if(a<r)if(s+i<=r)c.push(n);else{let[e,t]=n.splitText(r-a);c.push(e),l=t}s+=i}let u=t.tt(),d=u?u.getNodes().find(t.Jt):void 0,f=t.D(o.getTextContent());return f.setFormat(o.getFormat()),f.setDetail(o.getDetail()),f.setStyle(o.getStyle()),a.append(f,...c),d&&d===o&&(t.bn(u)?f.select(u.anchor.offset,u.focus.offset):t.Fr(u)&&f.select(0,f.getTextContent().length)),o.replace(a),l}}function Un(e,n,r,i){let a=e.getChildren(),o=a.length;for(let n=0;n<o;n++){let i=a[n];if(!t.Jt(i)||!i.isSimpleText())return Wn(e),void r(null,e.getURL())}let s=e.getTextContent(),c=Nn(s,n);if(c===null||c.text!==s||!Rn(e,i)||!zn(e,i))return Wn(e),void r(null,e.getURL());let l=e.getURL();if(l!==c.url&&(e.setURL(c.url),r(c.url,l)),c.attributes){let t=e.getRel();t!==c.attributes.rel&&(e.setRel(c.attributes.rel||null),r(c.attributes.rel||null,t));let n=e.getTarget();n!==c.attributes.target&&(e.setTarget(c.attributes.target||null),r(c.attributes.target||null,n))}}function Wn(e){let t=e.getChildren();for(let n=t.length-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map(e=>e.getLatest())}var Gn={changeHandlers:[],excludeParents:[],matchers:[],separatorRegex:Pn};function Kn(e,n=Gn){let{matchers:r,changeHandlers:i,excludeParents:a,separatorRegex:o=Pn}=n,s=(e,t)=>{for(let n of i)n(e,t)};return t.Yn(e.registerNodeTransform(t.Wt,e=>{let n=e.getParentOrThrow(),i=e.getPreviousSibling();Z(n)?Un(n,r,s,o):!X(n)&&!a.some(e=>e(n))&&(e.isSimpleText()&&(Ln(e.getTextContent(),o)||!Z(i))&&(function(e,t,n,r){for(let t of e){let e=t.getParent();if(Z(e)&&!e.getIsUnlinked())return}let i=[...e],a=i.map(e=>e.getTextContent()).join(``),o,s=a,c=0;for(;(o=Nn(s,t))&&o!==null;){let e=o.index,t=e+o.length;if(Bn(c+e,c+t,r,a,i)){let[r,,a,l]=Vn(i,c+e,c+t),u=!1;for(let e of a){let t=e.getParent();if(Z(t)&&!t.getIsUnlinked()){u=!0;break}}if(u){c+=t,s=s.substring(t);continue}let d=Hn(a,c+e-r,c+t-r,o);i=d?[d,...l]:l,n(o.url,null),c=0}else c+=t;s=s.substring(t)}})(function(e){let n=[e],r=e.getNextSibling();for(;r!==null&&t.Jt(r)&&r.isSimpleText()&&(n.push(r),!/[\s]/.test(r.getTextContent()));)r=r.getNextSibling();return n}(e),r,s,o),(function(e,t,n,r){let i=e.getParent(),a=e.getPreviousSibling(),o=e.getNextSibling(),s=e.getTextContent();if(!Z(i)||i.getIsUnlinked()){if(Z(a)&&!a.getIsUnlinked()&&a.is(e.getPreviousSibling())&&e.getParent()===a.getParent()){if(!Ln(s,r))return Wn(a),void n(null,a.getURL());if(c=s,a.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(c):/^\.[a-zA-Z0-9]{1,}/.test(c)){let i=a.getTextContent()+s,o=Nn(i,t);o!==null&&o.text===i&&(a.append(e),Un(a,t,n,r),n(null,a.getURL()))}}var c;!Z(o)||o.getIsUnlinked()||In(s,r)||o.is(e.getNextSibling())&&e.getParent()===o.getParent()&&(Wn(o),n(null,o.getURL()))}})(e,r,s,o))}),e.registerCommand(Tn,e=>{let n=t.tt();return e!==null||!t.bn(n)||n.extract().forEach(e=>{let t=e.getParent();Z(t)&&(t.setIsUnlinked(!t.getIsUnlinked()),t.markDirty())}),!1},1))}function qn(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let 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.`)}var Jn=t.ar?a.useLayoutEffect:a.useEffect;function Yn({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,a.useState)(()=>e.getDecorators());return Jn(()=>e.registerDecoratorListener(e=>{(0,s.flushSync)(()=>{r(e)})}),[e]),(0,a.useEffect)(()=>{r(e.getDecorators())},[e]),(0,a.useMemo)(()=>{let r=[],i=Object.keys(n);for(let c=0;c<i.length;c++){let l=i[c],u=(0,o.jsx)(t,{onError:t=>e._onError(t),children:(0,o.jsx)(a.Suspense,{fallback:null,children:n[l]})}),d=e.getElementByKey(l);d!==null&&r.push((0,s.createPortal)(u,d,l))}return r},[t,n,e])}(e,t)}function Xn({editor:e,ErrorBoundary:t}){return function(e){let t=r.K.maybeFromEditor(e);if(t&&t.hasExtensionByName(r.M.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&qn(320,e);return!0}return!1}(e)?null:(0,o.jsx)(Yn,{editor:e,ErrorBoundary:t})}function Zn(e){return e.read(`latest`,r.I(e.isComposing()))}function Qn({contentEditable:e,placeholder:n=null,ErrorBoundary:i}){let[a]=t.oi();return function(e){Jn(()=>t.Yn(A(e),r.s(e)),[e])}(a),(0,o.jsxs)(o.Fragment,{children:[e,(0,o.jsx)($n,{content:n}),(0,o.jsx)(Xn,{editor:a,ErrorBoundary:i})]})}function $n({content:e}){let[n]=t.oi(),r=function(e){let[n,r]=(0,a.useState)(()=>Zn(e));return Jn(()=>{function n(){let t=Zn(e);r(t)}return n(),t.Yn(e.registerUpdateListener(()=>{n()}),e.registerEditableListener(()=>{n()}))},[e]),n}(n),o=i.t();return r?typeof e==`function`?e(o):e:null}var er=`bible-note:open-mention-bible-verse-advanced-panel`;function tr(e){window.dispatchEvent(new CustomEvent(er,{detail:e}))}var nr=`bible-note:open-mention-location-advanced-panel`;function rr(e){window.dispatchEvent(new CustomEvent(nr,{detail:e}))}var ir=`bible-note:open-mention-person-advanced-panel`;function ar(e){window.dispatchEvent(new CustomEvent(ir,{detail:e}))}var or=/\[([^\]]+)\]\((?:name-id|location-id|verse-key|chapter-key|book-key):\/\/[^)]*\)/g;function sr(e){return e.replace(or,`$1`)}var cr=/\[([^\]]+)\]\((name-id|location-id|verse-key|chapter-key|book-key):\/\/([^)]*)\)/g;function lr(e){let t=[],n=new RegExp(cr),r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push({kind:`text`,text:e.slice(r,i.index)});let a=i[1],o=i[2],s=i[3].trim();s===``||o===`chapter-key`||o===`book-key`?t.push({kind:`text`,text:a}):o===`name-id`?t.push({kind:`name`,label:a,target:s}):o===`location-id`?t.push({kind:`location`,label:a,target:s}):t.push({kind:`verse`,label:a,target:s}),r=n.lastIndex}return r<e.length&&t.push({kind:`text`,text:e.slice(r)}),t}function ur({locationsLookupManager:e,namesLookupManager:t},n,r){if(n.kind===`name`){ar({anchorElement:r,id:n.target,name:t.getRecordById(n.target)?.name??n.label});return}if(n.kind===`location`){rr({anchorElement:r,id:n.target,name:e.getRecordById(n.target)?.name??n.label});return}tr({anchorElement:r,shortVerse:n.target})}function Q({value:e}){let t=pn();return(0,o.jsx)(o.Fragment,{children:(0,a.useMemo)(()=>lr(e),[e]).map((e,n)=>e.kind===`text`?(0,o.jsx)(a.Fragment,{children:e.text},n):(0,o.jsx)(`button`,{className:`mention-reference-link mention-reference-link--${e.kind}`,type:`button`,onClick:n=>{n.preventDefault(),n.stopPropagation(),ur(t,e,n.currentTarget)},children:e.label},n))})}var dr=320,fr=120,pr=220,mr=10,hr=22,gr=32,_r=1e3;function vr(){return _r+=1,_r}function yr(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function br(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}async function xr(e,t){if(typeof ClipboardItem<`u`&&navigator.clipboard!==void 0&&typeof navigator.clipboard.write==`function`)try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:`text/html`}),"text/plain":new Blob([e],{type:`text/plain`})})]);return}catch{}if(navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}br(e)}function Sr(e,t){let n=t.getBoundingClientRect();if(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)return!1;let r=window.getComputedStyle(t),i=Number.parseFloat(r.paddingLeft),a=Number.isFinite(i)&&i>0?Math.min(i+6,gr):hr;return e.clientX<=n.left+a}function Cr(){return{bottom:window.innerHeight,height:window.innerHeight,left:0,right:window.innerWidth,top:0,width:window.innerWidth}}function wr(e){let t=e?.closest(`.editor-container`)??document.querySelector(`.editor-container`);if(t instanceof HTMLElement){let e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return e}return Cr()}function Tr(e,t,n){return Math.min(Math.max(e,t),n)}function Er(e,t){return r.n(e??t?.closest(`.editor-zoom-surface`)??document.querySelector(`.editor-zoom-surface`))}var Dr=420,Or=10,kr=12;function Ar(e,t){let n=Er(null,e),r=e.getBoundingClientRect(),i=t*n,a=Math.min(Dr*n,window.innerWidth-kr*2),o=Math.max(kr,window.innerWidth-a-kr),s=Math.min(Math.max(r.left,kr),o),c=window.innerHeight-r.bottom-Or-kr,l=r.top-Or-kr,u=c<i&&l>c,d=u?r.top-Or:r.bottom+Or,f=Math.max(kr,u?l:c);return{left:s/n,maxHeight:f/n,maxWidth:a/n,position:`fixed`,top:d/n,transform:u?`translateY(-100%)`:void 0,zoom:n}}function jr(e,t,n){let r=wr(n),i=Er(t,n),a=Math.max(pr,t?.offsetWidth??dr)*i,o=Math.max(96,t?.offsetHeight??fr)*i,s=Math.max(r.left,r.right-Math.min(a,r.width)),c=Math.max(r.top,r.bottom-Math.min(o,r.height));return{left:Tr(e.left,r.left,s),top:Tr(e.top,r.top,c)}}function Mr(e){let t=wr(e),n=fr*Er(null,e),r=e.getBoundingClientRect(),i=r.left,a=r.bottom+mr,o=r.top-n-mr;return jr({left:i,top:a+n>t.bottom&&o>=t.top?o:a},null,e)}function Nr(e){let t=q(e);return t===``?``:t.toLowerCase()===`unknown`?`Unknown`:t}function Pr(e){let t=q(e);return t!==``&&t.toLowerCase()!==`unknown`}function Fr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ir(e){return`${e.type}: ${e.start} to ${e.end}`}function Lr(e){let t=new Map;return e.links.forEach(e=>{t.set(e.url,e)}),e.wikipedia!==null&&!t.has(e.wikipedia)&&t.set(e.wikipedia,{type:`wikipedia`,url:e.wikipedia}),Array.from(t.values())}function Rr(e,t){let n=e.getRecordById(t);if(n!==null)return n;let r=e.getRecordsByName(t);return r.length===1?r[0]:null}function zr(e,t){return t.map(t=>e.getRecordById(t)?.name??t)}function Br(e,t){return t.map(t=>Rr(e,t)?.name??t)}function Vr(e){return e.map(e=>`${Fr(e.type)}: ${e.url}`).join(`, `)}async function Hr(e,t){return t===void 0?[...e]:Promise.all(e.map(e=>t(e)))}function Ur(e,t){for(let[n,r]of t)r.length>0&&e.push([n,r.join(`, `)])}function Wr(e){return e.filter(e=>e!==``&&e.toLowerCase()!==`unknown`)}async function Gr({locationsLookupManager:e,namesLookupManager:t},n,r){let i=[],a=K(n);a!==null&&i.push([`KJV name`,a]),Pr(n.oldName)&&i.push([`Also called`,Nr(n.oldName)]),n.years.length>0&&i.push([`Years`,n.years.map(Ir).join(`, `)]),Ur(i,[[`Locations`,Br(e,n.locations)],[`Parents`,zr(t,n.parents)],[`Spouses`,zr(t,n.spouses)],[`Children`,zr(t,n.children)],[`Siblings`,zr(t,n.siblings)],[`Cousins`,zr(t,n.cousin)],[`Verses`,await Hr(n.verses,r)]]);let o=Lr(n);return o.length>0&&i.push([`Links`,Vr(o)]),{name:n.name,title:sr(n.title),description:sr(n.description),facts:Wr([n.type,n.gender,n.age]),detailRows:i}}async function Kr(e,t,n){let r=[],i=K(t);i!==null&&r.push([`KJV name`,i]),Pr(t.oldName)&&r.push([`Also called`,Nr(t.oldName)]),Pr(t.modernIdentification)&&r.push([`Modern identification`,Nr(t.modernIdentification)]),Ur(r,[[`Related locations`,Br(e,t.relatedLocations)],[`Verses`,await Hr(t.verses,n)]]);let a=Lr(t);return a.length>0&&r.push([`Links`,Vr(a)]),t.coordinates!==null&&r.push([`Coordinates`,`${t.coordinates.latitude}, ${t.coordinates.longitude}`]),{name:t.name,title:sr(t.title),description:sr(t.description),facts:Wr([t.type]),detailRows:r}}function qr(e){let t=[e.name],n=[`<p><strong>${yr(e.name)}</strong></p>`];if(e.title!==``&&(t.push(e.title),n.push(`<p><em>${yr(e.title)}</em></p>`)),e.description!==``&&(t.push(e.description),n.push(`<p>${yr(e.description)}</p>`)),e.facts.length>0){let r=e.facts.join(`, `);t.push(r),n.push(`<p>${yr(r)}</p>`)}return e.detailRows.length>0&&(t.push(e.detailRows.map(([e,t])=>`${e}: ${t}`).join(`
6
6
  `)),n.push(`<p>`+e.detailRows.map(([e,t])=>`<strong>${yr(e)}:</strong> ${yr(t)}`).join(`<br />`)+`</p>`)),{plainText:t.join(`
7
7
 
8
- `),html:n.join(``)}}var Jr=class e extends t.Wt{__className;static getType(){return`emoji`}static clone(t){return new e(t.__className,t.__text,t.__key)}constructor(e,t,n){super(t,n),this.__className=e}createDOM(e){let t=document.createElement(`span`),n=super.createDOM(e);return t.className=this.__className,n.className=`emoji-inner`,t.appendChild(n),t}updateDOM(e,t,n){let r=t.firstChild;return r===null?!0:(super.updateDOM(e,r,n),!1)}static importJSON(e){return Yr(e.className,e.text).updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),className:this.getClassName()}}getClassName(){return this.getLatest().__className}};function Yr(e,n){return t.o(new Jr(e,n).setMode(`token`))}var Xr=class e extends t.Wt{static getType(){return`keyword`}static clone(t){return new e(t.__text,t.__key)}static importJSON(e){return Zr().updateFromJSON(e)}createDOM(e){let t=super.createDOM(e);return t.style.cursor=`default`,t.className=`keyword`,t}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}isTextEntity(){return!0}};function Zr(e=``){return t.o(new Xr(e))}function Qr(e){return e===`mention`||e===`location`||e===`bible-verse`?e:e===`hashtag`?`location`:void 0}function $r(e,t,n){let r=Qr(n);return r===void 0?e.startsWith(`#`)||t.startsWith(`#`)?`location`:e.startsWith(`^`)||t.startsWith(`^`)?`bible-verse`:`mention`:r}function ei(e,t){return t===`location`&&e.startsWith(`#`)||t===`bible-verse`&&e.startsWith(`^`)?e.slice(1):e}function ti(e,t,n){return n===`location`&&e.startsWith(`#`)?t:n===`bible-verse`&&e.startsWith(`^`)?e.slice(1):e}function ni(e,t,n,r,i,a){e.setAttribute(`data-lexical-mention`,`true`),e.setAttribute(`data-lexical-mention-kind`,n),r===null?e.removeAttribute(`data-lexical-mention-id`):e.setAttribute(`data-lexical-mention-id`,r),i===null?e.removeAttribute(`data-lexical-mention-data`):e.setAttribute(`data-lexical-mention-data`,i),a?e.setAttribute(`data-lexical-mention-name`,t):e.removeAttribute(`data-lexical-mention-name`)}function ri(e){let t=e.textContent,n=e.getAttribute(`data-lexical-mention-data`),r=e.getAttribute(`data-lexical-mention-id`),i=e.getAttribute(`data-lexical-mention-name`),a=e.getAttribute(`data-lexical-mention-kind`);if(t!==null){let e=$r(typeof i==`string`?i:t,t,a===`mention`||a===`location`||a===`bible-verse`||a===`hashtag`?a:void 0),o=ei(typeof i==`string`?i:t,e);return{node:ai(o,ti(t,o,e),r,e,n)}}return null}var ii=class e extends t.Wt{__mention;__mentionData;__mentionId;__mentionKind;static getType(){return`mention`}static clone(t){return new e(t.__mention,t.__text,t.__mentionId,t.__mentionKind,t.__mentionData,t.__key)}static importJSON(e){let t=$r(e.mentionName,e.text,e.mentionKind),n=ei(e.mentionName,t),r=ti(e.text,n,t);return ai(n,r,e.mentionId??null,t,e.mentionData??null).updateFromJSON({...e,mentionKind:t,mentionName:n,text:r})}updateFromJSON(e){let t=$r(e.mentionName,e.text,e.mentionKind),n=ei(e.mentionName,t),r=ti(e.text,n,t),i=super.updateFromJSON({...e,text:r});return i.__mention=n,i.__mentionData=e.mentionData??null,i.__mentionId=e.mentionId??null,i.__mentionKind=t,i}constructor(e,t,n,r,i,a){let o=$r(e,t??e,r),s=ei(e,o),c=ti(t??e,s,o);super(c,a),this.__mention=s,this.__mentionData=i??null,this.__mentionId=n??null,this.__mentionKind=o}exportJSON(){return{...super.exportJSON(),mentionData:this.__mentionData,mentionId:this.__mentionId,mentionKind:this.__mentionKind,mentionName:this.__mention}}getMentionKind(){return this.getLatest().__mentionKind}setMentionKind(e){let t=this.getWritable();return t.__mentionKind=e,t}getMention(){return this.getLatest().__mention}setMention(e){let t=this.getWritable();return t.__mention=e,t}getMentionData(){return this.getLatest().__mentionData}setMentionData(e){let t=this.getWritable();return t.__mentionData=e,t}createDOM(e){let t=super.createDOM(e);return t.className=`mention`,t.spellcheck=!1,ni(t,this.__mention,this.__mentionKind,this.__mentionId,this.__mentionData,!0),t}updateDOM(e,t,n){let r=super.updateDOM(e,t,n),i=this.__mentionKind;return(e.__mention!==this.__mention||e.__mentionData!==this.__mentionData||e.__mentionId!==this.__mentionId||e.__mentionKind!==this.__mentionKind||e.__text!==this.__text||t.getAttribute(`data-lexical-mention-kind`)!==i||t.getAttribute(`data-lexical-mention-data`)!==this.__mentionData)&&ni(t,this.__mention,this.__mentionKind,this.__mentionId,this.__mentionData,!0),r}exportDOM(){let e=document.createElement(`span`);return ni(e,this.__mention,this.__mentionKind,this.__mentionId,this.__mentionData,this.__text!==this.__mention),e.textContent=this.__text,{element:e}}static importDOM(){return{span:e=>e.hasAttribute(`data-lexical-mention`)?{conversion:ri,priority:1}:null}}isTextEntity(){return!0}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function ai(e,n,r,i,a){let o=new ii(e,n,r,i,a);return o.setMode(`segmented`).toggleDirectionless(),t.o(o)}var oi=a.lazy(()=>Promise.resolve().then(()=>require("./MediaComponent-BhjGu3D-.cjs")));function si(e){return e.parentElement!=null&&e.parentElement.tagName===`LI`&&e.previousSibling===null&&e.getAttribute(`aria-roledescription`)===`checkbox`}function ci(e){let t=e,n=t.getAttribute(`src`);if(!n||n.startsWith(`file:///`)||si(t))return null;let{alt:r,width:i,height:a}=t;return{node:hi({altText:r,height:a,src:n,width:i})}}function li(e){let t=e,n=t.getAttribute(`src`)||t.currentSrc;return n?{node:hi({altText:t.getAttribute(`title`)||``,height:t.height,mediaType:`video`,src:n,width:t.width})}:null}function ui(e){let t=e,n=t.getAttribute(`src`)||t.currentSrc;return n?{node:hi({altText:t.getAttribute(`title`)||``,height:Number(t.getAttribute(`height`))||void 0,mediaType:`audio`,src:n,width:Number(t.getAttribute(`width`))||void 0})}:null}function di(e){let t=e.getAttribute(`src`)||e.getAttribute(`data`)||``,n=e.getAttribute(`type`)||``;return(e.getAttribute(`data-lexical-media-type`)||``)===`pdf`||n===`application/pdf`||t.toLowerCase().split(/[?#]/)[0].endsWith(`.pdf`)}function fi(e){let t=e,n=t.getAttribute(`src`)||t.getAttribute(`data`);return!n||!di(t)?null:{node:hi({altText:t.getAttribute(`title`)||``,height:Number(t.getAttribute(`height`))||void 0,mediaType:`pdf`,src:n,width:Number(t.getAttribute(`width`))||void 0})}}function pi(){for(let{origin:e}of t.Ft(t.Z(t.Dr(),`next`)))if(!t.vt(e))return!1;return!0}var mi=class e extends t.I{__src;__altText;__width;__height;__maxWidth;__mediaType;__previewSrc;__showCaption;__caption;__captionsEnabled;static getType(){return`image`}static clone(t){return new e(t.__src,t.__altText,t.__maxWidth,t.__width,t.__height,t.__showCaption,t.__caption,t.__captionsEnabled,t.__key,t.__mediaType,t.__previewSrc)}static importJSON(e){let{altText:t,height:n,mediaType:r,width:i,maxWidth:a,src:o,showCaption:s}=e;return hi({altText:t,height:n,maxWidth:a,mediaType:r,showCaption:s,src:o,width:i}).updateFromJSON(e)}updateFromJSON(e){let t=super.updateFromJSON(e),{caption:n}=e,r=t.__caption,i=r.parseEditorState(n.editorState);return i.isEmpty()||r.setEditorState(i),t}exportDOM(){let e=this.createMediaDOMElement();if(this.__showCaption&&this.__caption){let n=this.__caption,i=n.read(()=>{if(pi())return null;let e=null,i=t.Dr().getFirstChild();return t.kn(i)&&i.getNextSibling()===null&&(e=t.h(),e.anchor.set(i.getKey(),0,`element`),e.focus.set(i.getKey(),i.getChildrenSize(),`element`)),r.x(n,e)});if(i){let t=document.createElement(`figure`),n=document.createElement(`figcaption`);return n.innerHTML=i,t.appendChild(e),t.appendChild(n),{element:t}}}return{element:e}}createMediaDOMElement(){if(this.__mediaType===`video`){let e=document.createElement(`video`);return e.setAttribute(`src`,this.__src),e.setAttribute(`title`,this.__altText),e.setAttribute(`width`,this.__width.toString()),e.setAttribute(`height`,this.__height.toString()),e.setAttribute(`controls`,`true`),e.setAttribute(`data-lexical-media-type`,`video`),e}if(this.__mediaType===`pdf`){let e=document.createElement(`iframe`);return e.setAttribute(`src`,this.__src),e.setAttribute(`title`,this.__altText||`PDF`),e.setAttribute(`width`,this.__width.toString()),e.setAttribute(`height`,this.__height.toString()),e.setAttribute(`data-lexical-media-type`,`pdf`),e}if(this.__mediaType===`audio`){let e=document.createElement(`audio`);return e.setAttribute(`src`,this.__src),e.setAttribute(`title`,this.__altText),e.setAttribute(`controls`,`true`),e.setAttribute(`data-lexical-media-type`,`audio`),this.__width!==`inherit`&&e.setAttribute(`width`,this.__width.toString()),this.__height!==`inherit`&&e.setAttribute(`height`,this.__height.toString()),e}let e=document.createElement(`img`);return e.setAttribute(`src`,this.__src),e.setAttribute(`alt`,this.__altText),e.setAttribute(`width`,this.__width.toString()),e.setAttribute(`height`,this.__height.toString()),e}static importDOM(){return{audio:()=>({conversion:ui,priority:0}),embed:()=>({conversion:fi,priority:0}),figcaption:()=>({conversion:()=>({node:null}),priority:0}),figure:()=>({conversion:e=>({after:n=>{let i=n.filter(gi),a=e.querySelector(`figcaption`);if(a)for(let e of i)e.setShowCaption(!0),e.__caption.update(()=>{let e=t.s();r.l(e,r.j(e,a),t.Zr()),t.En(null)},{tag:t.gn});return i},node:null}),priority:0}),img:()=>({conversion:ci,priority:0}),iframe:e=>di(e)?{conversion:fi,priority:0}:null,object:()=>({conversion:fi,priority:0}),video:()=>({conversion:li,priority:0})}}constructor(e,n,r,i,a,o,s,c,l,u=`image`,d){super(l),this.__src=e,this.__altText=n,this.__maxWidth=r,this.__width=i||`inherit`,this.__height=a||`inherit`,this.__mediaType=u,this.__previewSrc=d,this.__showCaption=o||!1,this.__caption=s||t.mr({namespace:`Playground/MediaNodeCaption`,nodes:[t.q,t.Wt,t.H,t.Et,_n,Jr,Xr,ii]}),this.__captionsEnabled=c||c===void 0}exportJSON(){return{...super.exportJSON(),altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height===`inherit`?0:this.__height,maxWidth:this.__maxWidth,mediaType:this.__mediaType,showCaption:this.__showCaption,src:this.getSrc(),width:this.__width===`inherit`?0:this.__width}}setWidthAndHeight(e,t){let n=this.getWritable();n.__width=e,n.__height=t}setShowCaption(e){let t=this.getWritable();t.__showCaption=e}createDOM(e){let t=document.createElement(`span`),n=e.theme.image;return n!==void 0&&(t.className=n),t}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__altText}getMediaType(){return this.__mediaType}decorate(){return(0,o.jsx)(oi,{src:this.__src,altText:this.__altText,mediaType:this.__mediaType,previewSrc:this.__previewSrc,width:this.__width,height:this.__height,maxWidth:this.__maxWidth,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,captionsEnabled:this.__captionsEnabled,resizable:!0})}};function hi({altText:e,height:n,maxWidth:r=500,captionsEnabled:i,mediaType:a,previewSrc:o,src:s,width:c,showCaption:l,caption:u,key:d}){return t.o(new mi(s,e,r,c,n,l,u,i,d,a,o))}function gi(e){return e instanceof mi}var _i=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]);function vi(e){try{let t=new URL(e);if(!_i.has(t.protocol))return`about:blank`}catch{return e}return e}var yi=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function bi(e){return e===`https://`||yi.test(e)}var xi=[],Si=class e extends t.m{__ids;static getType(){return`mark`}static clone(t){return new e(t.__ids,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__ids=e.__ids}static importDOM(){return null}static importJSON(e){return Ci().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIDs(e.ids)}exportJSON(){return{...super.exportJSON(),ids:this.getIDs()}}constructor(e=xi,t){super(t),this.__ids=e}createDOM(e){let n=t.qt().createElement(`mark`);return t.Vr(n,e.theme.mark),this.__ids.length>1&&t.Vr(n,e.theme.markOverlap),n}updateDOM(e,n,r){let i=e.__ids,a=this.__ids,o=i.length,s=a.length,c=r.theme.markOverlap;return o!==s&&(o===1?s===2&&t.Vr(n,c):s===1&&t.Pt(n,c)),!1}hasID(e){return this.getIDs().includes(e)}getIDs(){return Array.from(this.getLatest().__ids)}setIDs(e){let t=this.getWritable();return t.__ids=e,t}addID(e){let t=this.getWritable();return t.__ids.includes(e)?t:t.setIDs([...t.__ids,e])}deleteID(e){let t=this.getWritable(),n=t.__ids.indexOf(e);if(n===-1)return t;let r=Array.from(t.__ids);return r.splice(n,1),t.setIDs(r)}insertNewAfter(e,t=!0){let n=Ci(this.__ids);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,r){if(!t.bn(n)||r===`html`)return!1;let i=n.anchor,a=n.focus,o=i.getNode(),s=a.getNode(),c=n.isBackward()?i.offset-a.offset:a.offset-i.offset;return this.isParentOf(o)&&this.isParentOf(s)&&this.getTextContent().length===c}excludeFromCopy(e){return e!==`clone`}};function Ci(e=xi){return t.o(new Si(e))}function wi(e){return e instanceof Si}function Ti(e){let t=e.getChildren(),n=null;for(let r=0;r<t.length;r++){let i=t[r];n===null?e.insertBefore(i):n.insertAfter(i),n=i}e.remove()}function Ei(e,n,r,i){let a=t.h(),[o,s]=e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus],c,l;a.anchor.set(o.key,o.offset,o.type),a.focus.set(s.key,s.offset,s.type);let u=a.extract();for(let e of u){if(t.vt(l)&&l.isParentOf(e))continue;let n=null;if(t.Jt(e))n=e;else{if(wi(e))continue;(t.vt(e)||t.$(e))&&e.isInline()&&(n=e)}if(n!==null){if(n&&n.is(c))continue;let e=n.getParent();e!=null&&e.is(c)||(l=void 0),c=e,l===void 0&&(l=(i||Ci)([r]),n.insertBefore(l)),l.append(n)}else c=void 0,l=void 0}t.vt(l)&&(n?l.selectStart():l.selectEnd())}function Di(e,n){let r=e;for(;r!==null;){if(wi(r))return r.getIDs();if(t.Jt(r)&&n===r.getTextContentSize()){let e=r.getNextSibling();if(wi(e))return e.getIDs()}r=r.getParent()}return null}var Oi=t.ar?a.useLayoutEffect:a.useEffect,ki=class{key;ref;icon;title;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}},Ai=e=>{let t=e.closest(`#typeahead-menu`);if(!t)return;let n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:`center`}),n.top<0&&t.scrollIntoView({block:`center`}),e.scrollIntoView({block:`nearest`})};function ji(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top>=r.top-6&&n.top<=r.bottom+6}function Mi(e,r,i,o){let[s]=t.oi();(0,a.useEffect)(()=>{if(r!=null&&e!=null){let e=s.getRootElement(),a=e==null?document.body:n.C(e,!1),c=!1,l=ji(r,a),u=function(){c||=(window.requestAnimationFrame(function(){i(),c=!1}),!0);let e=ji(r,a);e!==l&&(l=e,o?.(e))},d=new ResizeObserver(i),f=t.vr(e??r);return d.observe(r),t.Yn(t.yt(window,`resize`,i),t.yt(document,`scroll`,u,{capture:!0,passive:!0}),...f.map(e=>t.yt(e,`scroll`,u,{capture:!0,passive:!0})),()=>d.unobserve(r))}},[r,s,o,i,e])}var Ni=t.x(`SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND`);function Pi({index:e,isSelected:t,onClick:n,onMouseEnter:r,option:i}){let a=`item`;return t&&(a+=` selected`),(0,o.jsxs)(`li`,{tabIndex:-1,className:a,ref:i.setRefElement,role:`option`,"aria-selected":t,id:`typeahead-item-`+e,onMouseEnter:r,onClick:n,children:[i.icon,(0,o.jsx)(`span`,{className:`text`,children:i.title})]},i.key)}function Fi({close:e,editor:n,anchorElementRef:r,resolution:i,options:c,menuRenderFn:l,onSelectOption:u,shouldSplitNodeWithQuery:d=!1,commandPriority:f=1,preselectFirstItem:p=!0}){let[m,h]=(0,a.useState)(null),g=m===null?null:Math.min(c.length-1,m);(0,a.useEffect)(()=>{p&&h(0)},[i.match&&i.match.matchingString,p]);let _=(0,a.useCallback)(r=>{n.update(()=>{u(r,i.match!=null&&d?function(e){let n=t.tt();if(!t.bn(n)||!n.isCollapsed())return null;let r=n.anchor;if(r.type!==`text`)return null;let i=r.getNode();if(!i.isSimpleText())return null;let a=r.offset,o=i.getTextContent().slice(0,a),s=e.replaceableString.length,c=a-function(e,t,n){let r=n;for(let n=r;n<=t.length;n++)e.slice(-n)===t.substring(0,n)&&(r=n);return r}(o,e.matchingString,s);if(c<0)return null;let l;return c===0?[l]=i.splitText(a):[,l]=i.splitText(c,a),l}(i.match):null,e,i.match?i.match.matchingString:``)})},[n,d,i.match,u,e]),v=(0,a.useCallback)(e=>{let t=n.getRootElement();t!==null&&(t.setAttribute(`aria-activedescendant`,`typeahead-item-`+e),h(e))},[n]),y=(0,a.useCallback)(()=>r.current&&c.length?s.default.createPortal((0,o.jsx)(`div`,{className:`typeahead-popover mentions-menu`,children:(0,o.jsx)(`ul`,{children:c.map((e,t)=>(0,o.jsx)(Pi,{index:t,isSelected:g===t,onClick:()=>{h(t),_(e)},onMouseEnter:()=>{h(t)},option:e},e.key))})}),r.current):null,[r,c,g,_,h]);(0,a.useEffect)(()=>()=>{let e=n.getRootElement();e!==null&&e.removeAttribute(`aria-activedescendant`)},[n]),Oi(()=>{c===null?h(null):g===null&&p&&v(0)},[c,g,v,p]),(0,a.useEffect)(()=>t.Yn(n.registerCommand(Ni,({option:e})=>!(!e.ref||e.ref.current==null)&&(Ai(e.ref.current),!0),f)),[n,v,f]),(0,a.useEffect)(()=>t.Yn(n.registerCommand(t.Qn,e=>{let t=e;if(c!==null&&c.length){let e=g===null||g===c.length-1?0:g+1;v(e);let r=c[e];if(!r)return v(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;r.ref&&r.ref.current&&n.dispatchCommand(Ni,{index:e,option:r}),t.preventDefault(),t.stopImmediatePropagation()}return!0},f),n.registerCommand(t.Cr,e=>{let t=e;if(c!==null&&c.length){let e=g===null||g===0?c.length-1:g-1;v(e);let n=c[e];if(!n)return v(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;n.ref&&n.ref.current&&Ai(n.ref.current),t.preventDefault(),t.stopImmediatePropagation()}return!0},f),n.registerCommand(t.jn,t=>{let n=t;return n.preventDefault(),n.stopImmediatePropagation(),e(),!0},f),n.registerCommand(t.zn,e=>{let t=e;return c!==null&&g!==null&&c[g]!=null&&(t.preventDefault(),t.stopImmediatePropagation(),_(c[g]),!0)},f),n.registerCommand(t.yn,e=>!(c===null||g===null||c[g]==null||e&&e.shiftKey)&&(e!==null&&(e.preventDefault(),e.stopImmediatePropagation()),_(c[g]),!0),f)),[_,e,n,c,g,v,f]);let b=(0,a.useMemo)(()=>({options:c,selectOptionAndCleanUp:_,selectedIndex:g,setHighlightedIndex:h}),[_,g,c]);return l==null?y():l(r,b,i.match?i.match.matchingString:``)}function Ii(e,t){t!=null&&(e.className=t),e.setAttribute(`aria-label`,`Typeahead menu`),e.setAttribute(`role`,`listbox`),e.style.display=`block`,e.style.position=`absolute`}function Li(e,n,r,i,o=!0){let[s]=t.oi(),c=i??function(e){if(!t.ar)return;let n=e.getRootElement();if(n!==null){let e=n.getRootNode();return t.Gn(e)?e:n.ownerDocument.body}return document.body}(s),l=t.ar?t.E(s.getRootElement()).createElement(`div`):null,u=(0,a.useRef)(l),d=(0,a.useCallback)(()=>{if(u.current===null||c===void 0)return;u.current.style.top=u.current.style.bottom;let t=s.getRootElement(),n=u.current,i=n.firstChild;if(t!==null&&e!==null){let{left:a,top:s,width:l,height:d}=e.getRect(),f=u.current.offsetHeight;if(n.style.top=`${s+f+3+(o?window.pageYOffset:0)}px`,n.style.left=`${a+window.pageXOffset}px`,n.style.height=`${d}px`,n.style.width=`${l}px`,i!==null){i.style.top=`${s}`;let e=i.getBoundingClientRect(),r=e.height,c=e.width,l=t.getBoundingClientRect();a+c>l.right&&(n.style.left=`${l.right-c+window.pageXOffset}px`),(s+r>window.innerHeight||s+r>l.bottom)&&s-l.top>r+d&&(n.style.top=`${s-r-d+(o?window.pageYOffset:0)}px`)}n.isConnected||(Ii(n,r),c.append(n)),n.setAttribute(`id`,`typeahead-menu`),t.setAttribute(`aria-controls`,`typeahead-menu`)}},[s,e,o,r,c]);(0,a.useEffect)(()=>{let t=s.getRootElement();return e!==null&&d(),()=>{t!==null&&t.removeAttribute(`aria-controls`);let e=u.current;e!==null&&e.isConnected&&(e.remove(),e.removeAttribute(`id`))}},[s,d,e]);let f=(0,a.useCallback)(t=>{e!==null&&(t||n(null))},[e,n]);return Mi(e,u.current,d,f),l!=null&&l===u.current&&(Ii(l,r),c?.append(l)),u}var Ri=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function zi(e,{minLength:t=1,maxLength:n=75,punctuation:r=Ri,allowWhitespace:i=!1}){return(0,a.useCallback)(a=>{let o=RegExp(`(^|\\s|\\()([`+e+`]((?:`+(`[^`+e+r+(i?``:`\\s`)+`]`)+`){0,`+n+`}))$`).exec(a);if(o!==null){let e=o[1],n=o[3];if(n.length>=t)return{leadOffset:o.index+e.length,matchingString:n,replaceableString:o[2]}}return null},[i,e,r,n,t])}function Bi({options:e,onQueryChange:n,onSelectOption:r,onOpen:i,onClose:s,menuRenderFn:c,triggerFn:l,anchorClassName:u,commandPriority:d=1,parent:f,preselectFirstItem:p=!0,ignoreEntityBoundary:m=!1}){let[h]=t.oi(),[g,_]=(0,a.useState)(null),v=Li(g,_,u,f),y=(0,a.useCallback)(()=>{if(g===null)return;let e=()=>{_(null)},t;try{t=s&&s()}finally{t?t.then(e,e):e()}},[s,g]),b=(0,a.useCallback)(e=>{_(e),i!=null&&g===null&&i(e)},[i,g]);return(0,a.useEffect)(()=>{let e=h.registerUpdateListener(()=>{h.read(`latest`,()=>{if(!h.isEditable())return void y();if(h.isComposing())return;let e=h._window||window,r=e.document.createRange(),i=t.tt(),o=function(e){let n=null;return e.read(`latest`,()=>{let e=t.tt();t.bn(e)&&(n=function(e){let t=e.anchor;if(t.type!==`text`)return null;let n=t.getNode();if(!n.isSimpleText())return null;let r=t.offset;return n.getTextContent().slice(0,r)}(e))}),n}(h);if(!t.bn(i)||!i.isCollapsed()||o===null||r===null)return void y();let s=l(o,h);if(n(s?s.matchingString:null),s!==null&&(m||!function(e,n){return n===0&&e.read(`latest`,()=>{let e=t.tt();if(t.bn(e)){let n=e.anchor.getNode().getPreviousSibling();return t.Jt(n)&&n.isTextEntity()}return!1})}(h,s.leadOffset))&&function(e,n,r,i){let a=t.M(r);if(a===null||!a.isCollapsed)return!1;let o=t.Er(a,i),s=o.anchorNode,c=e,l=o.anchorOffset;if(s==null||l==null)return!1;try{n.setStart(s,c),n.setEnd(s,l)}catch{return!1}return!0}(s.leadOffset,r,e,h.getRootElement())!==null)return void(0,a.startTransition)(()=>b({getRect:()=>r.getBoundingClientRect(),match:s}));y()})});return()=>{e()}},[h,l,n,g,y,b,m]),(0,a.useEffect)(()=>h.registerEditableListener(e=>{e||y()}),[h,y]),g===null||h===null||v.current===null?null:(0,o.jsx)(Fi,{close:y,resolution:g,editor:h,anchorElementRef:v,options:e,menuRenderFn:c,shouldSplitNodeWithQuery:!0,onSelectOption:r,commandPriority:d,preselectFirstItem:p})}var Vi=`lexical-playground-media-files`,Hi=`media-files`,Ui=1;function Wi(){return typeof window>`u`||!window.indexedDB?null:window.indexedDB}function Gi(){let e=Wi();return e===null?Promise.resolve(null):new Promise(t=>{let n=e.open(Vi,Ui);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Hi)||e.createObjectStore(Hi,{keyPath:`src`})},n.onsuccess=()=>{t(n.result)},n.onerror=()=>{t(null)}})}function Ki(e){e.close()}async function qi(e,t){if(e.trim()===``)return;let n=await Gi();n!==null&&await new Promise(r=>{let i=n.transaction(Hi,`readwrite`),a=i.objectStore(Hi),o={file:t,name:t.name,src:e,type:t.type,updatedAt:Date.now()};i.oncomplete=()=>{Ki(n),r()},i.onerror=()=>{Ki(n),r()},i.onabort=()=>{Ki(n),r()},a.put(o)})}async function Ji(e){if(e.trim()===``||typeof URL.createObjectURL!=`function`)return;let t=await Gi();if(t===null)return;let n=await new Promise(n=>{let r=t.transaction(Hi,`readonly`),i=r.objectStore(Hi).get(e);i.onsuccess=()=>{let e=i.result;n(e?.file)},i.onerror=()=>{n(void 0)},r.oncomplete=()=>{Ki(t)},r.onerror=()=>{Ki(t)},r.onabort=()=>{Ki(t)}});return n?URL.createObjectURL(n):void 0}var Yi=/^[a-z][a-z\d+.-]*:/i,Xi=/^(?:blob|data|https?):/i;function Zi(e){return typeof e==`string`?e.trim()===``?null:e:null}function Qi(e){return e.path||e.webkitRelativePath||e.name}async function $i(e,t,n){if(e===void 0)return null;try{return Zi(await e(t,{source:n}))}catch{return null}}function ea(e){let t=e.trim();return t===``||Xi.test(t)?!1:t.startsWith(`file://`)||/^[a-z]:[\\/]/i.test(t)||t.startsWith(`\\\\`)||/^\.{1,2}[\\/]/.test(t)||t.startsWith(`/`)||!Yi.test(t)&&/[\\/]/.test(t)}var ta=new Map([[`:)`,[`emoji happysmile`,`🙂`]],[`:D`,[`emoji veryhappysmile`,`😀`]],[`:(`,[`emoji unhappysmile`,`🙁`]],[`<3`,[`emoji heart`,`❤`]]]);function na(e){let t=e.getTextContent();for(let n=0;n<t.length;n++){let r=ta.get(t[n])||ta.get(t.slice(n,n+2));if(r!==void 0){let[t,i]=r,a;n===0?[a]=e.splitText(n+2):[,a]=e.splitText(n,n+2);let o=Yr(t,i);return a.replace(o),o}}return null}function ra(e){let t=e;for(;t!==null;){if(!t.isSimpleText())return;t=na(t)}}function ia(e){(0,a.useEffect)(()=>{if(!e.hasNodes([Jr]))throw Error(`EmojisPlugin: EmojiNode not registered on editor`);return e.registerNodeTransform(t.Wt,ra)},[e])}function aa(){let[e]=t.oi();return ia(e),null}function oa(e,n,i){let[o]=t.oi();(0,a.useEffect)(()=>t.Yn(...r.R(o,e,n,i)),[i,o,e,n])}var sa=/(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;function ca(){let[e]=t.oi();(0,a.useEffect)(()=>{if(!e.hasNodes([Xr]))throw Error(`KeywordsPlugin: KeywordNode not registered on editor`)},[e]);let n=(0,a.useCallback)(e=>Zr(e.getTextContent()),[]);return oa((0,a.useCallback)(e=>{let t=sa.exec(e);if(t===null)return null;let n=t[2].length,r=t.index+t[1].length;return{end:r+n,start:r}},[]),Xr,n),null}function la({validateUrl:e,attributes:n}){let[i]=t.oi();return(0,a.useEffect)(()=>{if(!i.hasNodes([_n]))throw Error(`LinkPlugin: LinkNode not registered on editor`)}),(0,a.useEffect)(()=>An(i,r.V({attributes:n,validateUrl:e})),[i,e,n]),null}function ua({hasLinkAttributes:e=!1}){return(0,o.jsx)(la,{validateUrl:bi,attributes:e?{rel:`noopener noreferrer`,target:`_blank`}:void 0})}var da={concept:`bi-lightbulb-fill`,deity:`bi-brightness-high-fill`,group:`bi-people-fill`,life:`bi-heart-fill`,month:`bi-calendar-event-fill`,person:`bi-person-fill`,place:`bi-geo-alt-fill`,supernatural:`bi-stars`,unknown:`bi-question-circle-fill`};function fa(e){return`bi ${da[Vt(e)]} icon`}var pa=1600;function ma(e,t){return e.left===t.left&&e.top===t.top}function ha({anchorElement:e,iconClassName:t,name:n,nameContent:r,panelKind:i,position:s,copyLabel:c,textStyle:l,title:u,zIndex:d,onBringToFront:f,onClose:p,onCopy:m,onPositionChange:h}){let g=(0,a.useRef)(null),_=(0,a.useRef)(null),v=(0,a.useRef)(e),y=(0,a.useRef)(h),b=(0,a.useRef)(null),[x,S]=(0,a.useState)(!1),[C,w]=(0,a.useState)(!1);v.current=e,y.current=h,(0,a.useEffect)(()=>()=>{b.current!==null&&clearTimeout(b.current)},[]);let T=(0,a.useCallback)(()=>{m!==void 0&&Promise.resolve(m()).then(()=>{w(!0),b.current!==null&&clearTimeout(b.current),b.current=setTimeout(()=>{w(!1),b.current=null},pa)})},[m]),E=(0,a.useCallback)(e=>{let t=_.current;t===null||t.pointerId!==e.pointerId||(y.current(jr({left:t.startLeft+e.clientX-t.startClientX,top:t.startTop+e.clientY-t.startClientY},g.current,v.current)),e.preventDefault())},[]),D=(0,a.useCallback)(e=>{let t=_.current;t===null||t.pointerId!==e.pointerId||(_.current=null,S(!1),document.removeEventListener(`pointermove`,E),document.removeEventListener(`pointerup`,D),document.removeEventListener(`pointercancel`,D),e.preventDefault())},[E]),O=(0,a.useCallback)(e=>{e.button===0&&(e.target instanceof Element&&e.target.closest(`button, .mention-advanced-panel__name`)||(f(),_.current={pointerId:e.pointerId,startClientX:e.clientX,startClientY:e.clientY,startLeft:s.left,startTop:s.top},S(!0),document.addEventListener(`pointermove`,E),document.addEventListener(`pointerup`,D),document.addEventListener(`pointercancel`,D),e.preventDefault(),e.stopPropagation()))},[E,D,f,s.left,s.top]);(0,a.useEffect)(()=>()=>{document.removeEventListener(`pointermove`,E),document.removeEventListener(`pointerup`,D),document.removeEventListener(`pointercancel`,D)},[E,D]),(0,a.useEffect)(()=>{let t=()=>{let t=jr(s,g.current,e);ma(t,s)||h(t)};return t(),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[e,h,s]);let k=wr(e),A=Er(g.current,e),j={left:s.left/A,maxHeight:Math.max(96,k.bottom-s.top)/A,maxWidth:Math.max(220,k.right-s.left)/A,position:`fixed`,top:s.top/A,zIndex:d};return(0,o.jsxs)(`div`,{ref:g,"aria-label":`${n} advanced panel`,className:`mention-advanced-panel${x?` dragging`:``}`,role:`dialog`,style:j,tabIndex:0,onFocus:f,onPointerDown:f,children:[(0,o.jsxs)(`div`,{className:`mention-advanced-panel__header`,onPointerDown:O,children:[(0,o.jsxs)(`div`,{className:`mention-advanced-panel__name d-inline-flex align-items-center gap-2`,style:l,children:[(0,o.jsx)(`i`,{className:t,"aria-hidden":`true`}),r??(0,o.jsx)(`span`,{children:n})]}),(0,o.jsxs)(`div`,{className:`mention-advanced-panel__actions`,children:[m===void 0?null:(0,o.jsx)(`button`,{"aria-label":C?`Copied`:c??`Copy ${i} text`,className:`mention-advanced-panel__copy${C?` mention-advanced-panel__copy--copied`:``}`,title:C?`Copied!`:`Copy`,type:`button`,onClick:T,children:(0,o.jsx)(`i`,{className:C?`bi bi-check2`:`bi bi-copy`,"aria-hidden":`true`})}),(0,o.jsx)(`button`,{"aria-label":`Close ${i} panel`,className:`mention-advanced-panel__close`,title:`Close`,type:`button`,onClick:p,children:(0,o.jsx)(`i`,{className:`bi bi-x-lg`,"aria-hidden":`true`})})]})]}),u?(0,o.jsx)(`div`,{className:`mention-advanced-panel__title`,style:l,children:u}):null]})}function ga({buttonClassName:e,enabled:t=!0,listClassName:n,values:r}){let{shortToVerseData:i}=zt(),[s,c]=(0,a.useState)({});return(0,a.useEffect)(()=>{if(!t||i===void 0)return;let e=!0;return Promise.all(r.map(async e=>{try{let t=await i(e);return[e,{label:t?.title??e,style:t?.style}]}catch{return[e,{label:e}]}})).then(t=>{e&&c(Object.fromEntries(t))}),()=>{e=!1}},[t,i,r]),(0,o.jsx)(`ul`,{className:n,children:r.map(t=>{let n=s[t],r=n?.label??t;return(0,o.jsx)(`li`,{children:(0,o.jsx)(`button`,{className:e,style:n?.style,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),tr({anchorElement:e.currentTarget,shortVerse:t})},children:r})},t)})})}var _a={NAME:`\\b[A-Z][^\\s\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;]`,PUNCTUATION:`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`}.PUNCTUATION,va=[`#`].join(``),ya=`[^`+va+_a+`\\s]`,ba=`(?:\\.[ |$]| |[`+_a+`]|)`,xa=RegExp(`(^|\\s|\\()([`+va+`]((?:`+ya+ba+`){0,75}))$`),Sa=RegExp(`(^|\\s|\\()([`+va+`]((?:`+ya+`){0,50}))$`),Ca=20,wa=2e3,Ta=150;function Ea(e,t,n){return{id:e,name:t,kjvName:null,oldName:null,title:n,description:``,type:``,relatedLocations:[],modernIdentification:null,coordinates:null,verses:[],links:[],wikipedia:null,uncertainty:!1,matterRange:1/0}}async function Da(e){if(navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}function Oa({inline:e=!1,label:t,value:n}){return(0,o.jsxs)(`div`,{className:`mention-location-details__row${e?` mention-location-details__row--inline`:``}`,children:[(0,o.jsx)(`dt`,{children:e?`${t}:`:t}),(0,o.jsx)(`dd`,{children:n})]})}function ka({label:e,value:t}){return Pr(t)?(0,o.jsx)(Oa,{inline:!0,label:e,value:Nr(t)}):null}function Aa({children:e,count:t,defaultOpen:n,label:r,onOpen:i}){let[s,c]=(0,a.useState)(n);return(0,o.jsxs)(`div`,{className:`mention-location-details__row mention-location-details__row--collapsible`,children:[(0,o.jsx)(`dt`,{children:(0,o.jsxs)(`button`,{"aria-expanded":s,className:`mention-location-details__section-toggle`,type:`button`,onClick:()=>{let e=!s;c(e),e&&i?.()},children:[(0,o.jsx)(`i`,{className:`bi bi-chevron-right mention-location-details__section-icon`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{children:r}),t>0?(0,o.jsx)(`span`,{className:`mention-location-details__section-count`,children:t}):null]})}),s?(0,o.jsx)(`dd`,{children:e}):null]})}function ja({onOpenLocationReference:e,values:t}){let n=hn();return(0,o.jsx)(`ul`,{className:`mention-location-details__list`,children:t.map(t=>{let r=Rr(n,t),i=r?.name??t;return(0,o.jsx)(`li`,{children:r===null?i:(0,o.jsx)(`button`,{className:`mention-location-details__location-button`,type:`button`,onClick:t=>{t.preventDefault(),t.stopPropagation(),e(r,t.currentTarget)},children:i})},t)})})}function Ma({label:e,onOpenLocationReference:t,values:n}){return n.length===0?null:(0,o.jsx)(Aa,{count:n.length,defaultOpen:!0,label:e,children:(0,o.jsx)(ja,{onOpenLocationReference:t,values:n})})}function Na({enabled:e,values:t}){let[n,r]=(0,a.useState)(!1);return t.length===0?null:(0,o.jsx)(Aa,{count:t.length,defaultOpen:!1,label:`Verses`,onOpen:()=>{r(!0)},children:(0,o.jsx)(ga,{buttonClassName:`mention-location-details__location-button`,enabled:e&&n,listClassName:`mention-location-details__list`,values:t})})}function Pa({links:e}){return(0,o.jsx)(`ul`,{className:`mention-location-details__list`,children:e.map(e=>(0,o.jsx)(`li`,{children:(0,o.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:Fr(e.type)})},`${e.type}:${e.url}`))})}function Fa({links:e}){return e.length===0?null:(0,o.jsx)(Aa,{count:e.length,defaultOpen:!0,label:`Links`,children:(0,o.jsx)(Pa,{links:e})})}function Ia({coordinates:e,name:t}){let{latitude:n,longitude:r}=e,i=`${n},${r}`,a=`https://maps.google.com/maps?q=${encodeURIComponent(i)}&z=8&output=embed`,s=`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(i)}`,c=t===``?`Location map`:`Map of ${t}`;return(0,o.jsxs)(`div`,{className:`mention-location-details__map`,children:[(0,o.jsx)(`p`,{className:`mention-location-details__map-note`,children:`Approximate location — the marker is an estimated point and may not be exact.`}),(0,o.jsx)(`iframe`,{className:`mention-location-details__map-frame`,title:c,src:a,loading:`lazy`,referrerPolicy:`no-referrer-when-downgrade`,allowFullScreen:!0}),(0,o.jsx)(`a`,{className:`mention-location-details__map-link`,href:s,rel:`noreferrer`,target:`_blank`,children:`Open in Google Maps`})]})}function La({includeTitle:e=!0,mentionLocation:t}){let n=[t.type].filter(e=>e!==``&&e.toLowerCase()!==`unknown`);return(0,o.jsxs)(`div`,{className:`mention-location-basic-info`,children:[e&&t.title?(0,o.jsx)(`div`,{className:`mention-location-basic-info__title`,children:(0,o.jsx)(Q,{value:t.title})}):null,t.description?(0,o.jsx)(`p`,{className:`mention-location-basic-info__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,n.length>0?(0,o.jsx)(`div`,{className:`mention-location-basic-info__facts`,children:n.map(e=>(0,o.jsx)(`span`,{children:e},e))}):null]})}function Ra({includeTitle:e=!0,mentionLocation:t,onOpenLocationReference:n}){let[r,i]=(0,a.useState)(!1);return(0,o.jsxs)(`details`,{className:`mention-location-details`,children:[(0,o.jsxs)(`summary`,{className:`mention-location-details__summary`,onClick:()=>{i(!0)},children:[(0,o.jsx)(`i`,{className:`bi bi-chevron-right mention-location-details__summary-icon`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{children:`Details`})]}),(0,o.jsxs)(`div`,{className:`mention-location-details__body`,children:[t.description?(0,o.jsx)(`p`,{className:`mention-location-details__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,(0,o.jsxs)(`dl`,{className:`mention-location-details__grid`,children:[e&&Pr(t.title)?(0,o.jsx)(Oa,{inline:!0,label:`Title`,value:(0,o.jsx)(Q,{value:t.title})}):null,(0,o.jsx)(ka,{label:`KJV name`,value:q(t)}),(0,o.jsx)(ka,{label:`Also called`,value:t.oldName}),(0,o.jsx)(ka,{label:`Type`,value:t.type}),(0,o.jsx)(ka,{label:`Modern identification`,value:t.modernIdentification}),(0,o.jsx)(Ma,{label:`Related locations`,onOpenLocationReference:n,values:t.relatedLocations}),(0,o.jsx)(Na,{enabled:r,values:t.verses}),(0,o.jsx)(Fa,{links:Lr(t)})]}),t.coordinates===null?null:(0,o.jsx)(Ia,{coordinates:t.coordinates,name:t.name})]})]})}function za(e){return e instanceof Element&&e.closest(`a, button, .mention-location-details`)!==null}function Ba(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-lexical-mention]`);return t instanceof HTMLElement?t:null}function Va(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-mention-location-hover-card]`);return t instanceof HTMLElement?t:null}function Ha(e){let t=e.getAttribute(`data-lexical-mention-kind`);return t===`mention`||t===`bible-verse`?t:t===`location`||t===`hashtag`||(e.textContent?.trim()??``).startsWith(`#`)?`location`:`mention`}function Ua(e){let t=Ha(e);t!==`bible-verse`&&e.setAttribute(`data-lexical-mention-kind`,t)}function Wa(e){e.querySelectorAll(`[data-lexical-mention]`).forEach(Ua)}function Ga(e,t){if(Ha(t)!==`location`)return null;let n=t.textContent?.trim()??``,r=t.getAttribute(`data-lexical-mention-id`);if(r!==null){let t=e.getRecordById(r);if(t!==null)return t}let i=t.getAttribute(`data-lexical-mention-name`)?.trim()??n??``,a=i.startsWith(`#`)?i.slice(1):i;if(a===``)return null;let o=e.getRecordsByName(a);return o.length===1?o[0]:Ea(r,a,``)}function Ka(e,t){let n=Ht(t.id),r=J(t.name);if(n!==null){let t=e.getRecordById(n);if(t!==null)return t}if(r===``)return null;let i=e.getRecordsByName(r);return i.length===1?i[0]:Ea(n,r,``)}function qa(e){return Ar(e,112)}function Ja(e){return`location:${e.id??e.name}`}var Ya=500;function Xa(e){let[t,n]=(0,a.useState)([]),r=hn(),i=(0,a.useRef)(new Map);return(0,a.useEffect)(()=>{if(e==null){n([]);return}let t=i.current,a=t.get(e);if(a!==null){if(a!==void 0){n(a);return}t.set(e,null),setTimeout(()=>{let i=r.searchLocations(e);t.set(e,i),n(i)},Ya)}},[e,r]),(0,a.useEffect)(()=>{i.current=new Map},[r]),t}function Za(e,t){let n=xa.exec(e);if(n===null&&(n=Sa.exec(e)),n!==null){let e=n[1],r=n[3];if(r.length>=t)return{leadOffset:n.index+e.length,matchingString:r,replaceableString:n[2]}}return null}function Qa(e){return Za(e,1)}var $a=class extends ki{id;name;kjvName;picture;constructor(e,t){super(e.id),this.id=e.id,this.name=e.name,this.kjvName=q(e),this.title=sr(e.title),this.picture=t}};function eo({index:e,isSelected:t,onClick:n,onMouseEnter:r,option:i}){let a=`item mx-2 p-2 d-flex flex-row align-items-center flex-shrink-0`;return t&&(a+=` selected`),(0,o.jsxs)(`li`,{tabIndex:-1,className:a,ref:i.setRefElement,role:`option`,"aria-selected":t,id:`typeahead-item-`+e,onMouseEnter:r,onClick:n,children:[i.picture,(0,o.jsxs)(`span`,{className:`text flex-column`,children:[(0,o.jsxs)(`span`,{children:[i.name,i.kjvName===null?null:(0,o.jsxs)(`span`,{className:`opacity-75`,children:[` (`,i.kjvName,`)`]})]}),i.title?(0,o.jsxs)(`span`,{className:`small opacity-75`,children:[`(`,i.title,`)`]}):null]})]},i.key)}function to(){let[e]=t.oi(),n=hn(),r=n.style,i=(0,a.useRef)(null),c=(0,a.useRef)(null),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(null),[p,m]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),[_,v]=(0,a.useState)([]),{shortToVerseData:y}=zt(),b=(0,a.useCallback)(async e=>{if(y===void 0)return e;try{return(await y(e))?.title??e}catch{return e}},[y]),x=Xa(l),S=zi(`/`,{minLength:0}),C=(0,a.useMemo)(()=>x.map(e=>new $a(e,(0,o.jsx)(`i`,{className:`bi bi-pin icon`,"aria-hidden":`true`}))).slice(0,Ca),[x]),w=(0,a.useCallback)((t,n,r)=>{e.update(()=>{let e=ai(t.name,t.name,t.id,`location`);n&&n.replace(e),e.select(),r()})},[e]),T=(0,a.useCallback)(t=>S(t,e)===null?Qa(t):null,[S,e]),E=(0,a.useCallback)(()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)},[]),D=(0,a.useCallback)(()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),O=(0,a.useCallback)(()=>{E(),D(),m(null),f(null)},[D,E]),k=(0,a.useCallback)(()=>{E(),D(),c.current=window.setTimeout(()=>{m(null),f(null),c.current=null},Ta)},[D,E]),A=(0,a.useCallback)((e,t)=>{let n=Ja(e),r=vr(),i=Mr(t);v(a=>{let o=a.find(e=>e.panelKey===n),s={...e,anchorElement:t,panelKey:n,position:o?.position??i,zIndex:r};return o===void 0?[...a,s]:a.map(e=>e.panelKey===n?s:e)}),O()},[O]),j=(0,a.useCallback)(e=>{v(t=>t.filter(t=>t.panelKey!==e))},[]),M=(0,a.useCallback)(e=>{let t=vr();v(n=>n.map(n=>n.panelKey===e?{...n,zIndex:t}:n))},[]),N=(0,a.useCallback)((e,t)=>{v(n=>{let r=!1,i=n.map(n=>n.panelKey!==e||n.position.left===t.left&&n.position.top===t.top?n:(r=!0,{...n,position:t}));return r?i:n})},[]);return(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(typeof t!=`object`||!t||!(t.anchorElement instanceof HTMLElement))return;let r=Ka(n,t);r!==null&&A(r,t.anchorElement)};return window.addEventListener(nr,e),()=>{window.removeEventListener(nr,e)}},[n,A]),(0,a.useEffect)(()=>{let e=e=>{if(e.button!==0)return;let t=Ba(e.target);if(t===null||!Sr(e,t))return;Ua(t);let r=Ga(n,t);r!==null&&(A(r,t),e.preventDefault(),e.stopPropagation())};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n,A]),(0,a.useEffect)(()=>e.registerNodeTransform(ii,e=>{e.getTextContent().startsWith(`#`)&&(e.setMentionKind(`location`),e.setTextContent(e.getTextContent().slice(1)))}),[e]),(0,a.useEffect)(()=>{let t=null,n=e.registerRootListener(e=>{t?.disconnect(),t=null,e!==null&&(Wa(e),t=new MutationObserver(()=>{Wa(e)}),t.observe(e,{characterData:!0,childList:!0,subtree:!0}))});return()=>{t?.disconnect(),n()}},[e]),(0,a.useEffect)(()=>{let e=e=>{if(Va(e.target)!==null){D();return}let t=Ba(e.target),r=Ba(e.relatedTarget);if(t===null)return;if(t===p){D();return}if(t===r)return;Ua(t);let a=Ga(n,t);a!==null&&(O(),i.current=window.setTimeout(()=>{m(t),f(a),i.current=null},wa))},t=e=>{let t=Ba(e.target),n=Va(e.target),r=Ba(e.relatedTarget),i=Va(e.relatedTarget);if(!(t===null&&n===null)){if(r!==null||i!==null){D();return}k()}};return document.addEventListener(`mouseover`,e),document.addEventListener(`mouseout`,t),()=>{E(),D(),document.removeEventListener(`mouseover`,e),document.removeEventListener(`mouseout`,t)}},[D,E,O,p,n,k]),(0,a.useEffect)(()=>{if(p===null){g(null);return}let e=()=>{if(!p.isConnected){O(),g(null);return}g(qa(p))};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[O,p]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Bi,{onQueryChange:u,onSelectOption:w,triggerFn:T,options:C,menuRenderFn:(e,{selectedIndex:t,selectOptionAndCleanUp:n,setHighlightedIndex:i})=>e.current&&x.length?s.createPortal((0,o.jsx)(`div`,{className:`typeahead-popover mention-locations-menu`,style:r,children:(0,o.jsx)(`ul`,{className:`list-unstyled m-0 p-0`,children:C.map((e,r)=>(0,o.jsx)(eo,{index:r,isSelected:t===r,onClick:()=>{i(r),n(e)},onMouseEnter:()=>{i(r)},option:e},e.key))})}),e.current):null}),d!==null&&h!==null?s.createPortal((0,o.jsxs)(`div`,{className:`mention-hover-card`,"data-mention-location-hover-card":`true`,role:`tooltip`,style:{...r,...h},tabIndex:0,onClick:e=>{za(e.target)||p!==null&&A(d,p)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&p!==null&&!za(e.target)&&(A(d,p),e.preventDefault())},children:[(0,o.jsxs)(`div`,{className:`mention-hover-card__name d-inline-flex align-items-center gap-2`,children:[(0,o.jsx)(`i`,{className:`bi bi-pin icon`,"aria-hidden":`true`}),(0,o.jsxs)(`span`,{className:`mention-hover-card__name-text`,children:[d.name,q(d)===null?null:(0,o.jsxs)(`span`,{className:`mention-hover-card__kjv-name`,children:[` `,`(`,q(d),`)`]})]}),(0,o.jsx)(`button`,{"aria-label":`Copy mentioned location name`,className:`mention-hover-card__copy`,title:`Copy name`,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),Da(d.name)},children:(0,o.jsx)(`i`,{className:`bi bi-copy`,"aria-hidden":`true`})})]}),d.title?(0,o.jsx)(`div`,{className:`mention-hover-card__title`,children:(0,o.jsx)(Q,{value:d.title})}):null,(0,o.jsx)(La,{includeTitle:!1,mentionLocation:d}),(0,o.jsx)(Ra,{includeTitle:!1,mentionLocation:d,onOpenLocationReference:A})]}),document.body):null,_.map(e=>(0,o.jsx)(ha,{anchorElement:e.anchorElement,copyLabel:`Copy mentioned location details`,iconClassName:`bi bi-pin icon`,name:e.name,panelKind:`location`,position:e.position,textStyle:r,title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(La,{mentionLocation:e}),(0,o.jsx)(Ra,{mentionLocation:e,onOpenLocationReference:A})]}),zIndex:e.zIndex,onCopy:async()=>{let{plainText:t,html:r}=qr(await Kr(n,e,b));return xr(t,r)},onBringToFront:()=>{M(e.panelKey)},onClose:()=>{j(e.panelKey)},onPositionChange:t=>{N(e.panelKey,t)}},e.panelKey))]})}var no={NAME:`\\b[A-Z][^\\s\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;]`,PUNCTUATION:`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`}.PUNCTUATION,ro=[`@`].join(``),io=`[^`+ro+no+`\\s]`,ao=`(?:\\.[ |$]| |[`+no+`]|)`,oo=RegExp(`(^|\\s|\\()([`+ro+`]((?:`+io+ao+`){0,75}))$`),so=RegExp(`(^|\\s|\\()([`+ro+`]((?:`+io+`){0,50}))$`),co=20,lo=2e3,uo=150;function fo(e,t,n){return{id:e,name:t,kjvName:null,oldName:null,title:n,description:``,gender:``,age:``,years:[],locations:[],spouses:[],children:[],parents:[],siblings:[],cousin:[],type:``,verses:[],links:[],wikipedia:null,matterRange:1/0}}async function po(e){if(navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}function mo({inline:e=!1,label:t,value:n}){return(0,o.jsxs)(`div`,{className:`mention-person-details__row${e?` mention-person-details__row--inline`:``}`,children:[(0,o.jsx)(`dt`,{children:e?`${t}:`:t}),(0,o.jsx)(`dd`,{children:n})]})}function ho({label:e,value:t}){return Pr(t)?(0,o.jsx)(mo,{inline:!0,label:e,value:Nr(t)}):null}function go({values:e}){return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>(0,o.jsx)(`li`,{children:e},e))})}function _o({label:e,values:t}){return t.length===0?null:(0,o.jsx)(mo,{label:e,value:(0,o.jsx)(go,{values:t})})}function vo({locations:e}){let t=hn();return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>{let n=Rr(t,e),r=n?.name??e;return(0,o.jsx)(`li`,{children:n===null?r:(0,o.jsx)(`button`,{className:`mention-person-details__location-button`,title:sr(n.title)||void 0,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),rr({anchorElement:e.currentTarget,id:n.id,name:n.name})},children:r})},e)})})}function yo({locations:e}){return e.length===0?null:(0,o.jsx)(mo,{label:`Locations`,value:(0,o.jsx)(vo,{locations:e})})}function bo({ids:e,onOpenPersonReference:t}){let n=mn();return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>{let r=n.getRecordById(e),i=r?.name??e;return(0,o.jsx)(`li`,{children:r===null?i:(0,o.jsx)(`button`,{className:`mention-person-details__person-button`,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),t(r,e.currentTarget)},children:i})},e)})})}function xo({ids:e,label:t,onOpenPersonReference:n}){return e.length===0?null:(0,o.jsx)(mo,{label:t,value:(0,o.jsx)(bo,{ids:e,onOpenPersonReference:n})})}function So({links:e}){return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>(0,o.jsx)(`li`,{children:(0,o.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:Fr(e.type)})},`${e.type}:${e.url}`))})}function Co({enabled:e,values:t}){return t.length===0?null:(0,o.jsx)(mo,{label:`Verses`,value:(0,o.jsx)(ga,{buttonClassName:`mention-person-details__location-button`,enabled:e,listClassName:`mention-person-details__list`,values:t})})}function wo({links:e}){return e.length===0?null:(0,o.jsx)(mo,{label:`Links`,value:(0,o.jsx)(So,{links:e})})}function To({includeTitle:e=!0,mentionPerson:t}){let n=[t.type,t.gender,t.age].filter(e=>e!==``&&e.toLowerCase()!==`unknown`);return(0,o.jsxs)(`div`,{className:`mention-person-basic-info`,children:[e&&t.title?(0,o.jsx)(`div`,{className:`mention-person-basic-info__title`,children:(0,o.jsx)(Q,{value:t.title})}):null,t.description?(0,o.jsx)(`p`,{className:`mention-person-basic-info__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,n.length>0?(0,o.jsx)(`div`,{className:`mention-person-basic-info__facts`,children:n.map(e=>(0,o.jsx)(`span`,{children:e},e))}):null]})}function Eo({includeTitle:e=!0,mentionPerson:t,onOpenPersonReference:n}){let[r,i]=(0,a.useState)(!1);return(0,o.jsxs)(`details`,{className:`mention-person-details`,children:[(0,o.jsxs)(`summary`,{className:`mention-person-details__summary`,onClick:()=>{i(!0)},children:[(0,o.jsx)(`i`,{className:`bi bi-chevron-right mention-person-details__summary-icon`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{children:`Details`})]}),(0,o.jsxs)(`div`,{className:`mention-person-details__body`,children:[t.description?(0,o.jsx)(`p`,{className:`mention-person-details__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,(0,o.jsxs)(`dl`,{className:`mention-person-details__grid`,children:[e&&Pr(t.title)?(0,o.jsx)(mo,{inline:!0,label:`Title`,value:(0,o.jsx)(Q,{value:t.title})}):null,(0,o.jsx)(ho,{label:`KJV name`,value:q(t)}),(0,o.jsx)(ho,{label:`Also called`,value:t.oldName}),(0,o.jsx)(ho,{label:`Type`,value:t.type}),(0,o.jsx)(ho,{label:`Gender`,value:t.gender}),(0,o.jsx)(ho,{label:`Age`,value:t.age}),(0,o.jsx)(_o,{label:`Years`,values:t.years.map(Ir)}),(0,o.jsx)(yo,{locations:t.locations}),(0,o.jsx)(xo,{label:`Parents`,ids:t.parents,onOpenPersonReference:n}),(0,o.jsx)(xo,{label:`Spouses`,ids:t.spouses,onOpenPersonReference:n}),(0,o.jsx)(xo,{label:`Children`,ids:t.children,onOpenPersonReference:n}),(0,o.jsx)(xo,{label:`Siblings`,ids:t.siblings,onOpenPersonReference:n}),(0,o.jsx)(xo,{label:`Cousins`,ids:t.cousin,onOpenPersonReference:n}),(0,o.jsx)(Co,{enabled:r,values:t.verses}),(0,o.jsx)(wo,{links:Lr(t)})]})]})]})}function Do(e){return e instanceof Element&&e.closest(`a, button, .mention-person-details`)!==null}function Oo(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-lexical-mention]`);return t instanceof HTMLElement?t:null}function ko(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-mention-name-hover-card]`);return t instanceof HTMLElement?t:null}function Ao(e,t){let n=t.textContent?.trim()??``,r=t.getAttribute(`data-lexical-mention-kind`);if(r===`location`||r===`bible-verse`||r===`hashtag`||n.startsWith(`#`))return null;let i=t.getAttribute(`data-lexical-mention-id`);if(i!==null){let t=e.getRecordById(i);if(t!==null)return t}let a=t.getAttribute(`data-lexical-mention-name`)?.trim()??n??``;if(a===``)return null;let o=e.getRecordsByName(a);return fo(i,a,o.length===1?o[0].title:``)}function jo(e){return Ar(e,360)}function Mo(e){return`person:${e.id??e.name}`}function No(e,t){let n=Ht(t.id),r=J(t.name);if(n!==null){let t=e.getRecordById(n);if(t!==null)return t}if(r===``)return null;let i=e.getRecordsByName(r);return i.length>=1?i[0]:null}var Po=500;function Fo(e){let[t,n]=(0,a.useState)([]),r=mn(),i=(0,a.useRef)(new Map);return(0,a.useEffect)(()=>{if(e==null){n([]);return}let t=i.current,a=t.get(e);if(a!==null){if(a!==void 0){n(a);return}t.set(e,null),setTimeout(()=>{let i=r.searchNames(e);t.set(e,i),n(i)},Po)}},[e,r]),(0,a.useEffect)(()=>{i.current=new Map},[r]),t}function Io(e,t){let n=oo.exec(e);if(n===null&&(n=so.exec(e)),n!==null){let e=n[1],r=n[3];if(r.length>=t)return{leadOffset:n.index+e.length,matchingString:r,replaceableString:n[2]}}return null}function Lo(e){return Io(e,1)}var Ro=class extends ki{id;name;kjvName;picture;constructor(e,t){super(e.id),this.id=e.id,this.name=e.name,this.kjvName=q(e),this.title=sr(e.title),this.picture=t}};function zo({index:e,isSelected:t,onClick:n,onMouseEnter:r,option:i}){let a=`item mx-2 p-2 d-flex flex-row align-items-center flex-shrink-0`;return t&&(a+=` selected`),(0,o.jsxs)(`li`,{tabIndex:-1,className:a,ref:i.setRefElement,role:`option`,"aria-selected":t,id:`typeahead-item-`+e,onMouseEnter:r,onClick:n,children:[i.picture,(0,o.jsxs)(`span`,{className:`text flex-column`,children:[(0,o.jsxs)(`span`,{children:[i.name,i.kjvName===null?null:(0,o.jsxs)(`span`,{className:`opacity-75`,children:[` (`,i.kjvName,`)`]})]}),i.title?(0,o.jsxs)(`span`,{className:`small opacity-75`,children:[`(`,i.title,`)`]}):null]})]},i.key)}function Bo(){let[e]=t.oi(),n=pn(),{namesLookupManager:r}=n,i=r.style,c=(0,a.useRef)(null),l=(0,a.useRef)(null),[u,d]=(0,a.useState)(null),[f,p]=(0,a.useState)(null),[m,h]=(0,a.useState)(null),[g,_]=(0,a.useState)(null),[v,y]=(0,a.useState)([]),{shortToVerseData:b}=zt(),x=(0,a.useCallback)(async e=>{if(b===void 0)return e;try{return(await b(e))?.title??e}catch{return e}},[b]),S=Fo(u),C=zi(`/`,{minLength:0}),w=(0,a.useMemo)(()=>S.map(e=>new Ro(e,(0,o.jsx)(`i`,{className:fa(e.type)}))).slice(0,co),[S]),T=(0,a.useCallback)((t,n,r)=>{e.update(()=>{let e=ai(t.name,t.name,t.id);n&&n.replace(e),e.select(),r()})},[e]),E=(0,a.useCallback)(t=>C(t,e)===null?Lo(t):null,[C,e]),D=(0,a.useCallback)(()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),O=(0,a.useCallback)(()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),k=(0,a.useCallback)(()=>{D(),O(),h(null),p(null)},[O,D]),A=(0,a.useCallback)(()=>{D(),O(),l.current=window.setTimeout(()=>{h(null),p(null),l.current=null},uo)},[O,D]),j=(0,a.useCallback)((e,t)=>{let n=Mo(e),r=vr(),i=Mr(t);y(a=>{let o=a.find(e=>e.panelKey===n),s={...e,anchorElement:t,panelKey:n,position:o?.position??i,zIndex:r};return o===void 0?[...a,s]:a.map(e=>e.panelKey===n?s:e)}),k()},[k]),M=(0,a.useCallback)(e=>{y(t=>t.filter(t=>t.panelKey!==e))},[]),N=(0,a.useCallback)(e=>{let t=vr();y(n=>n.map(n=>n.panelKey===e?{...n,zIndex:t}:n))},[]),P=(0,a.useCallback)((e,t)=>{y(n=>{let r=!1,i=n.map(n=>n.panelKey!==e||n.position.left===t.left&&n.position.top===t.top?n:(r=!0,{...n,position:t}));return r?i:n})},[]);return(0,a.useEffect)(()=>{let t=e=>{if(e.getAttribute(`data-lexical-mention-kind`)!==`mention`){e.removeAttribute(`data-lexical-mention-name-type`);return}let t=e.getAttribute(`data-lexical-mention-id`),n=t===null?null:r.getRecordById(t);if(n===null){e.removeAttribute(`data-lexical-mention-name-type`);return}e.setAttribute(`data-lexical-mention-name-type`,Vt(n.type))};return e.registerMutationListener(ii,n=>{e.getEditorState().read(()=>{for(let[r,i]of n){if(i===`destroyed`)continue;let n=e.getElementByKey(r);n instanceof HTMLElement&&t(n)}})},{skipInitialization:!1})},[e,r]),(0,a.useEffect)(()=>{let e=e=>{if(e.button!==0)return;let t=Oo(e.target);if(t===null||!Sr(e,t))return;let n=Ao(r,t);n!==null&&(j(n,t),e.preventDefault(),e.stopPropagation())};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[r,j]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(typeof t!=`object`||!t||!(t.anchorElement instanceof HTMLElement))return;let n=No(r,t);n!==null&&j(n,t.anchorElement)};return window.addEventListener(ir,e),()=>{window.removeEventListener(ir,e)}},[r,j]),(0,a.useEffect)(()=>{let e=e=>{if(ko(e.target)!==null){O();return}let t=Oo(e.target),n=Oo(e.relatedTarget);if(t===null)return;if(t===m){O();return}if(t===n)return;let i=Ao(r,t);i!==null&&(k(),c.current=window.setTimeout(()=>{h(t),p(i),c.current=null},lo))},t=e=>{let t=Oo(e.target),n=ko(e.target),r=Oo(e.relatedTarget),i=ko(e.relatedTarget);if(!(t===null&&n===null)){if(r!==null||i!==null){O();return}A()}};return document.addEventListener(`mouseover`,e),document.addEventListener(`mouseout`,t),()=>{D(),O(),document.removeEventListener(`mouseover`,e),document.removeEventListener(`mouseout`,t)}},[O,D,k,m,r,A]),(0,a.useEffect)(()=>{if(m===null){_(null);return}let e=()=>{if(!m.isConnected){k(),_(null);return}_(jo(m))};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[k,m]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Bi,{onQueryChange:d,onSelectOption:T,triggerFn:E,options:w,menuRenderFn:(e,{selectedIndex:t,selectOptionAndCleanUp:n,setHighlightedIndex:r})=>e.current&&S.length?s.createPortal((0,o.jsx)(`div`,{className:`typeahead-popover mention-name-menu`,style:i,children:(0,o.jsx)(`ul`,{className:`list-unstyled m-0 p-0`,children:w.map((e,i)=>(0,o.jsx)(zo,{index:i,isSelected:t===i,onClick:()=>{r(i),n(e)},onMouseEnter:()=>{r(i)},option:e},e.key))})}),e.current):null}),f!==null&&g!==null?s.createPortal((0,o.jsxs)(`div`,{className:`mention-hover-card`,"data-mention-name-hover-card":`true`,role:`tooltip`,style:{...i,...g},tabIndex:0,onClick:e=>{Do(e.target)||m!==null&&j(f,m)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&m!==null&&!Do(e.target)&&(j(f,m),e.preventDefault())},children:[(0,o.jsxs)(`div`,{className:`mention-hover-card__name d-inline-flex align-items-center gap-2`,children:[(0,o.jsx)(`i`,{className:fa(f.type),"aria-hidden":`true`}),(0,o.jsxs)(`span`,{className:`mention-hover-card__name-text`,children:[f.name,q(f)===null?null:(0,o.jsxs)(`span`,{className:`mention-hover-card__kjv-name`,children:[` `,`(`,q(f),`)`]})]}),(0,o.jsx)(`button`,{"aria-label":`Copy mentioned person name`,className:`mention-hover-card__copy`,title:`Copy name`,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),po(f.name)},children:(0,o.jsx)(`i`,{className:`bi bi-copy`,"aria-hidden":`true`})})]}),f.title?(0,o.jsx)(`div`,{className:`mention-hover-card__title`,children:(0,o.jsx)(Q,{value:f.title})}):null,(0,o.jsx)(To,{includeTitle:!1,mentionPerson:f}),(0,o.jsx)(Eo,{includeTitle:!1,mentionPerson:f,onOpenPersonReference:j})]}),document.body):null,v.map(e=>(0,o.jsx)(ha,{anchorElement:e.anchorElement,copyLabel:`Copy mentioned person details`,iconClassName:fa(e.type),name:e.name,panelKind:`mentioned person`,position:e.position,textStyle:i,title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(To,{mentionPerson:e}),(0,o.jsx)(Eo,{mentionPerson:e,onOpenPersonReference:j})]}),zIndex:e.zIndex,onCopy:async()=>{let{plainText:t,html:r}=qr(await Gr(n,e,x));return xr(t,r)},onBringToFront:()=>{N(e.panelKey)},onClose:()=>{M(e.panelKey)},onPositionChange:t=>{P(e.panelKey,t)}},e.panelKey))]})}var Vo=Object.freeze({" ":`\\t`,"\n":`\\n`}),Ho=new RegExp(Object.keys(Vo).join(`|`),`g`),$=Object.freeze({ancestorHasNextSibling:`|`,ancestorIsLastChild:` `,hasNextSibling:`├`,isLastChild:`└`,selectedChar:`^`,selectedLine:`>`}),Uo=[e=>e.hasFormat(`bold`)&&`Bold`,e=>e.hasFormat(`code`)&&`Code`,e=>e.hasFormat(`italic`)&&`Italic`,e=>e.hasFormat(`strikethrough`)&&`Strikethrough`,e=>e.hasFormat(`subscript`)&&`Subscript`,e=>e.hasFormat(`superscript`)&&`Superscript`,e=>e.hasFormat(`underline`)&&`Underline`,e=>e.hasFormat(`highlight`)&&`Highlight`],Wo=[e=>e.hasTextFormat(`bold`)&&`Bold`,e=>e.hasTextFormat(`code`)&&`Code`,e=>e.hasTextFormat(`italic`)&&`Italic`,e=>e.hasTextFormat(`strikethrough`)&&`Strikethrough`,e=>e.hasTextFormat(`subscript`)&&`Subscript`,e=>e.hasTextFormat(`superscript`)&&`Superscript`,e=>e.hasTextFormat(`underline`)&&`Underline`,e=>e.hasTextFormat(`highlight`)&&`Highlight`],Go=[e=>e.isDirectionless()&&`Directionless`,e=>e.isUnmergeable()&&`Unmergeable`],Ko=[e=>e.isToken()&&`Token`,e=>e.isSegmented()&&`Segmented`];function qo(e,n,i,a,o=!1){let s=e.getEditorState(),c=e._config,l=e._compositionKey,u=e._editable;if(i){let t=``;return s.read(()=>{t=function(e){let t=document.createElement(`div`);return t.innerHTML=e.trim(),rs(t,0).innerHTML}(r.x(e))},{editor:e}),t}let d=` root
9
- `,f=s.read(()=>{let e=t.tt();return Jo(t.Dr(),(n,r,i)=>{let s=`(${n.getKey()})`,c=n.getType()||``,l=n.isSelected(),u=i===void 0?``:`[slot: ${i}] `,f=function(e,n){return n===void 0?``:t.vt(e)&&e.isShadowRoot()?` [shadow-root]`:t.$(e)&&!e.isInline()?` [atomic decorator]`:``}(n,i);d+=`${l?$.selectedLine:` `} ${r.join(` `)} ${s} ${u}${c}${f} ${function(e,n,r=!1){let i=n?n(e,r):void 0;if(i!==void 0&&i.length>0)return i;if(t.Jt(e)){let t=e.getTextContent(),n=t.length===0?`(empty)`:`"${Yo(t,r)}"`,i=function(e){return[Qo(e),Xo(e),Zo(e),ns(e)].filter(Boolean).join(`, `)}(e);return[n,i.length===0?null:`{ ${i} }`].filter(Boolean).join(` `).trim()}if(X(e)){let t=e.getURL(),n=t.length===0?`(empty)`:`"${Yo(t,r)}"`,i=function(e){return[$o(e),es(e),ts(e),ns(e)].filter(Boolean).join(`, `)}(e);return[n,i.length===0?null:`{ ${i} }`].filter(Boolean).join(` `).trim()}if(wi(e))return`ids: [ ${e.getIDs().join(`, `)} ]`;if(t.kn(e)){let t=function(e){let t=Wo.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`format: `+t),t}(e),n=t===``?``:`{ ${t} }`;return n+=e.__style?`(${e.__style})`:``,n}return``}(n,a,o)}\n`,d+=function({indent:e,isSelected:n,node:r,nodeKeyDisplay:i,selection:a,typeDisplay:o}){if(!t.Jt(r)||!t.bn(a)||!n||t.vt(r))return``;let s=a.anchor,c=a.focus;if(r.getTextContent()===``||s.getNode()===a.focus.getNode()&&s.offset===c.offset)return``;let[l,u]=function(e,n){let r=n.getStartEndPoints();if(t.Fr(n)||r===null)return[-1,-1];let[i,a]=r,o=e.getTextContent(),s=o.length,c=-1,l=-1;if(i.type===`text`&&a.type===`text`){let t=i.getNode(),n=a.getNode();t===n&&e===t&&i.offset!==a.offset?[c,l]=i.offset<a.offset?[i.offset,a.offset]:[a.offset,i.offset]:[c,l]=e===t?t.isBefore(n)?[i.offset,s]:[0,i.offset]:e===n?n.isBefore(t)?[a.offset,s]:[0,a.offset]:[0,s]}let u=(o.slice(0,c).match(Ho)||[]).length,d=(o.slice(c,l).match(Ho)||[]).length;return[c+u,l+u+d]}(r,a);if(l===u)return``;let d=e[e.length-1]===$.hasNextSibling?$.ancestorHasNextSibling:$.ancestorIsLastChild,f=[...e.slice(0,e.length-1),d],p=Array(l+1).fill(` `),m=Array(u-l).fill($.selectedChar),h=o.length+2,g=Array(i.length+h).fill(` `);return[$.selectedLine,f.join(` `),[...g,...p,...m].join(``)].join(` `)+`
10
- `}({indent:r,isSelected:l,node:n,nodeKeyDisplay:s,selection:e,typeDisplay:c})}),e===null?`: null`:t.bn(e)?function(e){let n=``,r=Qo(e),i=function(e){let n=e;for(;n!==null;){let e=t.tn(n);if(e!==null){let r=t.wt(n);if(r!==null)return{host:r,name:e}}n=n.getParent()??t.wt(n)}return null}(e.anchor.getNode()),a=i===null?``:` (in slot "${i.name}" of ${i.host.getType()} { key: ${i.host.getKey()} })`;n+=`: range${a} ${r===``?``:`{ ${r} }`} ${e.style===``?``:`{ style: ${e.style} } `}`;let o=e.anchor,s=e.focus,c=o.offset,l=s.offset;return n+=`\n \u251c anchor { key: ${o.key}, offset: ${c===null?`null`:c}, type: ${o.type} }`,n+=`\n \u2514 focus { key: ${s.key}, offset: ${l===null?`null`:l}, type: ${s.type} }`,n}(e):H(e)?function(e){return`: table\n \u2514 { table: ${e.tableKey}, anchorCell: ${e.anchor.key}, focusCell: ${e.focus.key} }`}(e):function(e){return t.Fr(e)?`: node\n \u2514 [${Array.from(e._nodes).join(`, `)}]`:``}(e)},{editor:e});if(d+=`
8
+ `),html:n.join(``)}}var Jr=class e extends t.Wt{__className;static getType(){return`emoji`}static clone(t){return new e(t.__className,t.__text,t.__key)}constructor(e,t,n){super(t,n),this.__className=e}createDOM(e){let t=document.createElement(`span`),n=super.createDOM(e);return t.className=this.__className,n.className=`emoji-inner`,t.appendChild(n),t}updateDOM(e,t,n){let r=t.firstChild;return r===null?!0:(super.updateDOM(e,r,n),!1)}static importJSON(e){return Yr(e.className,e.text).updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),className:this.getClassName()}}getClassName(){return this.getLatest().__className}};function Yr(e,n){return t.o(new Jr(e,n).setMode(`token`))}var Xr=class e extends t.Wt{static getType(){return`keyword`}static clone(t){return new e(t.__text,t.__key)}static importJSON(e){return Zr().updateFromJSON(e)}createDOM(e){let t=super.createDOM(e);return t.style.cursor=`default`,t.className=`keyword`,t}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}isTextEntity(){return!0}};function Zr(e=``){return t.o(new Xr(e))}function Qr(e){return e===`mention`||e===`location`||e===`bible-verse`?e:e===`hashtag`?`location`:void 0}function $r(e,t,n){let r=Qr(n);return r===void 0?e.startsWith(`#`)||t.startsWith(`#`)?`location`:e.startsWith(`^`)||t.startsWith(`^`)?`bible-verse`:`mention`:r}function ei(e,t){return t===`location`&&e.startsWith(`#`)||t===`bible-verse`&&e.startsWith(`^`)?e.slice(1):e}function ti(e,t,n){return n===`location`&&e.startsWith(`#`)?t:n===`bible-verse`&&e.startsWith(`^`)?e.slice(1):e}function ni(e,t,n,r,i,a){e.setAttribute(`data-lexical-mention`,`true`),e.setAttribute(`data-lexical-mention-kind`,n),r===null?e.removeAttribute(`data-lexical-mention-id`):e.setAttribute(`data-lexical-mention-id`,r),i===null?e.removeAttribute(`data-lexical-mention-data`):e.setAttribute(`data-lexical-mention-data`,i),a?e.setAttribute(`data-lexical-mention-name`,t):e.removeAttribute(`data-lexical-mention-name`)}function ri(e){let t=e.textContent,n=e.getAttribute(`data-lexical-mention-data`),r=e.getAttribute(`data-lexical-mention-id`),i=e.getAttribute(`data-lexical-mention-name`),a=e.getAttribute(`data-lexical-mention-kind`);if(t!==null){let e=$r(typeof i==`string`?i:t,t,a===`mention`||a===`location`||a===`bible-verse`||a===`hashtag`?a:void 0),o=ei(typeof i==`string`?i:t,e);return{node:ai(o,ti(t,o,e),r,e,n)}}return null}var ii=class e extends t.Wt{__mention;__mentionData;__mentionId;__mentionKind;static getType(){return`mention`}static clone(t){return new e(t.__mention,t.__text,t.__mentionId,t.__mentionKind,t.__mentionData,t.__key)}static importJSON(e){let t=$r(e.mentionName,e.text,e.mentionKind),n=ei(e.mentionName,t),r=ti(e.text,n,t);return ai(n,r,e.mentionId??null,t,e.mentionData??null).updateFromJSON({...e,mentionKind:t,mentionName:n,text:r})}updateFromJSON(e){let t=$r(e.mentionName,e.text,e.mentionKind),n=ei(e.mentionName,t),r=ti(e.text,n,t),i=super.updateFromJSON({...e,text:r});return i.__mention=n,i.__mentionData=e.mentionData??null,i.__mentionId=e.mentionId??null,i.__mentionKind=t,i}constructor(e,t,n,r,i,a){let o=$r(e,t??e,r),s=ei(e,o),c=ti(t??e,s,o);super(c,a),this.__mention=s,this.__mentionData=i??null,this.__mentionId=n??null,this.__mentionKind=o}exportJSON(){return{...super.exportJSON(),mentionData:this.__mentionData,mentionId:this.__mentionId,mentionKind:this.__mentionKind,mentionName:this.__mention}}getMentionKind(){return this.getLatest().__mentionKind}setMentionKind(e){let t=this.getWritable();return t.__mentionKind=e,t}getMention(){return this.getLatest().__mention}setMention(e){let t=this.getWritable();return t.__mention=e,t}getMentionData(){return this.getLatest().__mentionData}setMentionData(e){let t=this.getWritable();return t.__mentionData=e,t}createDOM(e){let t=super.createDOM(e);return t.className=`mention`,t.spellcheck=!1,ni(t,this.__mention,this.__mentionKind,this.__mentionId,this.__mentionData,!0),t}updateDOM(e,t,n){let r=super.updateDOM(e,t,n),i=this.__mentionKind;return(e.__mention!==this.__mention||e.__mentionData!==this.__mentionData||e.__mentionId!==this.__mentionId||e.__mentionKind!==this.__mentionKind||e.__text!==this.__text||t.getAttribute(`data-lexical-mention-kind`)!==i||t.getAttribute(`data-lexical-mention-data`)!==this.__mentionData)&&ni(t,this.__mention,this.__mentionKind,this.__mentionId,this.__mentionData,!0),r}exportDOM(){let e=document.createElement(`span`);return ni(e,this.__mention,this.__mentionKind,this.__mentionId,this.__mentionData,this.__text!==this.__mention),e.textContent=this.__text,{element:e}}static importDOM(){return{span:e=>e.hasAttribute(`data-lexical-mention`)?{conversion:ri,priority:1}:null}}isTextEntity(){return!0}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function ai(e,n,r,i,a){let o=new ii(e,n,r,i,a);return o.setMode(`segmented`).toggleDirectionless(),t.o(o)}var oi=a.lazy(()=>Promise.resolve().then(()=>require("./MediaComponent-qZBSiJiq.cjs")));function si(e){return e.parentElement!=null&&e.parentElement.tagName===`LI`&&e.previousSibling===null&&e.getAttribute(`aria-roledescription`)===`checkbox`}function ci(e){let t=e,n=t.getAttribute(`src`);if(!n||n.startsWith(`file:///`)||si(t))return null;let{alt:r,width:i,height:a}=t;return{node:hi({altText:r,height:a,src:n,width:i})}}function li(e){let t=e,n=t.getAttribute(`src`)||t.currentSrc;return n?{node:hi({altText:t.getAttribute(`title`)||``,height:t.height,mediaType:`video`,src:n,width:t.width})}:null}function ui(e){let t=e,n=t.getAttribute(`src`)||t.currentSrc;return n?{node:hi({altText:t.getAttribute(`title`)||``,height:Number(t.getAttribute(`height`))||void 0,mediaType:`audio`,src:n,width:Number(t.getAttribute(`width`))||void 0})}:null}function di(e){let t=e.getAttribute(`src`)||e.getAttribute(`data`)||``,n=e.getAttribute(`type`)||``;return(e.getAttribute(`data-lexical-media-type`)||``)===`pdf`||n===`application/pdf`||t.toLowerCase().split(/[?#]/)[0].endsWith(`.pdf`)}function fi(e){let t=e,n=t.getAttribute(`src`)||t.getAttribute(`data`);return!n||!di(t)?null:{node:hi({altText:t.getAttribute(`title`)||``,height:Number(t.getAttribute(`height`))||void 0,mediaType:`pdf`,src:n,width:Number(t.getAttribute(`width`))||void 0})}}function pi(){for(let{origin:e}of t.Ft(t.Z(t.Dr(),`next`)))if(!t.vt(e))return!1;return!0}var mi=class e extends t.I{__src;__altText;__width;__height;__maxWidth;__mediaType;__previewSrc;__showCaption;__caption;__captionsEnabled;static getType(){return`image`}static clone(t){return new e(t.__src,t.__altText,t.__maxWidth,t.__width,t.__height,t.__showCaption,t.__caption,t.__captionsEnabled,t.__key,t.__mediaType,t.__previewSrc)}static importJSON(e){let{altText:t,height:n,mediaType:r,width:i,maxWidth:a,src:o,showCaption:s}=e;return hi({altText:t,height:n,maxWidth:a,mediaType:r,showCaption:s,src:o,width:i}).updateFromJSON(e)}updateFromJSON(e){let t=super.updateFromJSON(e),{caption:n}=e,r=t.__caption,i=r.parseEditorState(n.editorState);return i.isEmpty()||r.setEditorState(i),t}exportDOM(){let e=this.createMediaDOMElement();if(this.__showCaption&&this.__caption){let n=this.__caption,i=n.read(()=>{if(pi())return null;let e=null,i=t.Dr().getFirstChild();return t.kn(i)&&i.getNextSibling()===null&&(e=t.h(),e.anchor.set(i.getKey(),0,`element`),e.focus.set(i.getKey(),i.getChildrenSize(),`element`)),r.x(n,e)});if(i){let t=document.createElement(`figure`),n=document.createElement(`figcaption`);return n.innerHTML=i,t.appendChild(e),t.appendChild(n),{element:t}}}return{element:e}}createMediaDOMElement(){if(this.__mediaType===`video`){let e=document.createElement(`video`);return e.setAttribute(`src`,this.__src),e.setAttribute(`title`,this.__altText),e.setAttribute(`width`,this.__width.toString()),e.setAttribute(`height`,this.__height.toString()),e.setAttribute(`controls`,`true`),e.setAttribute(`data-lexical-media-type`,`video`),e}if(this.__mediaType===`pdf`){let e=document.createElement(`iframe`);return e.setAttribute(`src`,this.__src),e.setAttribute(`title`,this.__altText||`PDF`),e.setAttribute(`width`,this.__width.toString()),e.setAttribute(`height`,this.__height.toString()),e.setAttribute(`data-lexical-media-type`,`pdf`),e}if(this.__mediaType===`audio`){let e=document.createElement(`audio`);return e.setAttribute(`src`,this.__src),e.setAttribute(`title`,this.__altText),e.setAttribute(`controls`,`true`),e.setAttribute(`data-lexical-media-type`,`audio`),this.__width!==`inherit`&&e.setAttribute(`width`,this.__width.toString()),this.__height!==`inherit`&&e.setAttribute(`height`,this.__height.toString()),e}let e=document.createElement(`img`);return e.setAttribute(`src`,this.__src),e.setAttribute(`alt`,this.__altText),e.setAttribute(`width`,this.__width.toString()),e.setAttribute(`height`,this.__height.toString()),e}static importDOM(){return{audio:()=>({conversion:ui,priority:0}),embed:()=>({conversion:fi,priority:0}),figcaption:()=>({conversion:()=>({node:null}),priority:0}),figure:()=>({conversion:e=>({after:n=>{let i=n.filter(gi),a=e.querySelector(`figcaption`);if(a)for(let e of i)e.setShowCaption(!0),e.__caption.update(()=>{let e=t.s();r.l(e,r.j(e,a),t.Zr()),t.En(null)},{tag:t.gn});return i},node:null}),priority:0}),img:()=>({conversion:ci,priority:0}),iframe:e=>di(e)?{conversion:fi,priority:0}:null,object:()=>({conversion:fi,priority:0}),video:()=>({conversion:li,priority:0})}}constructor(e,n,r,i,a,o,s,c,l,u=`image`,d){super(l),this.__src=e,this.__altText=n,this.__maxWidth=r,this.__width=i||`inherit`,this.__height=a||`inherit`,this.__mediaType=u,this.__previewSrc=d,this.__showCaption=o||!1,this.__caption=s||t.mr({namespace:`Playground/MediaNodeCaption`,nodes:[t.q,t.Wt,t.H,t.Et,_n,Jr,Xr,ii]}),this.__captionsEnabled=c||c===void 0}exportJSON(){return{...super.exportJSON(),altText:this.getAltText(),caption:this.__caption.toJSON(),height:this.__height===`inherit`?0:this.__height,maxWidth:this.__maxWidth,mediaType:this.__mediaType,showCaption:this.__showCaption,src:this.getSrc(),width:this.__width===`inherit`?0:this.__width}}setWidthAndHeight(e,t){let n=this.getWritable();n.__width=e,n.__height=t}setShowCaption(e){let t=this.getWritable();t.__showCaption=e}createDOM(e){let t=document.createElement(`span`),n=e.theme.image;return n!==void 0&&(t.className=n),t}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__altText}getMediaType(){return this.__mediaType}decorate(){return(0,o.jsx)(oi,{src:this.__src,altText:this.__altText,mediaType:this.__mediaType,previewSrc:this.__previewSrc,width:this.__width,height:this.__height,maxWidth:this.__maxWidth,nodeKey:this.getKey(),showCaption:this.__showCaption,caption:this.__caption,captionsEnabled:this.__captionsEnabled,resizable:!0})}};function hi({altText:e,height:n,maxWidth:r=500,captionsEnabled:i,mediaType:a,previewSrc:o,src:s,width:c,showCaption:l,caption:u,key:d}){return t.o(new mi(s,e,r,c,n,l,u,i,d,a,o))}function gi(e){return e instanceof mi}var _i=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]);function vi(e){try{let t=new URL(e);if(!_i.has(t.protocol))return`about:blank`}catch{return e}return e}var yi=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function bi(e){return e===`https://`||yi.test(e)}var xi=[],Si=class e extends t.m{__ids;static getType(){return`mark`}static clone(t){return new e(t.__ids,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__ids=e.__ids}static importDOM(){return null}static importJSON(e){return Ci().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIDs(e.ids)}exportJSON(){return{...super.exportJSON(),ids:this.getIDs()}}constructor(e=xi,t){super(t),this.__ids=e}createDOM(e){let n=t.qt().createElement(`mark`);return t.Vr(n,e.theme.mark),this.__ids.length>1&&t.Vr(n,e.theme.markOverlap),n}updateDOM(e,n,r){let i=e.__ids,a=this.__ids,o=i.length,s=a.length,c=r.theme.markOverlap;return o!==s&&(o===1?s===2&&t.Vr(n,c):s===1&&t.Pt(n,c)),!1}hasID(e){return this.getIDs().includes(e)}getIDs(){return Array.from(this.getLatest().__ids)}setIDs(e){let t=this.getWritable();return t.__ids=e,t}addID(e){let t=this.getWritable();return t.__ids.includes(e)?t:t.setIDs([...t.__ids,e])}deleteID(e){let t=this.getWritable(),n=t.__ids.indexOf(e);if(n===-1)return t;let r=Array.from(t.__ids);return r.splice(n,1),t.setIDs(r)}insertNewAfter(e,t=!0){let n=Ci(this.__ids);return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n,r){if(!t.bn(n)||r===`html`)return!1;let i=n.anchor,a=n.focus,o=i.getNode(),s=a.getNode(),c=n.isBackward()?i.offset-a.offset:a.offset-i.offset;return this.isParentOf(o)&&this.isParentOf(s)&&this.getTextContent().length===c}excludeFromCopy(e){return e!==`clone`}};function Ci(e=xi){return t.o(new Si(e))}function wi(e){return e instanceof Si}function Ti(e){let t=e.getChildren(),n=null;for(let r=0;r<t.length;r++){let i=t[r];n===null?e.insertBefore(i):n.insertAfter(i),n=i}e.remove()}function Ei(e,n,r,i){let a=t.h(),[o,s]=e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus],c,l;a.anchor.set(o.key,o.offset,o.type),a.focus.set(s.key,s.offset,s.type);let u=a.extract();for(let e of u){if(t.vt(l)&&l.isParentOf(e))continue;let n=null;if(t.Jt(e))n=e;else{if(wi(e))continue;(t.vt(e)||t.$(e))&&e.isInline()&&(n=e)}if(n!==null){if(n&&n.is(c))continue;let e=n.getParent();e!=null&&e.is(c)||(l=void 0),c=e,l===void 0&&(l=(i||Ci)([r]),n.insertBefore(l)),l.append(n)}else c=void 0,l=void 0}t.vt(l)&&(n?l.selectStart():l.selectEnd())}function Di(e,n){let r=e;for(;r!==null;){if(wi(r))return r.getIDs();if(t.Jt(r)&&n===r.getTextContentSize()){let e=r.getNextSibling();if(wi(e))return e.getIDs()}r=r.getParent()}return null}var Oi=t.ar?a.useLayoutEffect:a.useEffect,ki=class{key;ref;icon;title;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}},Ai=e=>{let t=e.closest(`#typeahead-menu`);if(!t)return;let n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:`center`}),n.top<0&&t.scrollIntoView({block:`center`}),e.scrollIntoView({block:`nearest`})};function ji(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top>=r.top-6&&n.top<=r.bottom+6}function Mi(e,r,i,o){let[s]=t.oi();(0,a.useEffect)(()=>{if(r!=null&&e!=null){let e=s.getRootElement(),a=e==null?document.body:n.C(e,!1),c=!1,l=ji(r,a),u=function(){c||=(window.requestAnimationFrame(function(){i(),c=!1}),!0);let e=ji(r,a);e!==l&&(l=e,o?.(e))},d=new ResizeObserver(i),f=t.vr(e??r);return d.observe(r),t.Yn(t.yt(window,`resize`,i),t.yt(document,`scroll`,u,{capture:!0,passive:!0}),...f.map(e=>t.yt(e,`scroll`,u,{capture:!0,passive:!0})),()=>d.unobserve(r))}},[r,s,o,i,e])}var Ni=t.x(`SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND`);function Pi({index:e,isSelected:t,onClick:n,onMouseEnter:r,option:i}){let a=`item`;return t&&(a+=` selected`),(0,o.jsxs)(`li`,{tabIndex:-1,className:a,ref:i.setRefElement,role:`option`,"aria-selected":t,id:`typeahead-item-`+e,onMouseEnter:r,onClick:n,children:[i.icon,(0,o.jsx)(`span`,{className:`text`,children:i.title})]},i.key)}function Fi({close:e,editor:n,anchorElementRef:r,resolution:i,options:c,menuRenderFn:l,onSelectOption:u,shouldSplitNodeWithQuery:d=!1,commandPriority:f=1,preselectFirstItem:p=!0}){let[m,h]=(0,a.useState)(null),g=m===null?null:Math.min(c.length-1,m);(0,a.useEffect)(()=>{p&&h(0)},[i.match&&i.match.matchingString,p]);let _=(0,a.useCallback)(r=>{n.update(()=>{u(r,i.match!=null&&d?function(e){let n=t.tt();if(!t.bn(n)||!n.isCollapsed())return null;let r=n.anchor;if(r.type!==`text`)return null;let i=r.getNode();if(!i.isSimpleText())return null;let a=r.offset,o=i.getTextContent().slice(0,a),s=e.replaceableString.length,c=a-function(e,t,n){let r=n;for(let n=r;n<=t.length;n++)e.slice(-n)===t.substring(0,n)&&(r=n);return r}(o,e.matchingString,s);if(c<0)return null;let l;return c===0?[l]=i.splitText(a):[,l]=i.splitText(c,a),l}(i.match):null,e,i.match?i.match.matchingString:``)})},[n,d,i.match,u,e]),v=(0,a.useCallback)(e=>{let t=n.getRootElement();t!==null&&(t.setAttribute(`aria-activedescendant`,`typeahead-item-`+e),h(e))},[n]),y=(0,a.useCallback)(()=>r.current&&c.length?s.default.createPortal((0,o.jsx)(`div`,{className:`typeahead-popover mentions-menu`,children:(0,o.jsx)(`ul`,{children:c.map((e,t)=>(0,o.jsx)(Pi,{index:t,isSelected:g===t,onClick:()=>{h(t),_(e)},onMouseEnter:()=>{h(t)},option:e},e.key))})}),r.current):null,[r,c,g,_,h]);(0,a.useEffect)(()=>()=>{let e=n.getRootElement();e!==null&&e.removeAttribute(`aria-activedescendant`)},[n]),Oi(()=>{c===null?h(null):g===null&&p&&v(0)},[c,g,v,p]),(0,a.useEffect)(()=>t.Yn(n.registerCommand(Ni,({option:e})=>!(!e.ref||e.ref.current==null)&&(Ai(e.ref.current),!0),f)),[n,v,f]),(0,a.useEffect)(()=>t.Yn(n.registerCommand(t.Qn,e=>{let t=e;if(c!==null&&c.length){let e=g===null||g===c.length-1?0:g+1;v(e);let r=c[e];if(!r)return v(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;r.ref&&r.ref.current&&n.dispatchCommand(Ni,{index:e,option:r}),t.preventDefault(),t.stopImmediatePropagation()}return!0},f),n.registerCommand(t.Cr,e=>{let t=e;if(c!==null&&c.length){let e=g===null||g===0?c.length-1:g-1;v(e);let n=c[e];if(!n)return v(-1),t.preventDefault(),t.stopImmediatePropagation(),!0;n.ref&&n.ref.current&&Ai(n.ref.current),t.preventDefault(),t.stopImmediatePropagation()}return!0},f),n.registerCommand(t.jn,t=>{let n=t;return n.preventDefault(),n.stopImmediatePropagation(),e(),!0},f),n.registerCommand(t.zn,e=>{let t=e;return c!==null&&g!==null&&c[g]!=null&&(t.preventDefault(),t.stopImmediatePropagation(),_(c[g]),!0)},f),n.registerCommand(t.yn,e=>!(c===null||g===null||c[g]==null||e&&e.shiftKey)&&(e!==null&&(e.preventDefault(),e.stopImmediatePropagation()),_(c[g]),!0),f)),[_,e,n,c,g,v,f]);let b=(0,a.useMemo)(()=>({options:c,selectOptionAndCleanUp:_,selectedIndex:g,setHighlightedIndex:h}),[_,g,c]);return l==null?y():l(r,b,i.match?i.match.matchingString:``)}function Ii(e,t){t!=null&&(e.className=t),e.setAttribute(`aria-label`,`Typeahead menu`),e.setAttribute(`role`,`listbox`),e.style.display=`block`,e.style.position=`absolute`}function Li(e,n,r,i,o=!0){let[s]=t.oi(),c=i??function(e){if(!t.ar)return;let n=e.getRootElement();if(n!==null){let e=n.getRootNode();return t.Gn(e)?e:n.ownerDocument.body}return document.body}(s),l=t.ar?t.E(s.getRootElement()).createElement(`div`):null,u=(0,a.useRef)(l),d=(0,a.useCallback)(()=>{if(u.current===null||c===void 0)return;u.current.style.top=u.current.style.bottom;let t=s.getRootElement(),n=u.current,i=n.firstChild;if(t!==null&&e!==null){let{left:a,top:s,width:l,height:d}=e.getRect(),f=u.current.offsetHeight;if(n.style.top=`${s+f+3+(o?window.pageYOffset:0)}px`,n.style.left=`${a+window.pageXOffset}px`,n.style.height=`${d}px`,n.style.width=`${l}px`,i!==null){i.style.top=`${s}`;let e=i.getBoundingClientRect(),r=e.height,c=e.width,l=t.getBoundingClientRect();a+c>l.right&&(n.style.left=`${l.right-c+window.pageXOffset}px`),(s+r>window.innerHeight||s+r>l.bottom)&&s-l.top>r+d&&(n.style.top=`${s-r-d+(o?window.pageYOffset:0)}px`)}n.isConnected||(Ii(n,r),c.append(n)),n.setAttribute(`id`,`typeahead-menu`),t.setAttribute(`aria-controls`,`typeahead-menu`)}},[s,e,o,r,c]);(0,a.useEffect)(()=>{let t=s.getRootElement();return e!==null&&d(),()=>{t!==null&&t.removeAttribute(`aria-controls`);let e=u.current;e!==null&&e.isConnected&&(e.remove(),e.removeAttribute(`id`))}},[s,d,e]);let f=(0,a.useCallback)(t=>{e!==null&&(t||n(null))},[e,n]);return Mi(e,u.current,d,f),l!=null&&l===u.current&&(Ii(l,r),c?.append(l)),u}var Ri=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function zi(e,{minLength:t=1,maxLength:n=75,punctuation:r=Ri,allowWhitespace:i=!1}){return(0,a.useCallback)(a=>{let o=RegExp(`(^|\\s|\\()([`+e+`]((?:`+(`[^`+e+r+(i?``:`\\s`)+`]`)+`){0,`+n+`}))$`).exec(a);if(o!==null){let e=o[1],n=o[3];if(n.length>=t)return{leadOffset:o.index+e.length,matchingString:n,replaceableString:o[2]}}return null},[i,e,r,n,t])}function Bi({options:e,onQueryChange:n,onSelectOption:r,onOpen:i,onClose:s,menuRenderFn:c,triggerFn:l,anchorClassName:u,commandPriority:d=1,parent:f,preselectFirstItem:p=!0,ignoreEntityBoundary:m=!1}){let[h]=t.oi(),[g,_]=(0,a.useState)(null),v=Li(g,_,u,f),y=(0,a.useCallback)(()=>{if(g===null)return;let e=()=>{_(null)},t;try{t=s&&s()}finally{t?t.then(e,e):e()}},[s,g]),b=(0,a.useCallback)(e=>{_(e),i!=null&&g===null&&i(e)},[i,g]);return(0,a.useEffect)(()=>{let e=h.registerUpdateListener(()=>{h.read(`latest`,()=>{if(!h.isEditable())return void y();if(h.isComposing())return;let e=h._window||window,r=e.document.createRange(),i=t.tt(),o=function(e){let n=null;return e.read(`latest`,()=>{let e=t.tt();t.bn(e)&&(n=function(e){let t=e.anchor;if(t.type!==`text`)return null;let n=t.getNode();if(!n.isSimpleText())return null;let r=t.offset;return n.getTextContent().slice(0,r)}(e))}),n}(h);if(!t.bn(i)||!i.isCollapsed()||o===null||r===null)return void y();let s=l(o,h);if(n(s?s.matchingString:null),s!==null&&(m||!function(e,n){return n===0&&e.read(`latest`,()=>{let e=t.tt();if(t.bn(e)){let n=e.anchor.getNode().getPreviousSibling();return t.Jt(n)&&n.isTextEntity()}return!1})}(h,s.leadOffset))&&function(e,n,r,i){let a=t.M(r);if(a===null||!a.isCollapsed)return!1;let o=t.Er(a,i),s=o.anchorNode,c=e,l=o.anchorOffset;if(s==null||l==null)return!1;try{n.setStart(s,c),n.setEnd(s,l)}catch{return!1}return!0}(s.leadOffset,r,e,h.getRootElement())!==null)return void(0,a.startTransition)(()=>b({getRect:()=>r.getBoundingClientRect(),match:s}));y()})});return()=>{e()}},[h,l,n,g,y,b,m]),(0,a.useEffect)(()=>h.registerEditableListener(e=>{e||y()}),[h,y]),g===null||h===null||v.current===null?null:(0,o.jsx)(Fi,{close:y,resolution:g,editor:h,anchorElementRef:v,options:e,menuRenderFn:c,shouldSplitNodeWithQuery:!0,onSelectOption:r,commandPriority:d,preselectFirstItem:p})}var Vi=`lexical-playground-media-files`,Hi=`media-files`,Ui=1;function Wi(){return typeof window>`u`||!window.indexedDB?null:window.indexedDB}function Gi(){let e=Wi();return e===null?Promise.resolve(null):new Promise(t=>{let n=e.open(Vi,Ui);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Hi)||e.createObjectStore(Hi,{keyPath:`src`})},n.onsuccess=()=>{t(n.result)},n.onerror=()=>{t(null)}})}function Ki(e){e.close()}async function qi(e,t){if(e.trim()===``)return;let n=await Gi();n!==null&&await new Promise(r=>{let i=n.transaction(Hi,`readwrite`),a=i.objectStore(Hi),o={file:t,name:t.name,src:e,type:t.type,updatedAt:Date.now()};i.oncomplete=()=>{Ki(n),r()},i.onerror=()=>{Ki(n),r()},i.onabort=()=>{Ki(n),r()},a.put(o)})}async function Ji(e){if(e.trim()===``||typeof URL.createObjectURL!=`function`)return;let t=await Gi();if(t===null)return;let n=await new Promise(n=>{let r=t.transaction(Hi,`readonly`),i=r.objectStore(Hi).get(e);i.onsuccess=()=>{let e=i.result;n(e?.file)},i.onerror=()=>{n(void 0)},r.oncomplete=()=>{Ki(t)},r.onerror=()=>{Ki(t)},r.onabort=()=>{Ki(t)}});return n?URL.createObjectURL(n):void 0}var Yi=/^[a-z][a-z\d+.-]*:/i,Xi=/^(?:blob|data|https?):/i;function Zi(e){return typeof e==`string`?e.trim()===``?null:e:null}function Qi(e){return e.path||e.webkitRelativePath||e.name}async function $i(e,t,n){if(e===void 0)return null;try{return Zi(await e(t,{source:n}))}catch{return null}}function ea(e){let t=e.trim();return t===``||Xi.test(t)?!1:t.startsWith(`file://`)||/^[a-z]:[\\/]/i.test(t)||t.startsWith(`\\\\`)||/^\.{1,2}[\\/]/.test(t)||t.startsWith(`/`)||!Yi.test(t)&&/[\\/]/.test(t)}var ta=new Map([[`:)`,[`emoji happysmile`,`🙂`]],[`:D`,[`emoji veryhappysmile`,`😀`]],[`:(`,[`emoji unhappysmile`,`🙁`]],[`<3`,[`emoji heart`,`❤`]]]);function na(e){let t=e.getTextContent();for(let n=0;n<t.length;n++){let r=ta.get(t[n])||ta.get(t.slice(n,n+2));if(r!==void 0){let[t,i]=r,a;n===0?[a]=e.splitText(n+2):[,a]=e.splitText(n,n+2);let o=Yr(t,i);return a.replace(o),o}}return null}function ra(e){let t=e;for(;t!==null;){if(!t.isSimpleText())return;t=na(t)}}function ia(e){(0,a.useEffect)(()=>{if(!e.hasNodes([Jr]))throw Error(`EmojisPlugin: EmojiNode not registered on editor`);return e.registerNodeTransform(t.Wt,ra)},[e])}function aa(){let[e]=t.oi();return ia(e),null}function oa(e,n,i){let[o]=t.oi();(0,a.useEffect)(()=>t.Yn(...r.R(o,e,n,i)),[i,o,e,n])}var sa=/(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])(congrats|congratulations|gratuluju|gratuluji|gratulujeme|blahopřeju|blahopřeji|blahopřejeme|Til lykke|Tillykke|Glückwunsch|Gratuliere|felicitaciones|enhorabuena|paljon onnea|onnittelut|Félicitations|gratula|gratulálok|gratulálunk|congratulazioni|complimenti|おめでとう|おめでとうございます|축하해|축하해요|gratulerer|Gefeliciteerd|gratulacje|Parabéns|parabéns|felicitações|felicitări|мои поздравления|поздравляем|поздравляю|gratulujem|blahoželám|ยินดีด้วย|ขอแสดงความยินดี|tebrikler|tebrik ederim|恭喜|祝贺你|恭喜你|恭喜|恭喜|baie geluk|veels geluk|অভিনন্দন|Čestitam|Čestitke|Čestitamo|Συγχαρητήρια|Μπράβο|અભિનંદન|badhai|बधाई|अभिनंदन|Честитам|Свака част|hongera|வாழ்த்துகள்|வாழ்த்துக்கள்|అభినందనలు|അഭിനന്ദനങ്ങൾ|Chúc mừng|מזל טוב|mazel tov|mazal tov)(^|$|[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ])/i;function ca(){let[e]=t.oi();(0,a.useEffect)(()=>{if(!e.hasNodes([Xr]))throw Error(`KeywordsPlugin: KeywordNode not registered on editor`)},[e]);let n=(0,a.useCallback)(e=>Zr(e.getTextContent()),[]);return oa((0,a.useCallback)(e=>{let t=sa.exec(e);if(t===null)return null;let n=t[2].length,r=t.index+t[1].length;return{end:r+n,start:r}},[]),Xr,n),null}function la({validateUrl:e,attributes:n}){let[i]=t.oi();return(0,a.useEffect)(()=>{if(!i.hasNodes([_n]))throw Error(`LinkPlugin: LinkNode not registered on editor`)}),(0,a.useEffect)(()=>An(i,r.V({attributes:n,validateUrl:e})),[i,e,n]),null}function ua({hasLinkAttributes:e=!1}){return(0,o.jsx)(la,{validateUrl:bi,attributes:e?{rel:`noopener noreferrer`,target:`_blank`}:void 0})}var da={concept:`bi-lightbulb-fill`,deity:`bi-brightness-high-fill`,group:`bi-people-fill`,life:`bi-heart-fill`,month:`bi-calendar-event-fill`,person:`bi-person-fill`,place:`bi-geo-alt-fill`,supernatural:`bi-stars`,unknown:`bi-question-circle-fill`};function fa(e){return`bi ${da[Ht(e)]} icon`}var pa=1600;function ma(e,t){return e.left===t.left&&e.top===t.top}function ha({anchorElement:e,iconClassName:t,name:n,nameContent:r,panelKind:i,position:s,copyLabel:c,textStyle:l,title:u,zIndex:d,onBringToFront:f,onClose:p,onCopy:m,onPositionChange:h}){let g=(0,a.useRef)(null),_=(0,a.useRef)(null),v=(0,a.useRef)(e),y=(0,a.useRef)(h),b=(0,a.useRef)(null),[x,S]=(0,a.useState)(!1),[C,w]=(0,a.useState)(!1);v.current=e,y.current=h,(0,a.useEffect)(()=>()=>{b.current!==null&&clearTimeout(b.current)},[]);let T=(0,a.useCallback)(()=>{m!==void 0&&Promise.resolve(m()).then(()=>{w(!0),b.current!==null&&clearTimeout(b.current),b.current=setTimeout(()=>{w(!1),b.current=null},pa)})},[m]),E=(0,a.useCallback)(e=>{let t=_.current;t===null||t.pointerId!==e.pointerId||(y.current(jr({left:t.startLeft+e.clientX-t.startClientX,top:t.startTop+e.clientY-t.startClientY},g.current,v.current)),e.preventDefault())},[]),D=(0,a.useCallback)(e=>{let t=_.current;t===null||t.pointerId!==e.pointerId||(_.current=null,S(!1),document.removeEventListener(`pointermove`,E),document.removeEventListener(`pointerup`,D),document.removeEventListener(`pointercancel`,D),e.preventDefault())},[E]),O=(0,a.useCallback)(e=>{e.button===0&&(e.target instanceof Element&&e.target.closest(`button, .mention-advanced-panel__name`)||(f(),_.current={pointerId:e.pointerId,startClientX:e.clientX,startClientY:e.clientY,startLeft:s.left,startTop:s.top},S(!0),document.addEventListener(`pointermove`,E),document.addEventListener(`pointerup`,D),document.addEventListener(`pointercancel`,D),e.preventDefault(),e.stopPropagation()))},[E,D,f,s.left,s.top]);(0,a.useEffect)(()=>()=>{document.removeEventListener(`pointermove`,E),document.removeEventListener(`pointerup`,D),document.removeEventListener(`pointercancel`,D)},[E,D]),(0,a.useEffect)(()=>{let t=()=>{let t=jr(s,g.current,e);ma(t,s)||h(t)};return t(),window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0)}},[e,h,s]);let k=wr(e),A=Er(g.current,e),j={left:s.left/A,maxHeight:Math.max(96,k.bottom-s.top)/A,maxWidth:Math.max(220,k.right-s.left)/A,position:`fixed`,top:s.top/A,zIndex:d};return(0,o.jsxs)(`div`,{ref:g,"aria-label":`${n} advanced panel`,className:`mention-advanced-panel${x?` dragging`:``}`,role:`dialog`,style:j,tabIndex:0,onFocus:f,onPointerDown:f,children:[(0,o.jsxs)(`div`,{className:`mention-advanced-panel__header`,onPointerDown:O,children:[(0,o.jsxs)(`div`,{className:`mention-advanced-panel__name d-inline-flex align-items-center gap-2`,style:l,children:[(0,o.jsx)(`i`,{className:t,"aria-hidden":`true`}),r??(0,o.jsx)(`span`,{children:n})]}),(0,o.jsxs)(`div`,{className:`mention-advanced-panel__actions`,children:[m===void 0?null:(0,o.jsx)(`button`,{"aria-label":C?`Copied`:c??`Copy ${i} text`,className:`mention-advanced-panel__copy${C?` mention-advanced-panel__copy--copied`:``}`,title:C?`Copied!`:`Copy`,type:`button`,onClick:T,children:(0,o.jsx)(`i`,{className:C?`bi bi-check2`:`bi bi-copy`,"aria-hidden":`true`})}),(0,o.jsx)(`button`,{"aria-label":`Close ${i} panel`,className:`mention-advanced-panel__close`,title:`Close`,type:`button`,onClick:p,children:(0,o.jsx)(`i`,{className:`bi bi-x-lg`,"aria-hidden":`true`})})]})]}),u?(0,o.jsx)(`div`,{className:`mention-advanced-panel__title`,style:l,children:u}):null]})}var ga=3;function _a({menuHeight:e,menuWidth:t,rootRect:n,scrollX:r,scrollY:i,triggerRect:a,viewportHeight:o}){let{height:s,left:c,top:l}=a,u=c+t>n.right?n.right-t:c,d=l+e>o||l+e>n.bottom,f=l-n.top>e+s,p=d&&f?l-e-s:l+s+ga;return{left:u+r,top:p+i}}function va(e,n){let r=e.ownerDocument,i=t.M(r.defaultView);if(i===null||!i.isCollapsed)return null;let{anchorNode:a,anchorOffset:o}=t.Er(i,e);if(a===null)return null;let s=r.createRange();try{s.setStart(a,n),s.setEnd(a,o)}catch{return null}return s.getBoundingClientRect()}function ya(){let[e]=t.oi(),[n,r]=(0,a.useState)(null),i=(0,a.useRef)(null),o=(0,a.useCallback)(e=>(i.current=e,e),[]);return(0,a.useEffect)(()=>{if(n===null||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{let t=n.parentElement,r=e.getRootElement(),a=i.current;if(t===null||r===null||a===null)return;let o=va(r,a.leadOffset);if(o===null)return;let s=r.ownerDocument.defaultView??window,c=n.getBoundingClientRect(),{left:l,top:u}=_a({menuHeight:c.height,menuWidth:c.width,rootRect:r.getBoundingClientRect(),scrollX:s.scrollX,scrollY:s.scrollY,triggerRect:o,viewportHeight:s.innerHeight});t.style.left=`${l}px`,t.style.top=`${u}px`});return t.observe(n),()=>{t.disconnect()}},[e,n]),{popoverRef:r,trackMatch:o}}function ba({buttonClassName:e,enabled:t=!0,listClassName:n,values:r}){let{shortToVerseData:i}=Bt(),[s,c]=(0,a.useState)({});return(0,a.useEffect)(()=>{if(!t||i===void 0)return;let e=!0;return Promise.all(r.map(async e=>{try{let t=await i(e);return[e,{label:t?.title??e,style:t?.style}]}catch{return[e,{label:e}]}})).then(t=>{e&&c(Object.fromEntries(t))}),()=>{e=!1}},[t,i,r]),(0,o.jsx)(`ul`,{className:n,children:r.map(t=>{let n=s[t],r=n?.label??t;return(0,o.jsx)(`li`,{children:(0,o.jsx)(`button`,{className:e,style:n?.style,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),tr({anchorElement:e.currentTarget,shortVerse:t})},children:r})},t)})})}var xa={NAME:`\\b[A-Z][^\\s\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;]`,PUNCTUATION:`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`}.PUNCTUATION,Sa=[`#`].join(``),Ca=`[^`+Sa+xa+`\\s]`,wa=`(?:\\.[ |$]| |[`+xa+`]|)`,Ta=RegExp(`(^|\\s|\\()([`+Sa+`]((?:`+Ca+wa+`){0,75}))$`),Ea=RegExp(`(^|\\s|\\()([`+Sa+`]((?:`+Ca+`){0,50}))$`),Da=20,Oa=2e3,ka=150;function Aa(e,t,n){return{id:e,name:t,kjvName:null,oldName:null,title:n,description:``,type:``,relatedLocations:[],modernIdentification:null,coordinates:null,verses:[],links:[],wikipedia:null,uncertainty:!1,matterRange:1/0}}async function ja(e){if(navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}function Ma({inline:e=!1,label:t,value:n}){return(0,o.jsxs)(`div`,{className:`mention-location-details__row${e?` mention-location-details__row--inline`:``}`,children:[(0,o.jsx)(`dt`,{children:e?`${t}:`:t}),(0,o.jsx)(`dd`,{children:n})]})}function Na({label:e,value:t}){return Pr(t)?(0,o.jsx)(Ma,{inline:!0,label:e,value:Nr(t)}):null}function Pa({children:e,count:t,defaultOpen:n,label:r,onOpen:i}){let[s,c]=(0,a.useState)(n);return(0,o.jsxs)(`div`,{className:`mention-location-details__row mention-location-details__row--collapsible`,children:[(0,o.jsx)(`dt`,{children:(0,o.jsxs)(`button`,{"aria-expanded":s,className:`mention-location-details__section-toggle`,type:`button`,onClick:()=>{let e=!s;c(e),e&&i?.()},children:[(0,o.jsx)(`i`,{className:`bi bi-chevron-right mention-location-details__section-icon`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{children:r}),t>0?(0,o.jsx)(`span`,{className:`mention-location-details__section-count`,children:t}):null]})}),s?(0,o.jsx)(`dd`,{children:e}):null]})}function Fa({onOpenLocationReference:e,values:t}){let n=hn();return(0,o.jsx)(`ul`,{className:`mention-location-details__list`,children:t.map(t=>{let r=Rr(n,t),i=r?.name??t;return(0,o.jsx)(`li`,{children:r===null?i:(0,o.jsx)(`button`,{className:`mention-location-details__location-button`,type:`button`,onClick:t=>{t.preventDefault(),t.stopPropagation(),e(r,t.currentTarget)},children:i})},t)})})}function Ia({label:e,onOpenLocationReference:t,values:n}){return n.length===0?null:(0,o.jsx)(Pa,{count:n.length,defaultOpen:!0,label:e,children:(0,o.jsx)(Fa,{onOpenLocationReference:t,values:n})})}function La({enabled:e,values:t}){let[n,r]=(0,a.useState)(!1);return t.length===0?null:(0,o.jsx)(Pa,{count:t.length,defaultOpen:!1,label:`Verses`,onOpen:()=>{r(!0)},children:(0,o.jsx)(ba,{buttonClassName:`mention-location-details__location-button`,enabled:e&&n,listClassName:`mention-location-details__list`,values:t})})}function Ra({links:e}){return(0,o.jsx)(`ul`,{className:`mention-location-details__list`,children:e.map(e=>(0,o.jsx)(`li`,{children:(0,o.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:Fr(e.type)})},`${e.type}:${e.url}`))})}function za({links:e}){return e.length===0?null:(0,o.jsx)(Pa,{count:e.length,defaultOpen:!0,label:`Links`,children:(0,o.jsx)(Ra,{links:e})})}function Ba({coordinates:e,name:t}){let{latitude:n,longitude:r}=e,i=`${n},${r}`,a=`https://maps.google.com/maps?q=${encodeURIComponent(i)}&z=8&output=embed`,s=`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(i)}`,c=t===``?`Location map`:`Map of ${t}`;return(0,o.jsxs)(`div`,{className:`mention-location-details__map`,children:[(0,o.jsx)(`p`,{className:`mention-location-details__map-note`,children:`Approximate location — the marker is an estimated point and may not be exact.`}),(0,o.jsx)(`iframe`,{className:`mention-location-details__map-frame`,title:c,src:a,loading:`lazy`,referrerPolicy:`no-referrer-when-downgrade`,allowFullScreen:!0}),(0,o.jsx)(`a`,{className:`mention-location-details__map-link`,href:s,rel:`noreferrer`,target:`_blank`,children:`Open in Google Maps`})]})}function Va({includeTitle:e=!0,mentionLocation:t}){let n=[t.type].filter(e=>e!==``&&e.toLowerCase()!==`unknown`);return(0,o.jsxs)(`div`,{className:`mention-location-basic-info`,children:[e&&t.title?(0,o.jsx)(`div`,{className:`mention-location-basic-info__title`,children:(0,o.jsx)(Q,{value:t.title})}):null,t.description?(0,o.jsx)(`p`,{className:`mention-location-basic-info__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,n.length>0?(0,o.jsx)(`div`,{className:`mention-location-basic-info__facts`,children:n.map(e=>(0,o.jsx)(`span`,{children:e},e))}):null]})}function Ha({includeTitle:e=!0,mentionLocation:t,onOpenLocationReference:n}){let[r,i]=(0,a.useState)(!1);return(0,o.jsxs)(`details`,{className:`mention-location-details`,children:[(0,o.jsxs)(`summary`,{className:`mention-location-details__summary`,onClick:()=>{i(!0)},children:[(0,o.jsx)(`i`,{className:`bi bi-chevron-right mention-location-details__summary-icon`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{children:`Details`})]}),(0,o.jsxs)(`div`,{className:`mention-location-details__body`,children:[t.description?(0,o.jsx)(`p`,{className:`mention-location-details__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,(0,o.jsxs)(`dl`,{className:`mention-location-details__grid`,children:[e&&Pr(t.title)?(0,o.jsx)(Ma,{inline:!0,label:`Title`,value:(0,o.jsx)(Q,{value:t.title})}):null,(0,o.jsx)(Na,{label:`KJV name`,value:K(t)}),(0,o.jsx)(Na,{label:`Also called`,value:t.oldName}),(0,o.jsx)(Na,{label:`Type`,value:t.type}),(0,o.jsx)(Na,{label:`Modern identification`,value:t.modernIdentification}),(0,o.jsx)(Ia,{label:`Related locations`,onOpenLocationReference:n,values:t.relatedLocations}),(0,o.jsx)(La,{enabled:r,values:t.verses}),(0,o.jsx)(za,{links:Lr(t)})]}),t.coordinates===null?null:(0,o.jsx)(Ba,{coordinates:t.coordinates,name:t.name})]})]})}function Ua(e){return e instanceof Element&&e.closest(`a, button, .mention-location-details`)!==null}function Wa(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-lexical-mention]`);return t instanceof HTMLElement?t:null}function Ga(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-mention-location-hover-card]`);return t instanceof HTMLElement?t:null}function Ka(e){let t=e.getAttribute(`data-lexical-mention-kind`);return t===`mention`||t===`bible-verse`?t:t===`location`||t===`hashtag`||(e.textContent?.trim()??``).startsWith(`#`)?`location`:`mention`}function qa(e){let t=Ka(e);t!==`bible-verse`&&e.setAttribute(`data-lexical-mention-kind`,t)}function Ja(e){e.querySelectorAll(`[data-lexical-mention]`).forEach(qa)}function Ya(e,t){if(Ka(t)!==`location`)return null;let n=t.textContent?.trim()??``,r=t.getAttribute(`data-lexical-mention-id`);if(r!==null){let t=e.getRecordById(r);if(t!==null)return t}let i=t.getAttribute(`data-lexical-mention-name`)?.trim()??n??``,a=i.startsWith(`#`)?i.slice(1):i;if(a===``)return null;let o=e.getRecordsByName(a);return o.length===1?o[0]:Aa(r,a,``)}function Xa(e,t){let n=J(t.id),r=q(t.name);if(n!==null){let t=e.getRecordById(n);if(t!==null)return t}if(r===``)return null;let i=e.getRecordsByName(r);return i.length===1?i[0]:Aa(n,r,``)}function Za(e){return Ar(e,112)}function Qa(e){return`location:${e.id??e.name}`}var $a=500;function eo(e){let[t,n]=(0,a.useState)([]),r=hn(),i=(0,a.useRef)(new Map);return(0,a.useEffect)(()=>{if(e==null){n([]);return}let t=i.current,a=t.get(e);if(a!==null){if(a!==void 0){n(a);return}t.set(e,null),setTimeout(()=>{let i=r.searchLocations(e);t.set(e,i),n(i)},$a)}},[e,r]),(0,a.useEffect)(()=>{i.current=new Map},[r]),t}function to(e,t){let n=Ta.exec(e);if(n===null&&(n=Ea.exec(e)),n!==null){let e=n[1],r=n[3];if(r.length>=t)return{leadOffset:n.index+e.length,matchingString:r,replaceableString:n[2]}}return null}function no(e){return to(e,1)}var ro=class extends ki{id;name;kjvName;picture;constructor(e,t){super(e.id),this.id=e.id,this.name=e.name,this.kjvName=K(e),this.title=sr(e.title),this.picture=t}};function io({index:e,isSelected:t,onClick:n,onMouseEnter:r,option:i}){let a=`item mx-2 p-2 d-flex flex-row align-items-center flex-shrink-0`;return t&&(a+=` selected`),(0,o.jsxs)(`li`,{tabIndex:-1,className:a,ref:i.setRefElement,role:`option`,"aria-selected":t,id:`typeahead-item-`+e,onMouseEnter:r,onClick:n,children:[i.picture,(0,o.jsxs)(`span`,{className:`text flex-column`,children:[(0,o.jsxs)(`span`,{children:[i.name,i.kjvName===null?null:(0,o.jsxs)(`span`,{className:`opacity-75`,children:[` (`,i.kjvName,`)`]})]}),i.title?(0,o.jsxs)(`span`,{className:`small opacity-75`,children:[`(`,i.title,`)`]}):null]})]},i.key)}function ao(){let[e]=t.oi(),n=hn(),r=n.style,i=(0,a.useRef)(null),c=(0,a.useRef)(null),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(null),[p,m]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),[_,v]=(0,a.useState)([]),{shortToVerseData:y}=Bt(),b=(0,a.useCallback)(async e=>{if(y===void 0)return e;try{return(await y(e))?.title??e}catch{return e}},[y]),x=eo(l),{popoverRef:S,trackMatch:C}=ya(),w=zi(`/`,{minLength:0}),T=(0,a.useMemo)(()=>x.map(e=>new ro(e,(0,o.jsx)(`i`,{className:`bi bi-pin icon`,"aria-hidden":`true`}))).slice(0,Da),[x]),E=(0,a.useCallback)((t,n,r)=>{e.update(()=>{let e=ai(t.name,t.name,t.id,`location`);n&&n.replace(e),e.select(),r()})},[e]),D=(0,a.useCallback)(t=>w(t,e)===null?C(no(t)):C(null),[w,e,C]),O=(0,a.useCallback)(()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)},[]),k=(0,a.useCallback)(()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),A=(0,a.useCallback)(()=>{O(),k(),m(null),f(null)},[k,O]),j=(0,a.useCallback)(()=>{O(),k(),c.current=window.setTimeout(()=>{m(null),f(null),c.current=null},ka)},[k,O]),M=(0,a.useCallback)((e,t)=>{let n=Qa(e),r=vr(),i=Mr(t);v(a=>{let o=a.find(e=>e.panelKey===n),s={...e,anchorElement:t,panelKey:n,position:o?.position??i,zIndex:r};return o===void 0?[...a,s]:a.map(e=>e.panelKey===n?s:e)}),A()},[A]),N=(0,a.useCallback)(e=>{v(t=>t.filter(t=>t.panelKey!==e))},[]),P=(0,a.useCallback)(e=>{let t=vr();v(n=>n.map(n=>n.panelKey===e?{...n,zIndex:t}:n))},[]),ee=(0,a.useCallback)((e,t)=>{v(n=>{let r=!1,i=n.map(n=>n.panelKey!==e||n.position.left===t.left&&n.position.top===t.top?n:(r=!0,{...n,position:t}));return r?i:n})},[]);return(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(typeof t!=`object`||!t||!(t.anchorElement instanceof HTMLElement))return;let r=Xa(n,t);r!==null&&M(r,t.anchorElement)};return window.addEventListener(nr,e),()=>{window.removeEventListener(nr,e)}},[n,M]),(0,a.useEffect)(()=>{let e=e=>{if(e.button!==0)return;let t=Wa(e.target);if(t===null||!Sr(e,t))return;qa(t);let r=Ya(n,t);r!==null&&(M(r,t),e.preventDefault(),e.stopPropagation())};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[n,M]),(0,a.useEffect)(()=>e.registerNodeTransform(ii,e=>{e.getTextContent().startsWith(`#`)&&(e.setMentionKind(`location`),e.setTextContent(e.getTextContent().slice(1)))}),[e]),(0,a.useEffect)(()=>{let t=null,n=e.registerRootListener(e=>{t?.disconnect(),t=null,e!==null&&(Ja(e),t=new MutationObserver(()=>{Ja(e)}),t.observe(e,{characterData:!0,childList:!0,subtree:!0}))});return()=>{t?.disconnect(),n()}},[e]),(0,a.useEffect)(()=>{let e=e=>{if(Ga(e.target)!==null){k();return}let t=Wa(e.target),r=Wa(e.relatedTarget);if(t===null)return;if(t===p){k();return}if(t===r)return;qa(t);let a=Ya(n,t);a!==null&&(A(),i.current=window.setTimeout(()=>{m(t),f(a),i.current=null},Oa))},t=e=>{let t=Wa(e.target),n=Ga(e.target),r=Wa(e.relatedTarget),i=Ga(e.relatedTarget);if(!(t===null&&n===null)){if(r!==null||i!==null){k();return}j()}};return document.addEventListener(`mouseover`,e),document.addEventListener(`mouseout`,t),()=>{O(),k(),document.removeEventListener(`mouseover`,e),document.removeEventListener(`mouseout`,t)}},[k,O,A,p,n,j]),(0,a.useEffect)(()=>{if(p===null){g(null);return}let e=()=>{if(!p.isConnected){A(),g(null);return}g(Za(p))};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[A,p]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Bi,{onQueryChange:u,onSelectOption:E,triggerFn:D,options:T,menuRenderFn:(e,{selectedIndex:t,selectOptionAndCleanUp:n,setHighlightedIndex:i})=>e.current&&x.length?s.createPortal((0,o.jsx)(`div`,{ref:S,className:`typeahead-popover mention-locations-menu`,style:r,children:(0,o.jsx)(`ul`,{className:`list-unstyled m-0 p-0`,children:T.map((e,r)=>(0,o.jsx)(io,{index:r,isSelected:t===r,onClick:()=>{i(r),n(e)},onMouseEnter:()=>{i(r)},option:e},e.key))})}),e.current):null}),d!==null&&h!==null?s.createPortal((0,o.jsxs)(`div`,{className:`mention-hover-card`,"data-mention-location-hover-card":`true`,role:`tooltip`,style:{...r,...h},tabIndex:0,onClick:e=>{Ua(e.target)||p!==null&&M(d,p)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&p!==null&&!Ua(e.target)&&(M(d,p),e.preventDefault())},children:[(0,o.jsxs)(`div`,{className:`mention-hover-card__name d-inline-flex align-items-center gap-2`,children:[(0,o.jsx)(`i`,{className:`bi bi-pin icon`,"aria-hidden":`true`}),(0,o.jsxs)(`span`,{className:`mention-hover-card__name-text`,children:[d.name,K(d)===null?null:(0,o.jsxs)(`span`,{className:`mention-hover-card__kjv-name`,children:[` `,`(`,K(d),`)`]})]}),(0,o.jsx)(`button`,{"aria-label":`Copy mentioned location name`,className:`mention-hover-card__copy`,title:`Copy name`,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),ja(d.name)},children:(0,o.jsx)(`i`,{className:`bi bi-copy`,"aria-hidden":`true`})})]}),d.title?(0,o.jsx)(`div`,{className:`mention-hover-card__title`,children:(0,o.jsx)(Q,{value:d.title})}):null,(0,o.jsx)(Va,{includeTitle:!1,mentionLocation:d}),(0,o.jsx)(Ha,{includeTitle:!1,mentionLocation:d,onOpenLocationReference:M})]}),document.body):null,_.map(e=>(0,o.jsx)(ha,{anchorElement:e.anchorElement,copyLabel:`Copy mentioned location details`,iconClassName:`bi bi-pin icon`,name:e.name,panelKind:`location`,position:e.position,textStyle:r,title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Va,{mentionLocation:e}),(0,o.jsx)(Ha,{mentionLocation:e,onOpenLocationReference:M})]}),zIndex:e.zIndex,onCopy:async()=>{let{plainText:t,html:r}=qr(await Kr(n,e,b));return xr(t,r)},onBringToFront:()=>{P(e.panelKey)},onClose:()=>{N(e.panelKey)},onPositionChange:t=>{ee(e.panelKey,t)}},e.panelKey))]})}var oo={NAME:`\\b[A-Z][^\\s\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;]`,PUNCTUATION:`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`}.PUNCTUATION,so=[`@`].join(``),co=`[^`+so+oo+`\\s]`,lo=`(?:\\.[ |$]| |[`+oo+`]|)`,uo=RegExp(`(^|\\s|\\()([`+so+`]((?:`+co+lo+`){0,75}))$`),fo=RegExp(`(^|\\s|\\()([`+so+`]((?:`+co+`){0,50}))$`),po=20,mo=2e3,ho=150;function go(e,t,n){return{id:e,name:t,kjvName:null,oldName:null,title:n,description:``,gender:``,age:``,years:[],locations:[],spouses:[],children:[],parents:[],siblings:[],cousin:[],type:``,verses:[],links:[],wikipedia:null,matterRange:1/0}}async function _o(e){if(navigator.clipboard!==void 0&&typeof navigator.clipboard.writeText==`function`){await navigator.clipboard.writeText(e);return}let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-9999px`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}function vo({inline:e=!1,label:t,value:n}){return(0,o.jsxs)(`div`,{className:`mention-person-details__row${e?` mention-person-details__row--inline`:``}`,children:[(0,o.jsx)(`dt`,{children:e?`${t}:`:t}),(0,o.jsx)(`dd`,{children:n})]})}function yo({label:e,value:t}){return Pr(t)?(0,o.jsx)(vo,{inline:!0,label:e,value:Nr(t)}):null}function bo({values:e}){return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>(0,o.jsx)(`li`,{children:e},e))})}function xo({label:e,values:t}){return t.length===0?null:(0,o.jsx)(vo,{label:e,value:(0,o.jsx)(bo,{values:t})})}function So({locations:e}){let t=hn();return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>{let n=Rr(t,e),r=n?.name??e;return(0,o.jsx)(`li`,{children:n===null?r:(0,o.jsx)(`button`,{className:`mention-person-details__location-button`,title:sr(n.title)||void 0,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),rr({anchorElement:e.currentTarget,id:n.id,name:n.name})},children:r})},e)})})}function Co({locations:e}){return e.length===0?null:(0,o.jsx)(vo,{label:`Locations`,value:(0,o.jsx)(So,{locations:e})})}function wo({ids:e,onOpenPersonReference:t}){let n=mn();return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>{let r=n.getRecordById(e),i=r?.name??e;return(0,o.jsx)(`li`,{children:r===null?i:(0,o.jsx)(`button`,{className:`mention-person-details__person-button`,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),t(r,e.currentTarget)},children:i})},e)})})}function To({ids:e,label:t,onOpenPersonReference:n}){return e.length===0?null:(0,o.jsx)(vo,{label:t,value:(0,o.jsx)(wo,{ids:e,onOpenPersonReference:n})})}function Eo({links:e}){return(0,o.jsx)(`ul`,{className:`mention-person-details__list`,children:e.map(e=>(0,o.jsx)(`li`,{children:(0,o.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:Fr(e.type)})},`${e.type}:${e.url}`))})}function Do({enabled:e,values:t}){return t.length===0?null:(0,o.jsx)(vo,{label:`Verses`,value:(0,o.jsx)(ba,{buttonClassName:`mention-person-details__location-button`,enabled:e,listClassName:`mention-person-details__list`,values:t})})}function Oo({links:e}){return e.length===0?null:(0,o.jsx)(vo,{label:`Links`,value:(0,o.jsx)(Eo,{links:e})})}function ko({includeTitle:e=!0,mentionPerson:t}){let n=[t.type,t.gender,t.age].filter(e=>e!==``&&e.toLowerCase()!==`unknown`);return(0,o.jsxs)(`div`,{className:`mention-person-basic-info`,children:[e&&t.title?(0,o.jsx)(`div`,{className:`mention-person-basic-info__title`,children:(0,o.jsx)(Q,{value:t.title})}):null,t.description?(0,o.jsx)(`p`,{className:`mention-person-basic-info__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,n.length>0?(0,o.jsx)(`div`,{className:`mention-person-basic-info__facts`,children:n.map(e=>(0,o.jsx)(`span`,{children:e},e))}):null]})}function Ao({includeTitle:e=!0,mentionPerson:t,onOpenPersonReference:n}){let[r,i]=(0,a.useState)(!1);return(0,o.jsxs)(`details`,{className:`mention-person-details`,children:[(0,o.jsxs)(`summary`,{className:`mention-person-details__summary`,onClick:()=>{i(!0)},children:[(0,o.jsx)(`i`,{className:`bi bi-chevron-right mention-person-details__summary-icon`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{children:`Details`})]}),(0,o.jsxs)(`div`,{className:`mention-person-details__body`,children:[t.description?(0,o.jsx)(`p`,{className:`mention-person-details__description`,children:(0,o.jsx)(Q,{value:t.description})}):null,(0,o.jsxs)(`dl`,{className:`mention-person-details__grid`,children:[e&&Pr(t.title)?(0,o.jsx)(vo,{inline:!0,label:`Title`,value:(0,o.jsx)(Q,{value:t.title})}):null,(0,o.jsx)(yo,{label:`KJV name`,value:K(t)}),(0,o.jsx)(yo,{label:`Also called`,value:t.oldName}),(0,o.jsx)(yo,{label:`Type`,value:t.type}),(0,o.jsx)(yo,{label:`Gender`,value:t.gender}),(0,o.jsx)(yo,{label:`Age`,value:t.age}),(0,o.jsx)(xo,{label:`Years`,values:t.years.map(Ir)}),(0,o.jsx)(Co,{locations:t.locations}),(0,o.jsx)(To,{label:`Parents`,ids:t.parents,onOpenPersonReference:n}),(0,o.jsx)(To,{label:`Spouses`,ids:t.spouses,onOpenPersonReference:n}),(0,o.jsx)(To,{label:`Children`,ids:t.children,onOpenPersonReference:n}),(0,o.jsx)(To,{label:`Siblings`,ids:t.siblings,onOpenPersonReference:n}),(0,o.jsx)(To,{label:`Cousins`,ids:t.cousin,onOpenPersonReference:n}),(0,o.jsx)(Do,{enabled:r,values:t.verses}),(0,o.jsx)(Oo,{links:Lr(t)})]})]})]})}function jo(e){return e instanceof Element&&e.closest(`a, button, .mention-person-details`)!==null}function Mo(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-lexical-mention]`);return t instanceof HTMLElement?t:null}function No(e){if(!(e instanceof Element))return null;let t=e.closest(`[data-mention-name-hover-card]`);return t instanceof HTMLElement?t:null}function Po(e,t){let n=t.textContent?.trim()??``,r=t.getAttribute(`data-lexical-mention-kind`);if(r===`location`||r===`bible-verse`||r===`hashtag`||n.startsWith(`#`))return null;let i=t.getAttribute(`data-lexical-mention-id`);if(i!==null){let t=e.getRecordById(i);if(t!==null)return t}let a=t.getAttribute(`data-lexical-mention-name`)?.trim()??n??``;if(a===``)return null;let o=e.getRecordsByName(a);return go(i,a,o.length===1?o[0].title:``)}function Fo(e){return Ar(e,360)}function Io(e){return`person:${e.id??e.name}`}function Lo(e,t){let n=J(t.id),r=q(t.name);if(n!==null){let t=e.getRecordById(n);if(t!==null)return t}if(r===``)return null;let i=e.getRecordsByName(r);return i.length>=1?i[0]:null}var Ro=500;function zo(e){let[t,n]=(0,a.useState)([]),r=mn(),i=(0,a.useRef)(new Map);return(0,a.useEffect)(()=>{if(e==null){n([]);return}let t=i.current,a=t.get(e);if(a!==null){if(a!==void 0){n(a);return}t.set(e,null),setTimeout(()=>{let i=r.searchNames(e);t.set(e,i),n(i)},Ro)}},[e,r]),(0,a.useEffect)(()=>{i.current=new Map},[r]),t}function Bo(e,t){let n=uo.exec(e);if(n===null&&(n=fo.exec(e)),n!==null){let e=n[1],r=n[3];if(r.length>=t)return{leadOffset:n.index+e.length,matchingString:r,replaceableString:n[2]}}return null}function Vo(e){return Bo(e,1)}var Ho=class extends ki{id;name;kjvName;picture;constructor(e,t){super(e.id),this.id=e.id,this.name=e.name,this.kjvName=K(e),this.title=sr(e.title),this.picture=t}};function Uo({index:e,isSelected:t,onClick:n,onMouseEnter:r,option:i}){let a=`item mx-2 p-2 d-flex flex-row align-items-center flex-shrink-0`;return t&&(a+=` selected`),(0,o.jsxs)(`li`,{tabIndex:-1,className:a,ref:i.setRefElement,role:`option`,"aria-selected":t,id:`typeahead-item-`+e,onMouseEnter:r,onClick:n,children:[i.picture,(0,o.jsxs)(`span`,{className:`text flex-column`,children:[(0,o.jsxs)(`span`,{children:[i.name,i.kjvName===null?null:(0,o.jsxs)(`span`,{className:`opacity-75`,children:[` (`,i.kjvName,`)`]})]}),i.title?(0,o.jsxs)(`span`,{className:`small opacity-75`,children:[`(`,i.title,`)`]}):null]})]},i.key)}function Wo(){let[e]=t.oi(),n=pn(),{namesLookupManager:r}=n,i=r.style,c=(0,a.useRef)(null),l=(0,a.useRef)(null),[u,d]=(0,a.useState)(null),[f,p]=(0,a.useState)(null),[m,h]=(0,a.useState)(null),[g,_]=(0,a.useState)(null),[v,y]=(0,a.useState)([]),{shortToVerseData:b}=Bt(),x=(0,a.useCallback)(async e=>{if(b===void 0)return e;try{return(await b(e))?.title??e}catch{return e}},[b]),S=zo(u),{popoverRef:C,trackMatch:w}=ya(),T=zi(`/`,{minLength:0}),E=(0,a.useMemo)(()=>S.map(e=>new Ho(e,(0,o.jsx)(`i`,{className:fa(e.type)}))).slice(0,po),[S]),D=(0,a.useCallback)((t,n,r)=>{e.update(()=>{let e=ai(t.name,t.name,t.id);n&&n.replace(e),e.select(),r()})},[e]),O=(0,a.useCallback)(t=>T(t,e)===null?w(Vo(t)):w(null),[T,e,w]),k=(0,a.useCallback)(()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),A=(0,a.useCallback)(()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),j=(0,a.useCallback)(()=>{k(),A(),h(null),p(null)},[A,k]),M=(0,a.useCallback)(()=>{k(),A(),l.current=window.setTimeout(()=>{h(null),p(null),l.current=null},ho)},[A,k]),N=(0,a.useCallback)((e,t)=>{let n=Io(e),r=vr(),i=Mr(t);y(a=>{let o=a.find(e=>e.panelKey===n),s={...e,anchorElement:t,panelKey:n,position:o?.position??i,zIndex:r};return o===void 0?[...a,s]:a.map(e=>e.panelKey===n?s:e)}),j()},[j]),P=(0,a.useCallback)(e=>{y(t=>t.filter(t=>t.panelKey!==e))},[]),ee=(0,a.useCallback)(e=>{let t=vr();y(n=>n.map(n=>n.panelKey===e?{...n,zIndex:t}:n))},[]),F=(0,a.useCallback)((e,t)=>{y(n=>{let r=!1,i=n.map(n=>n.panelKey!==e||n.position.left===t.left&&n.position.top===t.top?n:(r=!0,{...n,position:t}));return r?i:n})},[]);return(0,a.useEffect)(()=>{let t=e=>{if(e.getAttribute(`data-lexical-mention-kind`)!==`mention`){e.removeAttribute(`data-lexical-mention-name-type`);return}let t=e.getAttribute(`data-lexical-mention-id`),n=t===null?null:r.getRecordById(t);if(n===null){e.removeAttribute(`data-lexical-mention-name-type`);return}e.setAttribute(`data-lexical-mention-name-type`,Ht(n.type))};return e.registerMutationListener(ii,n=>{e.getEditorState().read(()=>{for(let[r,i]of n){if(i===`destroyed`)continue;let n=e.getElementByKey(r);n instanceof HTMLElement&&t(n)}})},{skipInitialization:!1})},[e,r]),(0,a.useEffect)(()=>{let e=e=>{if(e.button!==0)return;let t=Mo(e.target);if(t===null||!Sr(e,t))return;let n=Po(r,t);n!==null&&(N(n,t),e.preventDefault(),e.stopPropagation())};return document.addEventListener(`pointerdown`,e,!0),()=>{document.removeEventListener(`pointerdown`,e,!0)}},[r,N]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(typeof t!=`object`||!t||!(t.anchorElement instanceof HTMLElement))return;let n=Lo(r,t);n!==null&&N(n,t.anchorElement)};return window.addEventListener(ir,e),()=>{window.removeEventListener(ir,e)}},[r,N]),(0,a.useEffect)(()=>{let e=e=>{if(No(e.target)!==null){A();return}let t=Mo(e.target),n=Mo(e.relatedTarget);if(t===null)return;if(t===m){A();return}if(t===n)return;let i=Po(r,t);i!==null&&(j(),c.current=window.setTimeout(()=>{h(t),p(i),c.current=null},mo))},t=e=>{let t=Mo(e.target),n=No(e.target),r=Mo(e.relatedTarget),i=No(e.relatedTarget);if(!(t===null&&n===null)){if(r!==null||i!==null){A();return}M()}};return document.addEventListener(`mouseover`,e),document.addEventListener(`mouseout`,t),()=>{k(),A(),document.removeEventListener(`mouseover`,e),document.removeEventListener(`mouseout`,t)}},[A,k,j,m,r,M]),(0,a.useEffect)(()=>{if(m===null){_(null);return}let e=()=>{if(!m.isConnected){j(),_(null);return}_(Fo(m))};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[j,m]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Bi,{onQueryChange:d,onSelectOption:D,triggerFn:O,options:E,menuRenderFn:(e,{selectedIndex:t,selectOptionAndCleanUp:n,setHighlightedIndex:r})=>e.current&&S.length?s.createPortal((0,o.jsx)(`div`,{ref:C,className:`typeahead-popover mention-name-menu`,style:i,children:(0,o.jsx)(`ul`,{className:`list-unstyled m-0 p-0`,children:E.map((e,i)=>(0,o.jsx)(Uo,{index:i,isSelected:t===i,onClick:()=>{r(i),n(e)},onMouseEnter:()=>{r(i)},option:e},e.key))})}),e.current):null}),f!==null&&g!==null?s.createPortal((0,o.jsxs)(`div`,{className:`mention-hover-card`,"data-mention-name-hover-card":`true`,role:`tooltip`,style:{...i,...g},tabIndex:0,onClick:e=>{jo(e.target)||m!==null&&N(f,m)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&m!==null&&!jo(e.target)&&(N(f,m),e.preventDefault())},children:[(0,o.jsxs)(`div`,{className:`mention-hover-card__name d-inline-flex align-items-center gap-2`,children:[(0,o.jsx)(`i`,{className:fa(f.type),"aria-hidden":`true`}),(0,o.jsxs)(`span`,{className:`mention-hover-card__name-text`,children:[f.name,K(f)===null?null:(0,o.jsxs)(`span`,{className:`mention-hover-card__kjv-name`,children:[` `,`(`,K(f),`)`]})]}),(0,o.jsx)(`button`,{"aria-label":`Copy mentioned person name`,className:`mention-hover-card__copy`,title:`Copy name`,type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),_o(f.name)},children:(0,o.jsx)(`i`,{className:`bi bi-copy`,"aria-hidden":`true`})})]}),f.title?(0,o.jsx)(`div`,{className:`mention-hover-card__title`,children:(0,o.jsx)(Q,{value:f.title})}):null,(0,o.jsx)(ko,{includeTitle:!1,mentionPerson:f}),(0,o.jsx)(Ao,{includeTitle:!1,mentionPerson:f,onOpenPersonReference:N})]}),document.body):null,v.map(e=>(0,o.jsx)(ha,{anchorElement:e.anchorElement,copyLabel:`Copy mentioned person details`,iconClassName:fa(e.type),name:e.name,panelKind:`mentioned person`,position:e.position,textStyle:i,title:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ko,{mentionPerson:e}),(0,o.jsx)(Ao,{mentionPerson:e,onOpenPersonReference:N})]}),zIndex:e.zIndex,onCopy:async()=>{let{plainText:t,html:r}=qr(await Gr(n,e,x));return xr(t,r)},onBringToFront:()=>{ee(e.panelKey)},onClose:()=>{P(e.panelKey)},onPositionChange:t=>{F(e.panelKey,t)}},e.panelKey))]})}var Go=Object.freeze({" ":`\\t`,"\n":`\\n`}),Ko=new RegExp(Object.keys(Go).join(`|`),`g`),$=Object.freeze({ancestorHasNextSibling:`|`,ancestorIsLastChild:` `,hasNextSibling:`├`,isLastChild:`└`,selectedChar:`^`,selectedLine:`>`}),qo=[e=>e.hasFormat(`bold`)&&`Bold`,e=>e.hasFormat(`code`)&&`Code`,e=>e.hasFormat(`italic`)&&`Italic`,e=>e.hasFormat(`strikethrough`)&&`Strikethrough`,e=>e.hasFormat(`subscript`)&&`Subscript`,e=>e.hasFormat(`superscript`)&&`Superscript`,e=>e.hasFormat(`underline`)&&`Underline`,e=>e.hasFormat(`highlight`)&&`Highlight`],Jo=[e=>e.hasTextFormat(`bold`)&&`Bold`,e=>e.hasTextFormat(`code`)&&`Code`,e=>e.hasTextFormat(`italic`)&&`Italic`,e=>e.hasTextFormat(`strikethrough`)&&`Strikethrough`,e=>e.hasTextFormat(`subscript`)&&`Subscript`,e=>e.hasTextFormat(`superscript`)&&`Superscript`,e=>e.hasTextFormat(`underline`)&&`Underline`,e=>e.hasTextFormat(`highlight`)&&`Highlight`],Yo=[e=>e.isDirectionless()&&`Directionless`,e=>e.isUnmergeable()&&`Unmergeable`],Xo=[e=>e.isToken()&&`Token`,e=>e.isSegmented()&&`Segmented`];function Zo(e,n,i,a,o=!1){let s=e.getEditorState(),c=e._config,l=e._compositionKey,u=e._editable;if(i){let t=``;return s.read(()=>{t=function(e){let t=document.createElement(`div`);return t.innerHTML=e.trim(),ss(t,0).innerHTML}(r.x(e))},{editor:e}),t}let d=` root
9
+ `,f=s.read(()=>{let e=t.tt();return Qo(t.Dr(),(n,r,i)=>{let s=`(${n.getKey()})`,c=n.getType()||``,l=n.isSelected(),u=i===void 0?``:`[slot: ${i}] `,f=function(e,n){return n===void 0?``:t.vt(e)&&e.isShadowRoot()?` [shadow-root]`:t.$(e)&&!e.isInline()?` [atomic decorator]`:``}(n,i);d+=`${l?$.selectedLine:` `} ${r.join(` `)} ${s} ${u}${c}${f} ${function(e,n,r=!1){let i=n?n(e,r):void 0;if(i!==void 0&&i.length>0)return i;if(t.Jt(e)){let t=e.getTextContent(),n=t.length===0?`(empty)`:`"${$o(t,r)}"`,i=function(e){return[ns(e),es(e),ts(e),os(e)].filter(Boolean).join(`, `)}(e);return[n,i.length===0?null:`{ ${i} }`].filter(Boolean).join(` `).trim()}if(X(e)){let t=e.getURL(),n=t.length===0?`(empty)`:`"${$o(t,r)}"`,i=function(e){return[rs(e),is(e),as(e),os(e)].filter(Boolean).join(`, `)}(e);return[n,i.length===0?null:`{ ${i} }`].filter(Boolean).join(` `).trim()}if(wi(e))return`ids: [ ${e.getIDs().join(`, `)} ]`;if(t.kn(e)){let t=function(e){let t=Jo.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`format: `+t),t}(e),n=t===``?``:`{ ${t} }`;return n+=e.__style?`(${e.__style})`:``,n}return``}(n,a,o)}\n`,d+=function({indent:e,isSelected:n,node:r,nodeKeyDisplay:i,selection:a,typeDisplay:o}){if(!t.Jt(r)||!t.bn(a)||!n||t.vt(r))return``;let s=a.anchor,c=a.focus;if(r.getTextContent()===``||s.getNode()===a.focus.getNode()&&s.offset===c.offset)return``;let[l,u]=function(e,n){let r=n.getStartEndPoints();if(t.Fr(n)||r===null)return[-1,-1];let[i,a]=r,o=e.getTextContent(),s=o.length,c=-1,l=-1;if(i.type===`text`&&a.type===`text`){let t=i.getNode(),n=a.getNode();t===n&&e===t&&i.offset!==a.offset?[c,l]=i.offset<a.offset?[i.offset,a.offset]:[a.offset,i.offset]:[c,l]=e===t?t.isBefore(n)?[i.offset,s]:[0,i.offset]:e===n?n.isBefore(t)?[a.offset,s]:[0,a.offset]:[0,s]}let u=(o.slice(0,c).match(Ko)||[]).length,d=(o.slice(c,l).match(Ko)||[]).length;return[c+u,l+u+d]}(r,a);if(l===u)return``;let d=e[e.length-1]===$.hasNextSibling?$.ancestorHasNextSibling:$.ancestorIsLastChild,f=[...e.slice(0,e.length-1),d],p=Array(l+1).fill(` `),m=Array(u-l).fill($.selectedChar),h=o.length+2,g=Array(i.length+h).fill(` `);return[$.selectedLine,f.join(` `),[...g,...p,...m].join(``)].join(` `)+`
10
+ `}({indent:r,isSelected:l,node:n,nodeKeyDisplay:s,selection:e,typeDisplay:c})}),e===null?`: null`:t.bn(e)?function(e){let n=``,r=ns(e),i=function(e){let n=e;for(;n!==null;){let e=t.tn(n);if(e!==null){let r=t.wt(n);if(r!==null)return{host:r,name:e}}n=n.getParent()??t.wt(n)}return null}(e.anchor.getNode()),a=i===null?``:` (in slot "${i.name}" of ${i.host.getType()} { key: ${i.host.getKey()} })`;n+=`: range${a} ${r===``?``:`{ ${r} }`} ${e.style===``?``:`{ style: ${e.style} } `}`;let o=e.anchor,s=e.focus,c=o.offset,l=s.offset;return n+=`\n \u251c anchor { key: ${o.key}, offset: ${c===null?`null`:c}, type: ${o.type} }`,n+=`\n \u2514 focus { key: ${s.key}, offset: ${l===null?`null`:l}, type: ${s.type} }`,n}(e):H(e)?function(e){return`: table\n \u2514 { table: ${e.tableKey}, anchorCell: ${e.anchor.key}, focusCell: ${e.focus.key} }`}(e):function(e){return t.Fr(e)?`: node\n \u2514 [${Array.from(e._nodes).join(`, `)}]`:``}(e)},{editor:e});if(d+=`
11
11
  selection`+f,d+=`
12
12
 
13
13
  commands:`,n.length)for(let{index:e,type:t,payload:r}of n)d+=`\n \u2514 ${e}. { type: ${t}, payload: ${r instanceof Event?r.constructor.name:r} }`;else d+=`
14
- └ None dispatched.`;let{version:p}=e.constructor;return d+=`\n\n editor${p?` (v${p})`:``}:`,d+=`\n \u2514 namespace ${c.namespace}`,l!==null&&(d+=`\n \u2514 compositionKey ${l}`),d+=`\n \u2514 editable ${String(u)}`,d}function Jo(e,n,r=[]){let i=[];for(let n of t.or(e)){let r=t.lr(e,n);r!==null&&i.push([n,r])}let a=t.vt(e)?e.getChildren():[],o=i.length+a.length,s=0;for(let[e,a]of i){let i=s===o-1;n(a,r.concat(i?$.isLastChild:$.hasNextSibling),e),(t.vt(a)||t.$(a))&&Jo(a,n,r.concat(i?$.ancestorIsLastChild:$.ancestorHasNextSibling)),s++}for(let e of a){let i=s===o-1;n(e,r.concat(i?$.isLastChild:$.hasNextSibling)),(t.vt(e)||t.$(e))&&Jo(e,n,r.concat(i?$.ancestorIsLastChild:$.ancestorHasNextSibling)),s++}}function Yo(e,t=!1){let n=Object.entries(Vo).reduce((e,[t,n])=>e.replace(new RegExp(t,`g`),String(n)),e);return t?n.replace(/[^\s]/g,`*`):n}function Xo(e){let t=Go.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`detail: `+t),t}function Zo(e){let t=Ko.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`mode: `+t),t}function Qo(e){let t=Uo.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`format: `+t),t}function $o(e){let t=e.getTarget();return t!=null&&(t=`target: `+t),t}function es(e){let t=e.getRel();return t!=null&&(t=`rel: `+t),t}function ts(e){let t=e.getTitle();return t!=null&&(t=`title: `+t),t}function ns(e){if(!e.__state)return!1;let t=[];for(let[n,r]of e.__state.knownState.entries()){if(n.isEqual(r,n.defaultValue))continue;let e=JSON.stringify(n.unparse(r));t.push(`[${n.key}: ${e}]`)}let n=t.join(`,`);return n!==``&&(n=`state: `+n),n}function rs(e,t){let n=Array(1+t++).join(` `),r=Array(t-1).join(` `),i;for(let a=0;a<e.children.length;a++)i=document.createTextNode(`
15
- `+n),e.insertBefore(i,e.children[a]),rs(e.children[a],t),e.lastElementChild===e.children[a]&&(i=document.createTextNode(`
16
- `+r),e.appendChild(i));return e}var is=(0,a.forwardRef)(function({treeTypeButtonClassName:e,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:n,timeTravelPanelButtonClassName:r,viewClassName:i,timeTravelPanelClassName:s,editorState:c,setEditorState:l,setEditorReadOnly:u,generateContent:d,commandsLog:f=[]},p){let[m,h]=(0,a.useState)([]),[g,_]=(0,a.useState)(``),[v,y]=(0,a.useState)(!1),[b,x]=(0,a.useState)(!1),S=(0,a.useRef)(0),C=(0,a.useRef)(null),[w,T]=(0,a.useState)(!1),[E,D]=(0,a.useState)(!1),[O,k]=(0,a.useState)(!1),A=(0,a.useRef)(null),j=(0,a.useRef)([]),M=(0,a.useRef)(0),N=(0,a.useCallback)(e=>{let t=++M.current;d(e).then(e=>{t===M.current&&_(e)}).catch(e=>{t===M.current&&_(`Error rendering tree: ${e.message}\n\nStack:\n${e.stack}`)})},[d]);(0,a.useEffect)(()=>{if(!(!O&&c._nodeMap.size>1e3&&(D(!0),!O))&&(A.current!==c||j.current!==f)){let e=A.current!==c;A.current=c,j.current=f,N(b),!v&&e&&h(e=>[...e,[Date.now(),c]])}},[c,N,b,O,v,f]);let P=m.length;return(0,a.useEffect)(()=>{if(w){let e,t=()=>{let n=S.current;if(n===P-1)return void T(!1);let r=m[n][0],i=m[n+1][0];e=setTimeout(()=>{S.current++;let e=S.current,n=C.current;n!==null&&(n.value=String(e)),l(m[e][1]),t()},i-r)};return t(),()=>{clearTimeout(e)}}},[m,w,P,l]),(0,o.jsxs)(`div`,{className:i,children:[!O&&E?(0,o.jsxs)(`div`,{style:{padding:20},children:[(0,o.jsx)(`span`,{style:{marginRight:20},children:`Detected large EditorState, this can impact debugging performance.`}),(0,o.jsx)(`button`,{onClick:()=>{k(!0)},style:{background:`transparent`,border:`1px solid white`,color:`white`,cursor:`pointer`,padding:5},children:`Show full tree`})]}):null,O?null:(0,o.jsx)(`button`,{onClick:()=>(N(!b),void x(!b)),className:e,type:`button`,children:b?`Tree`:`Export DOM`}),!v&&(O||!E)&&P>2&&(0,o.jsx)(`button`,{onClick:()=>{u(!0),S.current=P-1,y(!0)},className:t,type:`button`,children:`Time Travel`}),(O||!E)&&(0,o.jsx)(`pre`,{ref:p,children:g}),v&&(O||!E)&&(0,o.jsxs)(`div`,{className:s,children:[(0,o.jsx)(`button`,{className:r,onClick:()=>{S.current===P-1&&(S.current=1),T(!w)},type:`button`,children:w?`Pause`:`Play`}),(0,o.jsx)(`input`,{className:n,ref:C,onChange:e=>{let t=Number(e.target.value),n=m[t];n&&(S.current=t,l(n[1]))},type:`range`,min:`1`,max:P-1}),(0,o.jsx)(`button`,{className:r,onClick:()=>{u(!1);let e=m.length-1,t=m[e];l(t[1]);let n=C.current;n!==null&&(n.value=String(e)),y(!1),T(!1)},type:`button`,children:`Exit`})]})]})});function as(e,t){let n=[],r=0;for(let i of e._commands.keys())n.push(e.registerCommand(i,e=>{r+=1;let n={index:r,payload:e,type:i.type?i.type:`UNKNOWN`};return t(e=>[...e.slice(-9),n]),!1},4));return()=>n.forEach(e=>e())}function os(e){let[t,n]=(0,a.useState)([]);return(0,a.useEffect)(()=>as(e,n),[e]),t}function ss({treeTypeButtonClassName:e,timeTravelButtonClassName:n,timeTravelPanelSliderClassName:r,timeTravelPanelButtonClassName:i,timeTravelPanelClassName:s,viewClassName:c,editor:l,customPrintNode:u}){let d=a.createRef(),[f,p]=(0,a.useState)(l.getEditorState()),m=os(l);return(0,a.useEffect)(()=>t.Yn(l.registerUpdateListener(({editorState:e})=>{p(e)}),l.registerEditableListener(()=>{p(l.getEditorState())})),[l]),(0,a.useEffect)(()=>{let e=d.current;if(e!==null)return e.__lexicalEditor=l,()=>{e.__lexicalEditor=null}},[l,d]),(0,o.jsx)(is,{treeTypeButtonClassName:e,timeTravelButtonClassName:n,timeTravelPanelSliderClassName:r,timeTravelPanelButtonClassName:i,viewClassName:c,timeTravelPanelClassName:s,setEditorReadOnly:e=>{let t=l.getRootElement();t!=null&&(t.contentEditable=e?`false`:`true`)},editorState:f,setEditorState:e=>l.setEditorState(e),generateContent:async function(e){return qo(l,m,e,u)},ref:d,commandsLog:m})}function cs(){let[e]=t.oi();return(0,o.jsx)(ss,{viewClassName:`tree-view-output`,treeTypeButtonClassName:`debug-treetype-button`,timeTravelPanelClassName:`debug-timetravel-panel`,timeTravelButtonClassName:`debug-timetravel-button`,timeTravelPanelSliderClassName:`debug-timetravel-panel-slider`,timeTravelPanelButtonClassName:`debug-timetravel-panel-button`,editor:e})}Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return Mn}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return St}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return mi}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return er}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return xr}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return ai}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return vr}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return wi}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return aa}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return $i}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Ji}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return ki}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return ha}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Jr}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return ii}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return Wt}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Bo}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return ua}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return qi}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return to}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ca}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return cs}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ea}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Si}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return hi}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return It}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return ge}});
14
+ └ None dispatched.`;let{version:p}=e.constructor;return d+=`\n\n editor${p?` (v${p})`:``}:`,d+=`\n \u2514 namespace ${c.namespace}`,l!==null&&(d+=`\n \u2514 compositionKey ${l}`),d+=`\n \u2514 editable ${String(u)}`,d}function Qo(e,n,r=[]){let i=[];for(let n of t.or(e)){let r=t.lr(e,n);r!==null&&i.push([n,r])}let a=t.vt(e)?e.getChildren():[],o=i.length+a.length,s=0;for(let[e,a]of i){let i=s===o-1;n(a,r.concat(i?$.isLastChild:$.hasNextSibling),e),(t.vt(a)||t.$(a))&&Qo(a,n,r.concat(i?$.ancestorIsLastChild:$.ancestorHasNextSibling)),s++}for(let e of a){let i=s===o-1;n(e,r.concat(i?$.isLastChild:$.hasNextSibling)),(t.vt(e)||t.$(e))&&Qo(e,n,r.concat(i?$.ancestorIsLastChild:$.ancestorHasNextSibling)),s++}}function $o(e,t=!1){let n=Object.entries(Go).reduce((e,[t,n])=>e.replace(new RegExp(t,`g`),String(n)),e);return t?n.replace(/[^\s]/g,`*`):n}function es(e){let t=Yo.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`detail: `+t),t}function ts(e){let t=Xo.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`mode: `+t),t}function ns(e){let t=qo.map(t=>t(e)).filter(Boolean).join(`, `).toLocaleLowerCase();return t!==``&&(t=`format: `+t),t}function rs(e){let t=e.getTarget();return t!=null&&(t=`target: `+t),t}function is(e){let t=e.getRel();return t!=null&&(t=`rel: `+t),t}function as(e){let t=e.getTitle();return t!=null&&(t=`title: `+t),t}function os(e){if(!e.__state)return!1;let t=[];for(let[n,r]of e.__state.knownState.entries()){if(n.isEqual(r,n.defaultValue))continue;let e=JSON.stringify(n.unparse(r));t.push(`[${n.key}: ${e}]`)}let n=t.join(`,`);return n!==``&&(n=`state: `+n),n}function ss(e,t){let n=Array(1+t++).join(` `),r=Array(t-1).join(` `),i;for(let a=0;a<e.children.length;a++)i=document.createTextNode(`
15
+ `+n),e.insertBefore(i,e.children[a]),ss(e.children[a],t),e.lastElementChild===e.children[a]&&(i=document.createTextNode(`
16
+ `+r),e.appendChild(i));return e}var cs=(0,a.forwardRef)(function({treeTypeButtonClassName:e,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:n,timeTravelPanelButtonClassName:r,viewClassName:i,timeTravelPanelClassName:s,editorState:c,setEditorState:l,setEditorReadOnly:u,generateContent:d,commandsLog:f=[]},p){let[m,h]=(0,a.useState)([]),[g,_]=(0,a.useState)(``),[v,y]=(0,a.useState)(!1),[b,x]=(0,a.useState)(!1),S=(0,a.useRef)(0),C=(0,a.useRef)(null),[w,T]=(0,a.useState)(!1),[E,D]=(0,a.useState)(!1),[O,k]=(0,a.useState)(!1),A=(0,a.useRef)(null),j=(0,a.useRef)([]),M=(0,a.useRef)(0),N=(0,a.useCallback)(e=>{let t=++M.current;d(e).then(e=>{t===M.current&&_(e)}).catch(e=>{t===M.current&&_(`Error rendering tree: ${e.message}\n\nStack:\n${e.stack}`)})},[d]);(0,a.useEffect)(()=>{if(!(!O&&c._nodeMap.size>1e3&&(D(!0),!O))&&(A.current!==c||j.current!==f)){let e=A.current!==c;A.current=c,j.current=f,N(b),!v&&e&&h(e=>[...e,[Date.now(),c]])}},[c,N,b,O,v,f]);let P=m.length;return(0,a.useEffect)(()=>{if(w){let e,t=()=>{let n=S.current;if(n===P-1)return void T(!1);let r=m[n][0],i=m[n+1][0];e=setTimeout(()=>{S.current++;let e=S.current,n=C.current;n!==null&&(n.value=String(e)),l(m[e][1]),t()},i-r)};return t(),()=>{clearTimeout(e)}}},[m,w,P,l]),(0,o.jsxs)(`div`,{className:i,children:[!O&&E?(0,o.jsxs)(`div`,{style:{padding:20},children:[(0,o.jsx)(`span`,{style:{marginRight:20},children:`Detected large EditorState, this can impact debugging performance.`}),(0,o.jsx)(`button`,{onClick:()=>{k(!0)},style:{background:`transparent`,border:`1px solid white`,color:`white`,cursor:`pointer`,padding:5},children:`Show full tree`})]}):null,O?null:(0,o.jsx)(`button`,{onClick:()=>(N(!b),void x(!b)),className:e,type:`button`,children:b?`Tree`:`Export DOM`}),!v&&(O||!E)&&P>2&&(0,o.jsx)(`button`,{onClick:()=>{u(!0),S.current=P-1,y(!0)},className:t,type:`button`,children:`Time Travel`}),(O||!E)&&(0,o.jsx)(`pre`,{ref:p,children:g}),v&&(O||!E)&&(0,o.jsxs)(`div`,{className:s,children:[(0,o.jsx)(`button`,{className:r,onClick:()=>{S.current===P-1&&(S.current=1),T(!w)},type:`button`,children:w?`Pause`:`Play`}),(0,o.jsx)(`input`,{className:n,ref:C,onChange:e=>{let t=Number(e.target.value),n=m[t];n&&(S.current=t,l(n[1]))},type:`range`,min:`1`,max:P-1}),(0,o.jsx)(`button`,{className:r,onClick:()=>{u(!1);let e=m.length-1,t=m[e];l(t[1]);let n=C.current;n!==null&&(n.value=String(e)),y(!1),T(!1)},type:`button`,children:`Exit`})]})]})});function ls(e,t){let n=[],r=0;for(let i of e._commands.keys())n.push(e.registerCommand(i,e=>{r+=1;let n={index:r,payload:e,type:i.type?i.type:`UNKNOWN`};return t(e=>[...e.slice(-9),n]),!1},4));return()=>n.forEach(e=>e())}function us(e){let[t,n]=(0,a.useState)([]);return(0,a.useEffect)(()=>ls(e,n),[e]),t}function ds({treeTypeButtonClassName:e,timeTravelButtonClassName:n,timeTravelPanelSliderClassName:r,timeTravelPanelButtonClassName:i,timeTravelPanelClassName:s,viewClassName:c,editor:l,customPrintNode:u}){let d=a.createRef(),[f,p]=(0,a.useState)(l.getEditorState()),m=us(l);return(0,a.useEffect)(()=>t.Yn(l.registerUpdateListener(({editorState:e})=>{p(e)}),l.registerEditableListener(()=>{p(l.getEditorState())})),[l]),(0,a.useEffect)(()=>{let e=d.current;if(e!==null)return e.__lexicalEditor=l,()=>{e.__lexicalEditor=null}},[l,d]),(0,o.jsx)(cs,{treeTypeButtonClassName:e,timeTravelButtonClassName:n,timeTravelPanelSliderClassName:r,timeTravelPanelButtonClassName:i,viewClassName:c,timeTravelPanelClassName:s,setEditorReadOnly:e=>{let t=l.getRootElement();t!=null&&(t.contentEditable=e?`false`:`true`)},editorState:f,setEditorState:e=>l.setEditorState(e),generateContent:async function(e){return Zo(l,m,e,u)},ref:d,commandsLog:m})}function fs(){let[e]=t.oi();return(0,o.jsx)(ds,{viewClassName:`tree-view-output`,treeTypeButtonClassName:`debug-treetype-button`,timeTravelPanelClassName:`debug-timetravel-panel`,timeTravelButtonClassName:`debug-timetravel-button`,timeTravelPanelSliderClassName:`debug-timetravel-panel-slider`,timeTravelPanelButtonClassName:`debug-timetravel-panel-button`,editor:e})}Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return Mn}}),Object.defineProperty(exports,"$t",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Xr}}),Object.defineProperty(exports,"At",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(exports,"Bt",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return vi}}),Object.defineProperty(exports,"Ct",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return mi}}),Object.defineProperty(exports,"Dt",{enumerable:!0,get:function(){return St}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(exports,"Et",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return Gr}}),Object.defineProperty(exports,"Ft",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(exports,"Gt",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(exports,"Ht",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(exports,"It",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Kn}}),Object.defineProperty(exports,"Jt",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return er}}),Object.defineProperty(exports,"Kt",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return xr}}),Object.defineProperty(exports,"Lt",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return Fr}}),Object.defineProperty(exports,"Mt",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return Lr}}),Object.defineProperty(exports,"Nt",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return ai}}),Object.defineProperty(exports,"Ot",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(exports,"Pt",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(exports,"Qt",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(exports,"Rt",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return Di}}),Object.defineProperty(exports,"St",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return pi}}),Object.defineProperty(exports,"Tt",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(exports,"Ut",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return vr}}),Object.defineProperty(exports,"Vt",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(exports,"Wt",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"Xt",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(exports,"Yt",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return Cn}}),Object.defineProperty(exports,"Zt",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return wi}}),Object.defineProperty(exports,"_t",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(exports,"at",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Ci}}),Object.defineProperty(exports,"bt",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return aa}}),Object.defineProperty(exports,"ct",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return $i}}),Object.defineProperty(exports,"dt",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(exports,"en",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Ji}}),Object.defineProperty(exports,"ft",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return zi}}),Object.defineProperty(exports,"gt",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return ki}}),Object.defineProperty(exports,"ht",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return ha}}),Object.defineProperty(exports,"in",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Jr}}),Object.defineProperty(exports,"jt",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return ii}}),Object.defineProperty(exports,"kt",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Qi}}),Object.defineProperty(exports,"lt",{enumerable:!0,get:function(){return Wt}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Bi}}),Object.defineProperty(exports,"mt",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Wo}}),Object.defineProperty(exports,"nn",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return ua}}),Object.defineProperty(exports,"ot",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return qi}}),Object.defineProperty(exports,"pt",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Qn}}),Object.defineProperty(exports,"qt",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ao}}),Object.defineProperty(exports,"rn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ca}}),Object.defineProperty(exports,"st",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return fs}}),Object.defineProperty(exports,"tn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return jn}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return ea}}),Object.defineProperty(exports,"ut",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Si}}),Object.defineProperty(exports,"vt",{enumerable:!0,get:function(){return It}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return hi}}),Object.defineProperty(exports,"wt",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return Ti}}),Object.defineProperty(exports,"xt",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return Ei}}),Object.defineProperty(exports,"yt",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(exports,"zt",{enumerable:!0,get:function(){return ge}});