@payloadcms/richtext-lexical 3.8.0 → 3.9.0

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.
@@ -36,7 +36,7 @@ ${e.map(Fa).join(`
36
36
  `),n=!1,r=[];for(let i=0;i<o.length;i++){let l=o[i],s=r[r.length-1];if(Np.test(l)){r.push(l);continue}if((El.test(l)&&!n||wl.test(l)&&n)&&(n=!n),El.test(l)||wl.test(l)){r.push(l);continue}if(n){r.push(l);continue}_l.test(l)||_l.test(s)||!s||Tl.test(s)||Tl.test(l)||kp.test(l)||Tp.test(l)||Ep.test(l)||wp.test(l)||Lp.test(l)||Rp.test(l)||!e||kl.test(l)||Nl.test(l)||kl.test(s)||Nl.test(s)?r.push(l):r[r.length-1]=s+" "+l.trim()}return r.join(`
37
37
  `)}function Ll(t,e=pr,o,n=!1,r=!0){let i=n?t:Ip(t,r);return fr(i,e,o)}var Sl=/^\|(.+)\|\s?$/,$p=/^(\| ?:?-*:? ?)+\|\s?$/,yl=({allTransformers:t})=>({type:"element",dependencies:[Dp,Ap,Mp],export:e=>{if(!Zo(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Xo(n))continue;let i=!1;for(let l of n.getChildren())Rl(l)&&(r.push(hr(t,l).replace(/\n/g,"\\n")),l.__headerState===Vt.ROW&&(i=!0));o.push(`| ${r.join(" | ")} |`),i&&o.push(`| ${r.map(l=>"---").join(" | ")} |`)}return o.join(`
38
38
  `)},regExp:Sl,replace:(e,o,n)=>{if($p.test(n[0])){let c=e.getPreviousSibling();if(!c||!Zo(c))return;let d=c.getChildren(),m=d[d.length-1];if(!m||!Xo(m))return;m.getChildren().forEach(p=>{Rl(p)&&p.setHeaderStyles(Vt.ROW,Vt.ROW)}),e.remove();return}let r=Il(n[0],t);if(r==null)return;let i=[r],l=e.getPreviousSibling(),s=r.length;for(;l&&!(!Fp(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!Op(c))break;let d=Il(c.getTextContent(),t);if(d==null)break;s=Math.max(s,d.length),i.unshift(d);let m=l.getPreviousSibling();l.remove(),l=m}let a=yp();for(let c of i){let d=vp();a.append(d);for(let m=0;m<s;m++)d.append(m<c.length?c[m]:vl("",t))}let u=e.getPreviousSibling();Zo(u)&&Pp(u)===s?(u.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Pp(t){let e=t.getFirstChild();return Xo(e)?e.getChildrenSize():0}var vl=(t,e)=>{t=t.replace(/\\n/g,`
39
- `);let o=Sp(Vt.NO_STATUS);return Ll(t,e,o),o},Il=(t,e)=>{let o=t.match(Sl);return!o||!o[1]?null:o[1].split("|").map(n=>vl(n,e))};import{c as Hp}from"react/compiler-runtime";import{jsx as P,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Fl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as jp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Gp,$deleteTableRow__EXPERIMENTAL as Up,$getNodeTriplet as Wp,$getTableCellNodeFromLexicalNode as Vp,$getTableColumnIndexFromTableCellNode as Kp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as zp,$insertTableColumn__EXPERIMENTAL as Zp,$insertTableRow__EXPERIMENTAL as Xp,$isTableCellNode as Kt,$isTableRowNode as Dl,$isTableSelection as Zt,$unmergeCell as Yp,getTableObserverFromTableElement as Jp,TableCellHeaderStates as Ee,TableCellNode as qp}from"@lexical/table";import{useScrollInfo as Qp}from"@payloadcms/ui";import{$createParagraphNode as ef,$getRoot as tf,$getSelection as Xt,$isElementNode as of,$isParagraphNode as Ol,$isRangeSelection as qo,$isTextNode as rf}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as ye,useRef as zt,useState as Pe}from"react";import{createPortal as $l}from"react-dom";import{jsx as Yo,jsxs as Bp}from"react/jsx-runtime";import"react";var Ml=()=>Bp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Yo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Yo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function nf(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Wp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Al(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Ol(e)||!e.isEmpty())}function lf(t){let e=t.getLastDescendant();rf(e)?e.select():of(e)?e.selectEnd():e!==null&&e.selectNext()}function sf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Fl(),l=zt(null),[s,a]=Pe(r),[u,c]=Pe({columns:1,rows:1}),[d,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=Qp();ye(()=>i.registerMutationListener(qp,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),ye(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(nf())})},[i]),ye(()=>{let b=e.current,T=l.current,S=i.getRootElement();if(b!=null&&T!=null&&S!=null){let L=S.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>L.right){let W=A.left-M.width-O;G=(W<0?O:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?O:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),ye(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),S=i.getElementByKey(T.getKey());if(!S)throw new Error("Expected to find tableElement in DOM");let L=Jp(S);L!==null&&L.clearHighlight(),T.markDirty(),a(s.getLatest())}tf().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:S}=Jo(b),L=b.getNodes(),A=null;for(let M=0;M<L.length;M++){let O=L[M];if(Kt(O))if(A===null){O.setColSpan(T).setRowSpan(S),A=O;let G=Al(O),$;G&&Ol($=O.getFirstChild())&&$.remove()}else Kt(A)&&(Al(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(ef()),lf(A)),o()}})},v=()=>{i.update(()=>{Yp()})},D=ae(b=>{i.update(()=>{Xp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<u.columns;T++)Zp(b);o()})},[i,o,u.columns]),E=ae(()=>{i.update(()=>{Up(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Gp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=zp(s),S=b.getChildren();if(T>=S.length||T<0)throw new Error("Expected table cell to be inside of table row.");let L=S[T];if(!Dl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Kp(s),S=b.getChildren(),L=Math.max(...S.map(M=>M.getChildren().length));if(T>=L||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!Dl(O))throw new Error("Expected table row");let G=O.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),R=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),I=null;return t&&(d?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),$l(xe("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?xe(Qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function af({anchorElem:t,cellMerge:e}){let[o]=Fl(),n=zt(null),r=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),u=ae(()=>{let d=n.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Vp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);ye(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{u()})})),ye(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${w}px, ${C}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let c=zt(s);return ye(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&xe(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P(Ml,{})}),i&&P(sf,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Pl=t=>{let e=Hp(3),{anchorElem:o}=t,n=jp(),r;return e[0]!==o||e[1]!==n?(r=$l(n?P(af,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as cf}from"react/compiler-runtime";import{jsx as Jt,jsxs as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as pf,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as ff,$isTableCellNode as Bl,$isTableRowNode as hf,getDOMCellFromTarget as gf,TableNode as Cf}from"@lexical/table";import{calculateZoomLevel as Hl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Gl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as xf}from"react-dom";var bf=33,jl=92;function _f({editor:t}){let e=Yt(null),o=Yt(null),n=Yt(null),r=B(),i=Yt(null),[l,s]=mt(null),[a,u]=mt(null),[c,d]=mt(!1),[m,p]=mt(null),f=dt(()=>{u(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(Cf,k=>{if(k.getColWidths())return k;let R=k.getColumnCount(),I=jl;return k.setColWidths(Array(R).fill(I)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let S=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(d(h(T)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let L=gf(S);L&&a!==L?t.update(()=>{let A=tr(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),O=t.getElementByKey(M.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,n.current=O.getBoundingClientRect(),u(L)}):L==null&&f()}},0)},R=T=>{setTimeout(()=>{d(!0)},0)},I=T=>{setTimeout(()=>{d(!1)},0)},b=t.registerRootListener((T,S)=>{S?.removeEventListener("mousemove",k),S?.removeEventListener("mousedown",R),S?.removeEventListener("mouseup",I),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",R),T?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),b=ff(R)+R.getRowSpan()-1,T=I.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let S=T[b];if(!hf(S))throw new Error("Expected table row");let L=S.getHeight();if(L===void 0){let M=S.getChildren();L=Math.min(...M.map(O=>v(O,t)??1/0))}let A=Math.max(L+k,bf);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,R)=>R.getElementByKey(k.getKey())?.clientHeight,D=(k,R)=>{for(let I=0;I<R.length;I++)for(let b=0;b<R[I].length;b++)if(R[I][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),[b]=pf(I,null,null),T=D(R,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let S=I.getColWidths();if(!S)return;let L=S[T];if(L===void 0)return;let A=[...S],M=Math.max(L+k,jl);A[T]=M,I.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let R=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let S=Hl(I.target);if(C(k)){let L=(I.clientY-T)/S;w(L)}else{let L=(I.clientX-b)/S;x(L)}f(),document.removeEventListener("mouseup",R)}};return R},[a,f,x,w]),g=dt(k=>R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:R,top:I,width:b}=a.elem.getBoundingClientRect(),T=Hl(a.elem),S=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+I+k-S/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+R+b-S/2}px`,top:`${window.scrollY+I}px`,width:`${S}px`}},A=n.current;m&&l&&A&&(C(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/T}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/T}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),N(L)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&uf(Gl.Fragment,{children:[Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Ul=()=>{let t=cf(3),[e]=df(),o=mf(),n,r;return t[0]!==e||t[1]!==o?(r=o?xf(Jt(_f,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],n=r,n};import{c as If}from"react/compiler-runtime";import{jsx as rr,jsxs as Sf,Fragment as yf}from"react/jsx-runtime";import{useLexicalComposerContext as Jl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as vf,$getTableRowIndexFromTableCellNode as Mf,$insertTableColumn__EXPERIMENTAL as Df,$insertTableRow__EXPERIMENTAL as Af,$isTableCellNode as Ff,$isTableNode as Kl,TableNode as Of}from"@lexical/table";import{$findMatchingParent as $f,mergeRegister as Pf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zl}from"lexical";import{useEffect as Zl,useMemo as Bf,useRef as Xl,useState as qt}from"react";import"react";import{createPortal as Hf}from"react-dom";import{c as Nf}from"react/compiler-runtime";import{useEffect as Lf,useRef as Rf}from"react";var Tf="Expected a function",Ef=Math.max,wf=Math.min;function kf(t,e,o){let n,r,i=0,l,s=!1,a=!1,u,c,d,m=!0;if(typeof t!="function")throw new TypeError(Tf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,u=a?Ef(o.maxWait||0,e):u,m="trailing"in o?!!o.trailing:m);function p(g){let _=n,N=l;return n=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,d=setTimeout(w,e),s?p(g):c}function h(g){let _=g-r,N=g-i,k=e-_;return a?wf(k,u-N):k}function C(g){let _=g-r,N=g-i;return r===void 0||_>=e||_<0||a&&N>=u}function w(){let g=Date.now();if(C(g))return v(g);d=setTimeout(w,h(g))}function v(g){return d=void 0,m&&n?p(g):(n=l=void 0,c)}function D(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function x(){return d===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(n=arguments,l=this,r=g,_){if(d===void 0)return f(r);if(a)return clearTimeout(d),d=setTimeout(w,e),p(r)}return d===void 0&&(d=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var Wl=kf;function Vl(t,e,o){let n=Nf(6),r=Rf(null),i,l;n[0]!==t||n[1]!==o||n[2]!==e?(i=()=>(r.current=Wl(t,e,{maxWait:o}),()=>{r.current?.cancel()}),l=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=i,n[4]=l):(i=n[3],l=n[4]),Lf(i,l);let s;return n[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let c=u;r.current&&r.current(...c)},n[5]=s):s=n[5],s}var Yl=20;function jf({anchorElem:t}){let[e]=Jl(),o=B(),[n,r]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[u,c]=qt({}),d=Xl(new Set),m=Xl(null),p=Vl(C=>{let{isOutside:w,tableDOMNode:v}=Gf(C,o.editorConfig?.lexical);if(w){r(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=zl(v);if(Ff(g)){let _=$f(g,N=>Kl(N));if(!Kl(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),R=Mf(g),I=vf(g);R===N-1?D=g:I===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:R,y:I}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),r(!0),c({height:Yl,left:N-b,top:g-T+5,width:R})):x&&(l(!0),r(!1),c({height:_,left:k-b+5,top:I-T,width:Yl}))}},50,250),f=Bf(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);Zl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Zl(()=>Pf(e.registerMutationListener(Of,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":d.current.add(w),a(d.current.size>0),D&&f.observe(D);break;case"destroyed":d.current.delete(w),a(d.current.size>0),f.disconnect(),d.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(zl(m.current)?.selectEnd(),C?(Af(),r(!1)):(Df(),l(!1)))})};return e?.isEditable()?Sf(yf,{children:[n&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function Gf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function ql(t){let e=If(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=Jl();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Hf(rr(jf,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Uf}from"react/compiler-runtime";import{jsx as nr,jsxs as Wf}from"react/jsx-runtime";import{useLexicalComposerContext as Vf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Kf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as zf,TableNode as Zf}from"@lexical/table";import{mergeRegister as Xf}from"@lexical/utils";import{formatDrawerSlug as Yf,useEditDepth as Jf}from"@payloadcms/ui";import{$getSelection as qf,$isRangeSelection as Qf,COMMAND_PRIORITY_EDITOR as e1,createCommand as t1}from"lexical";import{createContext as o1,useContext as r1,useEffect as n1,useMemo as i1,useState as l1}from"react";import*as Ql from"react";var Qt=t1("OPEN_EMBED_DRAWER_COMMAND"),es=o1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ts({children:t}){let[e,o]=l1({cellEditorConfig:null,cellEditorPlugins:null});return nr(es.Provider,{value:i1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var os=()=>{let t=Uf(16),[e]=Vf(),o=r1(es),n=Jf(),{fieldProps:r,uuid:i}=B(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==n||t[1]!==s?(a=Yf({slug:s,depth:n}),t[0]=n,t[1]=s,t[2]=a):a=t[2];let u=a,{toggleDrawer:c}=ce(u,!0),d;t[3]!==e||t[4]!==c?(d=()=>{if(!e.hasNodes([Zf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Xf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=qf();Qf(C)&&(h=C)}),h&&c(),!0},e1))},t[3]=e,t[4]=c,t[5]=d):d=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],n1(d,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(zf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==p?(f=Wf(Ql.Fragment,{children:[nr(He,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(Kf,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=u,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var u1=y({markdownTransformers:[yl],nodes:[a1,s1,c1],plugins:[{Component:os,position:"normal"},{Component:Ul,position:"normal"},{Component:Pl,position:"floatingAnchorElem"},{Component:ql,position:"floatingAnchorElem"}],providers:[ts],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[me([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as A1}from"lexical";import{jsx as ir,jsxs as d1}from"react/jsx-runtime";import"react";var lr=()=>d1("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as _1}from"react/compiler-runtime";import{jsx as T1}from"react/jsx-runtime";import{useLexicalComposerContext as E1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as w1,mergeRegister as k1}from"@lexical/utils";import{useConfig as N1}from"@payloadcms/ui";import{$getPreviousSelection as L1,$getSelection as R1,$isParagraphNode as ns,$isRangeSelection as I1,COMMAND_PRIORITY_EDITOR as S1,createCommand as y1}from"lexical";import{useEffect as v1}from"react";import{c as m1}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as f1,COMMAND_PRIORITY_EDITOR as h1}from"lexical";import{useEffect as g1,useState as C1}from"react";var x1=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=f1(o);r&&r.replace(Ke({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:n})},b1=t=>{let e=m1(13),{enabledCollectionSlugs:o}=t,[n]=p1(),[r,i]=C1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:u}=lt(l),c,d;e[2]!==n||e[3]!==u?(c=()=>n.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),h1),d=[n,u],e[2]=n,e[3]=u,e[4]=c,e[5]=d):(c=e[4],d=e[5]),g1(c,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),x1({editor:n,relationTo:C,replaceNodeKey:r,value:w})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=sr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},rs=t=>sr(bt,{...t,uploads:!0,children:sr(b1,{...t})});var ar=y1("INSERT_UPLOAD_COMMAND"),is=t=>{let e=_1(5),[o]=E1(),{config:n}=N1(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return k1(o.registerCommand(ar,a=>(o.update(()=>{let u=R1()||L1();if(I1(u)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});w1(c);let{focus:d}=u,m=d.getNode();ns(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(M1).length>1&&m.remove()}}),!0),S1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),v1(i,l);let s;return e[3]!==r?(s=T1(rs,{enabledCollectionSlugs:r.map(D1)}),e[3]=r,e[4]=s):s=e[4],s};function M1(t){return ns(t)}function D1(t){let{slug:e}=t;return e}var F1=y({nodes:[Ve],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:lr,isActive:({selection:t})=>{if(!A1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as O1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as $1}from"@payloadcms/ui";import{lazy as P1,Suspense as B1,useEffect as H1,useState as j1}from"react";var ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:ls};function ss({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:n}){for(let s of n.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");n.features=n.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let r=new Map;for(let s of n.features)r.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of n.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:r,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:n}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var as=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let n of o.nodes)e.nodes.push(n);if(o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}if(o.markdownTransformers?.length)for(let n of o.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function cr(t,e,o){return{admin:o,features:as(t),lexical:e,resolvedFeatureMap:t}}var G1=P1(()=>import("./Field-G3GIPW2U.js").then(t=>({default:t.RichText}))),U1=t=>{let e=O1(14),{admin:o,clientFeatures:n,featureClientSchemaMap:r,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let u=a,c=l===void 0?eo:l,[d,m]=j1(null),p,f;e[2]!==u||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==s?(p=()=>{if(d)return;let C=[];for(let[D,x]of Object.entries(n))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ss({featureClientSchemaMap:r,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,u))},f=[c,u,d,n,r,i,s],e[2]=u,e[3]=n,e[4]=r,e[5]=i,e[6]=d,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),H1(p,f);let h;return e[11]!==d||e[12]!==t?(h=ur(B1,{fallback:ur($1,{height:"35vh"}),children:d&&ur(G1,{...t,editorConfig:d})}),e[11]=d,e[12]=t,e[13]=h):h=e[13],h};function W1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function cs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=cs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cs(l);for(let u of n)a!==null&&u([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},to.set(t,o)}return o.listeners.add(e),()=>{V1(t,e)}}function V1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function K1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function X1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Y1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,J1="\xA0",q1=`
39
+ `);let o=Sp(Vt.NO_STATUS);return Ll(t,e,o),o},Il=(t,e)=>{let o=t.match(Sl);return!o||!o[1]?null:o[1].split("|").map(n=>vl(n,e))};import{c as Hp}from"react/compiler-runtime";import{jsx as P,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Fl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as jp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Gp,$deleteTableRow__EXPERIMENTAL as Up,$getNodeTriplet as Wp,$getTableCellNodeFromLexicalNode as Vp,$getTableColumnIndexFromTableCellNode as Kp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as zp,$insertTableColumn__EXPERIMENTAL as Zp,$insertTableRow__EXPERIMENTAL as Xp,$isTableCellNode as Kt,$isTableRowNode as Dl,$isTableSelection as Zt,$unmergeCell as Yp,getTableObserverFromTableElement as Jp,TableCellHeaderStates as Ee,TableCellNode as qp}from"@lexical/table";import{useScrollInfo as Qp}from"@payloadcms/ui";import{$createParagraphNode as ef,$getRoot as tf,$getSelection as Xt,$isElementNode as of,$isParagraphNode as Ol,$isRangeSelection as qo,$isTextNode as rf}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as ye,useRef as zt,useState as Pe}from"react";import{createPortal as $l}from"react-dom";import{jsx as Yo,jsxs as Bp}from"react/jsx-runtime";import"react";var Ml=()=>Bp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Yo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Yo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function nf(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Wp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Al(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Ol(e)||!e.isEmpty())}function lf(t){let e=t.getLastDescendant();rf(e)?e.select():of(e)?e.selectEnd():e!==null&&e.selectNext()}function sf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Fl(),l=zt(null),[s,a]=Pe(r),[u,c]=Pe({columns:1,rows:1}),[d,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=Qp();ye(()=>i.registerMutationListener(qp,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),ye(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(nf())})},[i]),ye(()=>{let b=e.current,T=l.current,S=i.getRootElement();if(b!=null&&T!=null&&S!=null){let L=S.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>L.right){let W=A.left-M.width-O;G=(W<0?O:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?O:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),ye(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),S=i.getElementByKey(T.getKey());if(!S)throw new Error("Expected to find tableElement in DOM");let L=Jp(S);L!==null&&L.clearHighlight(),T.markDirty(),a(s.getLatest())}tf().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:S}=Jo(b),L=b.getNodes(),A=null;for(let M=0;M<L.length;M++){let O=L[M];if(Kt(O))if(A===null){O.setColSpan(T).setRowSpan(S),A=O;let G=Al(O),$;G&&Ol($=O.getFirstChild())&&$.remove()}else Kt(A)&&(Al(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(ef()),lf(A)),o()}})},v=()=>{i.update(()=>{Yp()})},D=ae(b=>{i.update(()=>{Xp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<u.columns;T++)Zp(b);o()})},[i,o,u.columns]),E=ae(()=>{i.update(()=>{Up(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Gp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=zp(s),S=b.getChildren();if(T>=S.length||T<0)throw new Error("Expected table cell to be inside of table row.");let L=S[T];if(!Dl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Kp(s),S=b.getChildren(),L=Math.max(...S.map(M=>M.getChildren().length));if(T>=L||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!Dl(O))throw new Error("Expected table row");let G=O.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),R=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),I=null;return t&&(d?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),$l(xe("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?xe(Qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function af({anchorElem:t,cellMerge:e}){let[o]=Fl(),n=zt(null),r=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),u=ae(()=>{let d=n.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Vp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);ye(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{u()})})),ye(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${w}px, ${C}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let c=zt(s);return ye(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&xe(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P(Ml,{})}),i&&P(sf,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Pl=t=>{let e=Hp(3),{anchorElem:o}=t,n=jp(),r;return e[0]!==o||e[1]!==n?(r=$l(n?P(af,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as cf}from"react/compiler-runtime";import{jsx as Jt,jsxs as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as pf,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as ff,$isTableCellNode as Bl,$isTableRowNode as hf,getDOMCellFromTarget as gf,TableNode as Cf}from"@lexical/table";import{calculateZoomLevel as Hl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Gl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as xf}from"react-dom";var bf=33,jl=92;function _f({editor:t}){let e=Yt(null),o=Yt(null),n=Yt(null),r=B(),i=Yt(null),[l,s]=mt(null),[a,u]=mt(null),[c,d]=mt(!1),[m,p]=mt(null),f=dt(()=>{u(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(Cf,k=>{if(k.getColWidths())return k;let R=k.getColumnCount(),I=jl;return k.setColWidths(Array(R).fill(I)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let S=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(d(h(T)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let L=gf(S);L&&a!==L?t.update(()=>{let A=tr(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),O=t.getElementByKey(M.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,n.current=O.getBoundingClientRect(),u(L)}):L==null&&f()}},0)},R=T=>{setTimeout(()=>{d(!0)},0)},I=T=>{setTimeout(()=>{d(!1)},0)},b=t.registerRootListener((T,S)=>{S?.removeEventListener("mousemove",k),S?.removeEventListener("mousedown",R),S?.removeEventListener("mouseup",I),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",R),T?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),b=ff(R)+R.getRowSpan()-1,T=I.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let S=T[b];if(!hf(S))throw new Error("Expected table row");let L=S.getHeight();if(L===void 0){let M=S.getChildren();L=Math.min(...M.map(O=>v(O,t)??1/0))}let A=Math.max(L+k,bf);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,R)=>R.getElementByKey(k.getKey())?.clientHeight,D=(k,R)=>{for(let I=0;I<R.length;I++)for(let b=0;b<R[I].length;b++)if(R[I][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),[b]=pf(I,null,null),T=D(R,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let S=I.getColWidths();if(!S)return;let L=S[T];if(L===void 0)return;let A=[...S],M=Math.max(L+k,jl);A[T]=M,I.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let R=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let S=Hl(I.target);if(C(k)){let L=(I.clientY-T)/S;w(L)}else{let L=(I.clientX-b)/S;x(L)}f(),document.removeEventListener("mouseup",R)}};return R},[a,f,x,w]),g=dt(k=>R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:R,top:I,width:b}=a.elem.getBoundingClientRect(),T=Hl(a.elem),S=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+I+k-S/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+R+b-S/2}px`,top:`${window.scrollY+I}px`,width:`${S}px`}},A=n.current;m&&l&&A&&(C(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/T}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/T}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),N(L)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&uf(Gl.Fragment,{children:[Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Ul=()=>{let t=cf(3),[e]=df(),o=mf(),n,r;return t[0]!==e||t[1]!==o?(r=o?xf(Jt(_f,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],n=r,n};import{c as If}from"react/compiler-runtime";import{jsx as rr,jsxs as Sf,Fragment as yf}from"react/jsx-runtime";import{useLexicalComposerContext as Jl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as vf,$getTableRowIndexFromTableCellNode as Mf,$insertTableColumn__EXPERIMENTAL as Df,$insertTableRow__EXPERIMENTAL as Af,$isTableCellNode as Ff,$isTableNode as Kl,TableNode as Of}from"@lexical/table";import{$findMatchingParent as $f,mergeRegister as Pf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zl}from"lexical";import{useEffect as Zl,useMemo as Bf,useRef as Xl,useState as qt}from"react";import"react";import{createPortal as Hf}from"react-dom";import{c as Nf}from"react/compiler-runtime";import{useEffect as Lf,useRef as Rf}from"react";var Tf="Expected a function",Ef=Math.max,wf=Math.min;function kf(t,e,o){let n,r,i=0,l,s=!1,a=!1,u,c,d,m=!0;if(typeof t!="function")throw new TypeError(Tf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,u=a?Ef(o.maxWait||0,e):u,m="trailing"in o?!!o.trailing:m);function p(g){let _=n,N=l;return n=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,d=setTimeout(w,e),s?p(g):c}function h(g){let _=g-r,N=g-i,k=e-_;return a?wf(k,u-N):k}function C(g){let _=g-r,N=g-i;return r===void 0||_>=e||_<0||a&&N>=u}function w(){let g=Date.now();if(C(g))return v(g);d=setTimeout(w,h(g))}function v(g){return d=void 0,m&&n?p(g):(n=l=void 0,c)}function D(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function x(){return d===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(n=arguments,l=this,r=g,_){if(d===void 0)return f(r);if(a)return clearTimeout(d),d=setTimeout(w,e),p(r)}return d===void 0&&(d=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var Wl=kf;function Vl(t,e,o){let n=Nf(6),r=Rf(null),i,l;n[0]!==t||n[1]!==o||n[2]!==e?(i=()=>(r.current=Wl(t,e,{maxWait:o}),()=>{r.current?.cancel()}),l=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=i,n[4]=l):(i=n[3],l=n[4]),Lf(i,l);let s;return n[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let c=u;r.current&&r.current(...c)},n[5]=s):s=n[5],s}var Yl=20;function jf({anchorElem:t}){let[e]=Jl(),o=B(),[n,r]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[u,c]=qt({}),d=Xl(new Set),m=Xl(null),p=Vl(C=>{let{isOutside:w,tableDOMNode:v}=Gf(C,o.editorConfig?.lexical);if(w){r(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=zl(v);if(Ff(g)){let _=$f(g,N=>Kl(N));if(!Kl(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),R=Mf(g),I=vf(g);R===N-1?D=g:I===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:R,y:I}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),r(!0),c({height:Yl,left:N-b,top:g-T+5,width:R})):x&&(l(!0),r(!1),c({height:_,left:k-b+5,top:I-T,width:Yl}))}},50,250),f=Bf(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);Zl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Zl(()=>Pf(e.registerMutationListener(Of,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":d.current.add(w),a(d.current.size>0),D&&f.observe(D);break;case"destroyed":d.current.delete(w),a(d.current.size>0),f.disconnect(),d.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(zl(m.current)?.selectEnd(),C?(Af(),r(!1)):(Df(),l(!1)))})};return e?.isEditable()?Sf(yf,{children:[n&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function Gf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function ql(t){let e=If(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=Jl();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Hf(rr(jf,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Uf}from"react/compiler-runtime";import{jsx as nr,jsxs as Wf}from"react/jsx-runtime";import{useLexicalComposerContext as Vf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Kf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as zf,TableNode as Zf}from"@lexical/table";import{mergeRegister as Xf}from"@lexical/utils";import{formatDrawerSlug as Yf,useEditDepth as Jf}from"@payloadcms/ui";import{$getSelection as qf,$isRangeSelection as Qf,COMMAND_PRIORITY_EDITOR as e1,createCommand as t1}from"lexical";import{createContext as o1,useContext as r1,useEffect as n1,useMemo as i1,useState as l1}from"react";import*as Ql from"react";var Qt=t1("OPEN_EMBED_DRAWER_COMMAND"),es=o1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ts({children:t}){let[e,o]=l1({cellEditorConfig:null,cellEditorPlugins:null});return nr(es.Provider,{value:i1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var os=()=>{let t=Uf(16),[e]=Vf(),o=r1(es),n=Jf(),{fieldProps:r,uuid:i}=B(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==n||t[1]!==s?(a=Yf({slug:s,depth:n}),t[0]=n,t[1]=s,t[2]=a):a=t[2];let u=a,{toggleDrawer:c}=ce(u,!0),d;t[3]!==e||t[4]!==c?(d=()=>{if(!e.hasNodes([Zf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Xf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=qf();Qf(C)&&(h=C)}),h&&c(),!0},e1))},t[3]=e,t[4]=c,t[5]=d):d=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],n1(d,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(zf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==p?(f=Wf(Ql.Fragment,{children:[nr(He,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(Kf,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=u,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var u1=y({markdownTransformers:[yl],nodes:[a1,s1,c1],plugins:[{Component:os,position:"normal"},{Component:Ul,position:"normal"},{Component:Pl,position:"floatingAnchorElem"},{Component:ql,position:"floatingAnchorElem"}],providers:[ts],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[me([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as A1}from"lexical";import{jsx as ir,jsxs as d1}from"react/jsx-runtime";import"react";var lr=()=>d1("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as _1}from"react/compiler-runtime";import{jsx as T1}from"react/jsx-runtime";import{useLexicalComposerContext as E1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as w1,mergeRegister as k1}from"@lexical/utils";import{useConfig as N1}from"@payloadcms/ui";import{$getPreviousSelection as L1,$getSelection as R1,$isParagraphNode as ns,$isRangeSelection as I1,COMMAND_PRIORITY_EDITOR as S1,createCommand as y1}from"lexical";import{useEffect as v1}from"react";import{c as m1}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as f1,COMMAND_PRIORITY_EDITOR as h1}from"lexical";import{useEffect as g1,useState as C1}from"react";var x1=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=f1(o);r&&r.replace(Ke({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:n})},b1=t=>{let e=m1(13),{enabledCollectionSlugs:o}=t,[n]=p1(),[r,i]=C1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:u}=lt(l),c,d;e[2]!==n||e[3]!==u?(c=()=>n.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),h1),d=[n,u],e[2]=n,e[3]=u,e[4]=c,e[5]=d):(c=e[4],d=e[5]),g1(c,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),x1({editor:n,relationTo:C,replaceNodeKey:r,value:w})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=sr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},rs=t=>sr(bt,{...t,uploads:!0,children:sr(b1,{...t})});var ar=y1("INSERT_UPLOAD_COMMAND"),is=t=>{let e=_1(5),[o]=E1(),{config:n}=N1(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return k1(o.registerCommand(ar,a=>(o.update(()=>{let u=R1()||L1();if(I1(u)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});w1(c);let{focus:d}=u,m=d.getNode();ns(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(M1).length>1&&m.remove()}}),!0),S1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),v1(i,l);let s;return e[3]!==r?(s=T1(rs,{enabledCollectionSlugs:r.map(D1)}),e[3]=r,e[4]=s):s=e[4],s};function M1(t){return ns(t)}function D1(t){let{slug:e}=t;return e}var F1=y({nodes:[Ve],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:lr,isActive:({selection:t})=>{if(!A1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as O1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as $1}from"@payloadcms/ui";import{lazy as P1,Suspense as B1,useEffect as H1,useState as j1}from"react";var ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:ls};function ss({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:n}){for(let s of n.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");n.features=n.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let r=new Map;for(let s of n.features)r.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of n.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:r,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:n}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var as=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let n of o.nodes)e.nodes.push(n);if(o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}if(o.markdownTransformers?.length)for(let n of o.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function cr(t,e,o){return{admin:o,features:as(t),lexical:e,resolvedFeatureMap:t}}var G1=P1(()=>import("./Field-X3CJV3SY.js").then(t=>({default:t.RichText}))),U1=t=>{let e=O1(14),{admin:o,clientFeatures:n,featureClientSchemaMap:r,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let u=a,c=l===void 0?eo:l,[d,m]=j1(null),p,f;e[2]!==u||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==s?(p=()=>{if(d)return;let C=[];for(let[D,x]of Object.entries(n))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ss({featureClientSchemaMap:r,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,u))},f=[c,u,d,n,r,i,s],e[2]=u,e[3]=n,e[4]=r,e[5]=i,e[6]=d,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),H1(p,f);let h;return e[11]!==d||e[12]!==t?(h=ur(B1,{fallback:ur($1,{height:"35vh"}),children:d&&ur(G1,{...t,editorConfig:d})}),e[11]=d,e[12]=t,e[13]=h):h=e[13],h};function W1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function cs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=cs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cs(l);for(let u of n)a!==null&&u([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},to.set(t,o)}return o.listeners.add(e),()=>{V1(t,e)}}function V1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function K1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function X1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Y1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,J1="\xA0",q1=`
40
40
 
41
41
  `,us="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ds="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Q1=new RegExp("^[^"+ds+"]*["+us+"]"),eh=new RegExp("^[^"+us+"]*["+ds+"]"),th={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},oh={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},rh={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},nh={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},ih={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},lh={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};import{c as sh}from"react/compiler-runtime";import{jsx as ah}from"react/jsx-runtime";import"react";var ch=()=>{let t=sh(2),{EditButton:e}=ue(),o;return t[0]!==e?(o=e?ah(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as uh}from"react/compiler-runtime";import{jsx as dh}from"react/jsx-runtime";import"react";var mh=()=>{let t=uh(2),{RemoveButton:e}=ue(),o;return t[0]!==e?(o=e?dh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ph}from"react/compiler-runtime";import{jsx as fh}from"react/jsx-runtime";import"react";var hh=()=>{let t=ph(2),{Label:e}=ue(),o;return t[0]!==e?(o=e?fh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gh}from"react/compiler-runtime";import{jsx as Ch}from"react/jsx-runtime";import"react";var xh=t=>{let e=gh(3),{children:o}=t,{InlineBlockContainer:n}=ue(),r;return e[0]!==n||e[1]!==o?(r=n?Ch(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as bh}from"react/compiler-runtime";import{jsx as _h}from"react/jsx-runtime";import"react";var Th=t=>{let e=bh(6),{children:o,editButton:n,Label:r,removeButton:i}=t,{BlockCollapsible:l}=ke(),s;return e[0]!==l||e[1]!==r||e[2]!==o||e[3]!==n||e[4]!==i?(s=l?_h(l,{editButton:n,Label:r,removeButton:i,children:o}):null,e[0]=l,e[1]=r,e[2]=o,e[3]=n,e[4]=i,e[5]=s):s=e[5],s};import{c as Eh}from"react/compiler-runtime";import{jsx as wh}from"react/jsx-runtime";import"react";var kh=()=>{let t=Eh(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?wh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Nh}from"react/compiler-runtime";import{jsx as Lh}from"react/jsx-runtime";import"react";var Rh=()=>{let t=Nh(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?Lh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{Qe as $createAutoLinkNode,It as $createBlockNode,no as $createInlineBlockNode,pe as $createLinkNode,Ue as $createRelationshipNode,Ke as $createUploadNode,he as $isAutoLinkNode,Rt as $isBlockNode,io as $isInlineBlockNode,V as $isLinkNode,lo as $isRelationshipNode,so as $isUploadNode,Ns as AlignFeatureClient,fe as AutoLinkNode,Th as BlockCollapsible,kh as BlockEditButton,de as BlockNode,Rh as BlockRemoveButton,vs as BlockquoteFeatureClient,Ra as BlocksFeatureClient,Za as BoldFeatureClient,ps as CAN_USE_DOM,Sd as ChecklistFeatureClient,oh as DETAIL_TYPE_TO_DETAIL,q1 as DOUBLE_LINE_BREAK,nh as ELEMENT_FORMAT_TO_TYPE,rh as ELEMENT_TYPE_TO_FORMAT,xs as ENABLE_SLASH_MENU_COMMAND,ms as EditorConfigProvider,He as FieldsDrawer,cp as FixedToolbarFeatureClient,yc as HeadingFeatureClient,jc as HorizontalRuleFeatureClient,Y1 as IS_ALL_FORMATTING,eu as IndentFeatureClient,xh as InlineBlockContainer,ch as InlineBlockEditButton,hh as InlineBlockLabel,ro as InlineBlockNode,mh as InlineBlockRemoveButton,Qa as InlineCodeFeatureClient,_p as InlineToolbarFeatureClient,rc as ItalicFeatureClient,eh as LTR_REGEX,Jd as LexicalPluginToLexicalFeatureClient,fd as LinkFeatureClient,Q as LinkNode,J1 as NON_BREAKING_SPACE,F as NodeFormat,$d as OrderedListFeatureClient,im as ParagraphFeatureClient,gs as Point,Q1 as RTL_REGEX,bs as Rect,Om as RelationshipFeatureClient,Ge as RelationshipNode,U1 as RichTextField,rm as SlateToLexicalFeatureClient,ac as StrikethroughFeatureClient,mc as SubscriptFeatureClient,gc as SuperscriptFeatureClient,ih as TEXT_MODE_TO_TYPE,th as TEXT_TYPE_TO_FORMAT,lh as TEXT_TYPE_TO_MODE,le as TOGGLE_LINK_COMMAND,u1 as TableFeatureClient,Ba as TestRecorderFeatureClient,st as ToolbarButton,Se as ToolbarDropdown,Wa as TreeViewFeatureClient,Tc as UnderlineFeatureClient,Vd as UnorderedListFeatureClient,F1 as UploadFeatureClient,Ve as UploadNode,X1 as addSwipeDownListener,K1 as addSwipeLeftListener,z1 as addSwipeRightListener,Z1 as addSwipeUpListener,To as createBlockNode,y as createClientFeature,eo as defaultEditorLexicalConfig,Ko as getDOMRangeRect,_s as getEnabledNodes,Me as getSelectedNode,hs as isHTMLElement,Cs as isPoint,W1 as joinClasses,cr as sanitizeClientEditorConfig,as as sanitizeClientFeatures,Gt as setFloatingElemPosition,Ft as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,me as toolbarAddDropdownGroupWithItems,wo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,q as toolbarTextDropdownGroupWithItems,ke as useBlockComponentContext,B as useEditorConfigContext,ue as useInlineBlockComponentContext,fs as useLexicalDocumentDrawer,ce as useLexicalDrawer,lt as useLexicalListDrawer};
42
42
  //# sourceMappingURL=index.js.map