@payloadcms/richtext-lexical 3.15.0 → 3.15.1
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.
- package/dist/exports/client/index.js +1 -1
- package/dist/exports/client/index.js.map +2 -2
- package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts +1 -1
- package/dist/utilities/jsx/lexicalMarkdownCopy.d.ts.map +1 -1
- package/dist/utilities/jsx/lexicalMarkdownCopy.js +1 -1
- package/dist/utilities/jsx/lexicalMarkdownCopy.js.map +1 -1
- package/package.json +6 -6
|
@@ -32,7 +32,7 @@ ${e.map(Da).join(`
|
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
`},[t,e]),p=Ne((x,k)=>{o(C=>{let T=e.length-1,L=e[T];if(L&&L.name===x){if(x==="type")return[...e.slice(0,T),{...L,value:L.value+k}];if(L.value===k)return[...e.slice(0,T),{...L,count:L.count+1}]}return[...C,{name:x,count:1,value:k}]})},[e,o]);Ur(()=>{let x=C=>{if(!n)return;let T=C.key;Aa(C)?p("selectAll",""):Vr.has(T)?p("press",C.key):[...T].length>1?p("keydown",C.key):p("type",C.key)},k=C=>{if(!n)return;let T=C.key;!Vr.has(T)&&[...T].length>1&&p("keyup",C.key)};return t.registerRootListener((C,T)=>{T!==null&&(T.removeEventListener("keydown",x),T.removeEventListener("keyup",k)),C!==null&&(C.addEventListener("keydown",x),C.addEventListener("keyup",k))})},[t,n,p]),Ur(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),xo(()=>{if(e){let x=m();x!==null&&s(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),xo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:C,editorState:T})=>{if(!n)return;let L=T._selection,w=a.current,N=d.current;if(w!==L){if(C.size===0&&k.size===0&&!N){let b=window.getSelection();if(b&&(b.anchorNode==null||b.focusNode==null))return}a.current=L}d.current=!1;let I=m();I!==null&&s(I)}),[t,m,n,p]),xo(()=>n?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&i(k?.innerHTML)}):void 0,[t,n]);let f=Ne(x=>{n||(x.update(()=>{let k=ya();k.clear();let C=Sa();k.append(Ia().append(C)),C.select()}),o([])),r(k=>!k)},[n]),h=Ne(()=>{if(!n)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:k,anchorOffset:C,focusNode:T,focusOffset:L}=Fa(x),w=u().getRootElement(),N;k!==null&&(N=Wr(k,w));let I;T!==null&&(I=Wr(T,w)),p("snapshot",{anchorNode:k,anchorOffset:C,anchorPath:N,focusNode:T,focusOffset:L,focusPath:I})},[p,n,u]),g=Ne(()=>{va(m())},[m]),E=Ne(()=>{Ma("test.js",m())},[m]);return[Le("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:x=>{f(u()),x.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?_o("div",{className:"test-recorder-output",children:[_o("div",{className:"test-recorder-toolbar",children:[Le("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{E(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Le("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var zr=()=>{let t=La(3),[e]=Ra(),[o,n]=Oa(e),r;return t[0]!==o||t[1]!==n?(r=_o(Kr.Fragment,{children:[Le("p",{children:"HI"}),o,n,Le("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var $a=y({plugins:[{Component:zr,position:"bottom"}]});import{c as Pa}from"react/compiler-runtime";import{jsx as Ba}from"react/jsx-runtime";import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext.js";import{TreeView as ja}from"@lexical/react/LexicalTreeView.js";import"react";var Zr=()=>{let t=Pa(2),[e]=Ha(),o;return t[0]!==e?(o=Ba(ja,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var Ga=y({plugins:[{Component:Zr,position:"bottom"}]});import{$isTableSelection as Ua}from"@lexical/table";import{$isRangeSelection as Wa,FORMAT_TEXT_COMMAND as Va}from"lexical";import{jsx as Xr}from"react/jsx-runtime";import"react";var Yr=()=>Xr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Xr("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var Jr={type:"text-format",format:["bold","italic"],tag:"***"},qr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Qr={type:"text-format",format:["bold"],tag:"**"},en={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var tn=[Y([{ChildComponent:Yr,isActive:({selection:t})=>Wa(t)||Ua(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Va,"bold")},order:1}])],Ka=y(({featureProviderMap:t})=>{let e=[Qr,en];return t.get("italic")&&e.push(qr,Jr),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:tn},toolbarInline:{groups:tn}}});import{$isTableSelection as Za}from"@lexical/table";import{$isRangeSelection as Xa,FORMAT_TEXT_COMMAND as Ya}from"lexical";import{jsx as on,jsxs as za}from"react/jsx-runtime";import"react";var rn=()=>za("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:[on("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),on("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var nn={type:"text-format",format:["code"],tag:"`"};var ln=[Y([{ChildComponent:rn,isActive:({selection:t})=>Xa(t)||Za(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ya,"code")},order:7}])],Ja=y({enableFormats:["code"],markdownTransformers:[nn],toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{$isTableSelection as qa}from"@lexical/table";import{$isRangeSelection as Qa,FORMAT_TEXT_COMMAND as ec}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var an=()=>sn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var cn={type:"text-format",format:["italic"],tag:"*"},un={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var dn=[Y([{ChildComponent:an,isActive:({selection:t})=>Qa(t)||qa(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(ec,"italic")},order:2}])],tc=y({enableFormats:["italic"],markdownTransformers:[cn,un],toolbarFixed:{groups:dn},toolbarInline:{groups:dn}});import{$isTableSelection as rc}from"@lexical/table";import{$isRangeSelection as nc,FORMAT_TEXT_COMMAND as ic}from"lexical";import{jsx as mn,jsxs as oc}from"react/jsx-runtime";import"react";var pn=()=>oc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),mn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var fn={type:"text-format",format:["strikethrough"],tag:"~~"};var hn=[Y([{ChildComponent:pn,isActive:({selection:t})=>nc(t)||rc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(ic,"strikethrough")},order:4}])],lc=y({enableFormats:["strikethrough"],markdownTransformers:[fn],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$isTableSelection as sc}from"@lexical/table";import{$isRangeSelection as ac,FORMAT_TEXT_COMMAND as cc}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var Cn=()=>gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var xn=[Y([{ChildComponent:Cn,isActive:({selection:t})=>ac(t)||sc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(cc,"subscript")},order:5}])],uc=y({enableFormats:["subscript"],toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$isTableSelection as dc}from"@lexical/table";import{$isRangeSelection as mc,FORMAT_TEXT_COMMAND as pc}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Tn=[Y([{ChildComponent:_n,isActive:({selection:t})=>mc(t)||dc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(pc,"superscript")},order:6}])],fc=y({enableFormats:["superscript"],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as gc}from"@lexical/table";import{$isRangeSelection as Cc,FORMAT_TEXT_COMMAND as xc}from"lexical";import{jsx as En,jsxs as hc}from"react/jsx-runtime";import"react";var wn=()=>hc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[En("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),En("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kn=[Y([{ChildComponent:wn,isActive:({selection:t})=>Cc(t)||gc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(xc,"underline")},order:3}])],bc=y({enableFormats:["underline"],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});import{$createHeadingNode as wc,$isHeadingNode as Pn,HeadingNode as kc}from"@lexical/rich-text";import{$setBlocksType as Nc}from"@lexical/selection";import{$getSelection as Lc,$isRangeSelection as Rc}from"lexical";import{jsx as Nn}from"react/jsx-runtime";import"react";var Ln=()=>Nn("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:Nn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Rn}from"react/jsx-runtime";import"react";var In=()=>Rn("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:Rn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Sn}from"react/jsx-runtime";import"react";var yn=()=>Sn("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:Sn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("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:vn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Dn}from"react/jsx-runtime";import"react";var An=()=>Dn("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:Dn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Fn}from"react/jsx-runtime";import"react";var On=()=>Fn("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:Fn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as _c,$isHeadingNode as Tc,HeadingNode as Ec}from"@lexical/rich-text";var To=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var $n=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Ec],export:(r,i)=>{if(!Tc(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:To(r=>{let i="h"+r[1].length;return _c(i)})}};var Bn=t=>{let e=Lc();Nc(e,()=>wc(t))},Hn={h1:Ln,h2:In,h3:yn,h4:Mn,h5:An,h6:On},Ic=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[q(e.map((n,r)=>({ChildComponent:Hn[n],isActive:({selection:i})=>{if(!Rc(i))return!1;for(let l of i.getNodes()){if(Pn(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(Pn(s)&&s.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Bn(n)})},order:r+2})))];return{markdownTransformers:[$n(e)],nodes:[kc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(n=>({Icon:Hn[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{Bn(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Pc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Eo=()=>jn("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:jn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Gn,jsxs as Sc}from"react/jsx-runtime";import"react";var Un=()=>Sc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gn("path",{d:"M5 10h10",stroke:"currentColor"}),Gn("path",{d:"M10 15V5",stroke:"currentColor"})]});var me=t=>({type:"dropdown",ChildComponent:Un,items:t,key:"add",order:10});var Wn={type:"element",dependencies:[gt],export:(t,e)=>xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ct();e&&t.replace(e)}};import{c as yc}from"react/compiler-runtime";import{useLexicalComposerContext as vc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Mc}from"@lexical/utils";import{$getSelection as Dc,$isRangeSelection as Ac,COMMAND_PRIORITY_EDITOR as Fc}from"lexical";import{useEffect as Oc}from"react";var Vn=()=>{let t=yc(3),[e]=vc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(He,$c,Fc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Oc(o,n),null};function $c(t){let e=Dc();if(!Ac(e))return!1;if(e.focus.getNode()!==null){let n=Ct();Mc(n)}return!0}var Bc=y({markdownTransformers:[Wn],nodes:[gt],plugins:[{Component:Vn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Eo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(He,void 0)}}])]},toolbarFixed:{groups:[me([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Pc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(He,void 0)}}])]}});import{TabIndentationPlugin as Gc}from"@lexical/react/LexicalTabIndentationPlugin";import{INDENT_CONTENT_COMMAND as Uc,OUTDENT_CONTENT_COMMAND as Wc}from"lexical";import{jsx as vt,jsxs as Hc}from"react/jsx-runtime";import"react";var Kn=()=>Hc("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:[vt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Mt,jsxs as jc}from"react/jsx-runtime";import"react";var zn=()=>jc("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:[Mt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Zn=t=>({type:"buttons",items:t,key:"indent",order:35});var Xn=[Zn([{ChildComponent:Kn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Wc,void 0)},order:1},{ChildComponent:zn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Uc,void 0)},order:2}])],Vc=y({plugins:[{Component:Gc,position:"normal"}],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$findMatchingParent as rd}from"@lexical/utils";import{$getSelection as yo,$isRangeSelection as Li}from"lexical";import{jsx as Yn}from"react/jsx-runtime";import"react";var Jn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as qn}from"@lexical/selection";function De(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?qn(o)?n:r:qn(e)?n:r}var wo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as ou}from"lexical";import{addClassNamesToElement as Kc,isHTMLAnchorElement as zc}from"@lexical/utils";import Lo from"bson-objectid";import{$applyNodeReplacement as Zc,$createTextNode as Qn,$getSelection as Xc,$isElementNode as ei,$isRangeSelection as No,createCommand as Yc,ElementNode as Jc}from"lexical";var qc=new Set(["http:","https:","mailto:","sms:","tel:"]),Q=class t extends Jc{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Qc,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Lo.default().toHexString(),e.version=3);let o=pe({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener")),Kc(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,n){if(!No(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(ei(n)){let r=pe({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!qc.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ko(o.rel,"remove","noopener"))),!1}};function Qc(t){let e=null;if(zc(t)){let o=t.textContent;o!==null&&o!==""&&(e=pe({id:new Lo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function pe({id:t,fields:e}){return Zc(new Q({id:t??new Lo.default().toHexString(),fields:e}))}function V(t){return t instanceof Q}var le=Yc("TOGGLE_LINK_COMMAND");function ti(t){let e=Xc();if(!No(e)&&!t.selectedNodes?.length)return;let o=No(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(n=>{let r=n.getParent();if(V(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o?.length===1){let i=o[0],l=V(i)?i:eu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Qn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let n=null,r=null;o?.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||ei(i)&&!i.isInline())){if(V(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Qn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=pe({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),V(i)){if(i.is(r))return;if(r!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)r.append(s[a])}i.remove();return}r!==null&&r.append(i)}})}}function eu(t){return tu(t,e=>V(e))}function tu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ko(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var oi={type:"text-match",dependencies:[Q],export:(t,e)=>{if(!V(t))return null;let o=t,{url:n}=o.getFields();return`[${e(o)}](${n})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=pe({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=ou(o);return i.setFormat(t.getFormat()),r.append(i),t.replace(r),i},trigger:")"};import{$applyNodeReplacement as ru,$isElementNode as nu}from"lexical";var fe=class t extends Q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Qe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(nu(n)){let r=Qe({fields:this.__fields});return n.append(r),r}return null}};function Qe({fields:t}){return ru(new fe({id:"",fields:t}))}function he(t){return t instanceof fe}import{c as iu}from"react/compiler-runtime";import{useLexicalComposerContext as lu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as su}from"@lexical/utils";import{$createTextNode as ri,$getSelection as au,$isElementNode as ii,$isLineBreakNode as li,$isNodeSelection as cu,$isRangeSelection as uu,$isTextNode as et,TextNode as du}from"lexical";import{useEffect as mu}from"react";function ni(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function si(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var pu=/[.,;\s]/;function At(t){return pu.test(t)}function ai(t){return At(t[t.length-1])}function Io(t){return At(t[0])}function fu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ci(t){let e=t.getPreviousSibling();return ii(e)&&(e=e.getLastDescendant()),e===null||li(e)||et(e)&&ai(e.getTextContent())}function ui(t){let e=t.getNextSibling();return ii(e)&&(e=e.getFirstDescendant()),e===null||li(e)||et(e)&&Io(e.getTextContent())}function hu(t,e,o,n){return(t>0?At(o[t-1]):ci(n[0]))?e<o.length?At(o[e]):ui(n[n.length-1]):!1}function gu(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let d=a[0],u=d.getTextContent().length,m=s;s+u<=e?(n.push(d),l+=u):m>=o?i.push(d):r.push(d),s+=u,a.shift()}return[l,n,r,i]}function Cu(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Qe({fields:r});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=ri(n.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let d=[],c;for(let f=1;f<t.length;f++){let h=t[f],E=h.getTextContent().length,v=s,D=s+E;if(v<o)if(D<=o)d.push(h);else{let[x,k]=h.splitText(o-v);d.push(x),c=k}s+=E}let u=au(),m=u?u.getNodes().find(et):void 0,p=ri(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...d),m&&m===a&&(uu(u)?p.select(u.anchor.offset,u.focus.offset):cu(u)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function xu(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=si(i,e))!=null&&l!==null;){let a=l.index,d=l.length,c=a+d;if(hu(s+a,s+c,r,n)){let[m,,p,f]=gu(n,s+a,s+c),h=s+a-m,g=s+c-m,E=Cu(p,h,g,l);n=E?[E,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Ro(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let d=n[a];if(!et(d)||!d.isSimpleText()){Dt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=si(i,e);if(l===null||l.text!==i){Dt(t),o(null,t.getFields()?.url??null);return}if(!ci(t)||!ui(t)){Dt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function bu(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(he(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!Io(i)||fu(i,l))&&(n.append(t),Ro(n,e,o),o(null,n.getFields()?.url??null))}he(r)&&!ai(i)&&(Dt(r),Ro(r,e,o),o(null,r.getFields()?.url??null))}function Dt(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function _u(t){let e=[t],o=t.getNextSibling();for(;o!==null&&et(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Tu(t,e,o){let n=iu(5),r,i;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([fe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return su(t.registerNodeTransform(du,s=>{let a=s.getParentOrThrow(),d=s.getPreviousSibling();if(he(a))Ro(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(Io(s.getTextContent())||!he(d))){let c=_u(s);xu(c,e,l)}bu(s,e,l)}}))},i=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=i):(r=n[3],i=n[4]),mu(r,i)}var Eu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,wu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,ku=[ni(Eu,t=>t.startsWith("http")?t:`https://${t}`),ni(wu,t=>`mailto:${t}`)],di=()=>{let[t]=lu();return Tu(t,ku),null};import{jsx as Nu}from"react/jsx-runtime";import{ClickableLinkPlugin as Lu}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var mi=()=>Nu(Lu,{});import{jsx as Uu}from"react/jsx-runtime";import"react";import{createPortal as Wu}from"react-dom";import{jsx as ge,jsxs as tt,Fragment as Iu}from"react/jsx-runtime";import{useLexicalComposerContext as Su}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as pi,mergeRegister as fi}from"@lexical/utils";import{getTranslation as So}from"@payloadcms/translations";import{CloseMenuIcon as yu,EditIcon as vu,ExternalLinkIcon as hi,formatDrawerSlug as Mu,useConfig as Du,useEditDepth as Au,useLocale as Fu,useTranslation as Ou}from"@payloadcms/ui";import{requests as $u}from"@payloadcms/ui/shared";import{$getSelection as gi,$isLineBreakNode as Pu,$isRangeSelection as Ci,COMMAND_PRIORITY_HIGH as Bu,COMMAND_PRIORITY_LOW as xi,KEY_ESCAPE_COMMAND as Hu,SELECTION_CHANGE_COMMAND as ju}from"lexical";import bi,{useCallback as _i,useEffect as $t,useRef as Gu,useState as Re}from"react";function Ft(t,e,o,n=10,r=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),d=t.top-n,c=t.left-r;d<a.top&&(d+=l.height+t.height+n*2),c+l.width>a.right&&(c=a.right-l.width-r),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Ru}from"lexical";var Ot=Ru("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ti({anchorElem:t}){let[e]=Su(),[o,n]=Re(),r=Gu(null),[i,l]=Re(null),[s,a]=Re(null),{fieldProps:{schemaPath:d},uuid:c}=B(),{config:u}=Du(),{i18n:m,t:p}=Ou(),[f,h]=Re(),g=Au(),[E,v]=Re(!1),[D,x]=Re([]),k=Fu(),[C,T]=Re(!1),L=Mu({slug:"lexical-rich-text-link-"+c,depth:g}),{toggleDrawer:w}=ce(L),N=_i(()=>{v(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),T(!1),l(null),a(null),x([]),h(void 0)},[v,l,a,x]),I=_i(()=>{let b=gi(),_;if(!Ci(b)||!b){N();return}let S=De(b);_=e.getElementByKey(S.getKey())?.getBoundingClientRect();let R=pi(S,V),A=b.getNodes().filter(U=>!Pu(U)).find(U=>{let H=pi(U,V);return R&&!R.is(H)||H&&!H.is(R)});if(R==null||A){N();return}n(R);let M=R.getFields(),O={...M,id:R.getID(),text:R.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let U=u.collections.find(H=>H.slug===M?.doc?.relationTo);if(!U)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let H=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,ee=M.doc?.relationTo;if(!H||!ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let pt=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(pt),$u.get(`${u.serverURL}${u.routes.api}/${ee}/${H}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:k?.code}}).then(async ie=>{if(!ie.ok)throw new Error(`HTTP error! Status: ${ie.status}`);let ve=await ie.json(),ft=U?.admin?.useAsTitle||"id",ht=ve[ft],dr=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${ht}`}).replace(/<[^>]*>?/g,"");a(dr)}).catch(()=>{let ie=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${H}`}).replace(/<[^>]*>?/g,"");a(ie)})}}h(O),v(!0),x(b?b?.getNodes():[]),he(R)?T(!0):T(!1);let G=r.current,$=window.getSelection(),{activeElement:W}=document;if(G===null)return;let J=e.getRootElement();return $!==null&&J!==null&&J.contains($.anchorNode)?(_||(_=$.getRangeAt(0).getBoundingClientRect()),_!=null&&(_.y+=40,Ft(_,G,t))):(W==null||W.className!=="link-input")&&(J!==null&&Ft(null,G,t),l(null),a(null)),!0},[e,N,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,k?.code,t]);return $t(()=>fi(e.registerCommand(Ot,b=>(e.dispatchCommand(le,b),I(),w(),!0),xi)),[e,I,w,L]),$t(()=>{let b=t.parentElement,_=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",_),b?.addEventListener("scroll",_),()=>{window.removeEventListener("resize",_),b?.removeEventListener("scroll",_)}},[t.parentElement,e,I]),$t(()=>fi(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{I()})}),e.registerCommand(ju,()=>(I(),!0),xi),e.registerCommand(Hu,()=>E?(N(),!0):!1,Bu)),[e,I,E,N]),$t(()=>{e.getEditorState().read(()=>{I()})},[e,I]),tt(bi.Fragment,{children:[ge("div",{className:"link-editor",ref:r,children:tt("div",{className:"link-input",children:[i&&i.length>0?tt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?ge(hi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?tt(Iu,{children:[o?.__fields.newTab?ge(hi,{}):null,ge("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&tt(bi.Fragment,{children:[ge("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{w()},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:ge(vu,{})}),!C&&ge("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(le,null)},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:ge(yu,{})})]})]})}),ge(je,{className:"lexical-link-edit-drawer",data:f,drawerSlug:L,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(b,_)=>{let S=_,R={...S};delete R.text,e.update(()=>{let A=gi(),M=null;if(Ci(A)?M=De(A).getParent():D.length&&(M=D[0].getParent()),M&&he(M)){let O=pe({fields:R});M.replace(O,!0)}}),e.dispatchCommand(le,{fields:R,selectedNodes:D,text:S.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var Ei=t=>{let{anchorElem:e=document.body}=t;return Wu(Uu(Ti,{anchorElem:e}),e)};import{c as zu}from"react/compiler-runtime";import{useLexicalComposerContext as Zu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Xu}from"@lexical/utils";import{$getSelection as Yu,$isElementNode as Ju,$isRangeSelection as qu,COMMAND_PRIORITY_LOW as ki,PASTE_COMMAND as Qu}from"lexical";import{useEffect as ed}from"react";var Vu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Ku=/^[\w\-./]*(?:#\w[\w-]*)?$/;function wi(t){if(!t)return!1;if(t==="https://"||Vu.test(t)||Ku.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ni=()=>{let t=zu(3),[e]=Zu(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([Q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Xu(e.registerCommand(le,td,ki),e.registerCommand(Qu,r=>{let i=Yu();if(!qu(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!wi(l))return!1;if(!i.getNodes().some(od)){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(le,{fields:s,text:null}),r.preventDefault(),!0}return!1},ki))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ed(o,n),null};function td(t){return ti(t),!0}function od(t){return Ju(t)}var Ri=[wo([{ChildComponent:Jn,isActive:({selection:t})=>{if(Li(t)){let e=De(t);return rd(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Li(t)&&yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(le,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=yo()?.getTextContent(),n=yo()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Ot,{fields:r,selectedNodes:n,text:o})}},order:1}])],nd=y({markdownTransformers:[oi],nodes:[Q,fe],plugins:[{Component:Ni,position:"normal"},{Component:di,position:"normal"},{Component:mi,position:"normal"},{Component:Ei,position:"floatingAnchorElem"}],toolbarFixed:{groups:Ri},toolbarInline:{groups:Ri}});import{$isListNode as Do,INSERT_CHECK_LIST_COMMAND as Di,ListItemNode as gd,ListNode as Cd}from"@lexical/list";import{$isRangeSelection as xd}from"lexical";import{jsx as Ii,jsxs as id}from"react/jsx-runtime";import"react";var vo=()=>id("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:[Ii("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ii("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ld}from"react/jsx-runtime";import{ListPlugin as sd}from"@lexical/react/LexicalListPlugin.js";import"react";var Ae=()=>ld(sd,{});function Fe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as dd,ListItemNode as md,ListNode as pd}from"@lexical/list";import{$createListItemNode as ad,$createListNode as cd,$isListItemNode as ud,$isListNode as Mo}from"@lexical/list";var Si=4,Oe=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=ad(t==="check"?n[3]==="x":void 0);if(Mo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Mo(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=cd(t,t==="number"?Number(n[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(n[1].length/Si);s&&l.setIndent(s)},Ie=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(ud(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if(Mo(c)){n.push(Ie(c,e,o+1));continue}}let s=" ".repeat(o*Si),a=t.getListType(),d=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(s+d+e(l)),i++}return n.join(`
|
|
35
|
-
`)};var yi={type:"element",dependencies:[pd,md],export:(t,e)=>dd(t)?Ie(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Oe("check")};import{jsx as fd}from"react/jsx-runtime";import{CheckListPlugin as hd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var vi=()=>fd(hd,{});var Mi=[q([{ChildComponent:vo,isActive:({selection:t})=>{if(!xd(t))return!1;for(let e of t.getNodes()){if(Do(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Do(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(Do(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Di,void 0)},order:12}])],bd=y(({featureProviderMap:t})=>{let e=[{Component:vi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ae,position:"normal"}),{markdownTransformers:[yi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Cd,gd],plugins:e,slashMenu:{groups:[Fe([{Icon:vo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Di,void 0)}}])]},toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}});import{$isListNode as Fo,INSERT_ORDERED_LIST_COMMAND as Oi,ListItemNode as kd,ListNode as Nd}from"@lexical/list";import{$isRangeSelection as Ld}from"lexical";import{jsx as ot,jsxs as _d}from"react/jsx-runtime";import"react";var Ao=()=>_d("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:[ot("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),ot("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),ot("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Td,ListItemNode as Ed,ListNode as wd}from"@lexical/list";var Ai={type:"element",dependencies:[wd,Ed],export:(t,e)=>Td(t)?Ie(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Oe("number")};var Fi=[q([{ChildComponent:Ao,isActive:({selection:t})=>{if(!Ld(t))return!1;for(let e of t.getNodes()){if(Fo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Fo(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Fo(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oi,void 0)},order:10}])],Rd=y(({featureProviderMap:t})=>({markdownTransformers:[Ai],nodes:t.has("orderedList")?[]:[Nd,kd],plugins:t.has("orderedList")?[]:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Fe([{Icon:Ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Oi,void 0)}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}}));import{$isListNode as $o,INSERT_UNORDERED_LIST_COMMAND as Bi,ListItemNode as Md,ListNode as Dd}from"@lexical/list";import{$isRangeSelection as Ad}from"lexical";import{jsx as $e,jsxs as Id}from"react/jsx-runtime";import"react";var Oo=()=>Id("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:[$e("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Sd,ListItemNode as yd,ListNode as vd}from"@lexical/list";var $i={type:"element",dependencies:[vd,yd],export:(t,e)=>Sd(t)?Ie(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Oe("bullet")};var Pi=[q([{ChildComponent:Oo,isActive:({selection:t})=>{if(!Ad(t))return!1;for(let e of t.getNodes()){if($o(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($o(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!($o(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)},order:11}])],Fd=y({markdownTransformers:[$i],nodes:[Dd,Md],plugins:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Fe([{Icon:Oo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}});import{jsx as Od}from"react/jsx-runtime";import{addClassNamesToElement as $d}from"@lexical/utils";import{DecoratorNode as Pd}from"lexical";import*as Hi from"react";var Bd=Hi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),rt=class t extends Pd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Hd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return $d(o,"unknownConverted"),o}decorate(){return Od(Bd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Hd({data:t}){return new rt({data:t})}var jd=y(()=>({nodes:[rt]}));import{jsx as Gd}from"react/jsx-runtime";import{addClassNamesToElement as Ud}from"@lexical/utils";import{DecoratorNode as Wd}from"lexical";import*as ji from"react";var Vd=ji.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends Wd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Kd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Ud(o,"unknownConverted"),o}decorate(){return Gd(Vd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Kd({data:t}){return new nt({data:t})}var zd=y(()=>({nodes:[nt]}));import{$setBlocksType as Wi}from"@lexical/selection";import{$createParagraphNode as Vi,$getSelection as Ki,$isParagraphNode as Gi,$isRangeSelection as Zd}from"lexical";var Ui=[q([{ChildComponent:ze,isActive:({selection:t})=>{if(!Zd(t))return!1;for(let e of t.getNodes())if(!Gi(e)&&!Gi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})},order:1}])],Xd=y({slashMenu:{groups:[Z([{Icon:ze,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}});import{$isNodeSelection as Im}from"lexical";import{jsx as it,jsxs as Yd}from"react/jsx-runtime";import"react";var Po=()=>Yd("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:[it("g",{clipPath:"url(#clip0_4397_10817)",children:it("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),it("defs",{children:it("clipPath",{id:"clip0_4397_10817",children:it("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as fm}from"react/compiler-runtime";import{jsx as hm}from"react/jsx-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Cm}from"@lexical/utils";import{useConfig as xm}from"@payloadcms/ui";import{$getPreviousSelection as bm,$getSelection as _m,$isParagraphNode as qi,$isRangeSelection as Tm,COMMAND_PRIORITY_EDITOR as Em,createCommand as wm}from"lexical";import{useEffect as km}from"react";import{c as am}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as cm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as um,COMMAND_PRIORITY_EDITOR as dm}from"lexical";import{useEffect as mm,useState as Xi}from"react";import{c as Jd}from"react/compiler-runtime";import{jsx as qd}from"react/jsx-runtime";import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext";import{useListDrawer as em,useModal as tm}from"@payloadcms/ui";import{$getNodeByKey as zi,$getPreviousSelection as om,$getRoot as rm,$getSelection as nm,$isRangeSelection as im,$setSelection as lm}from"lexical";import{useEffect as sm,useState as Zi}from"react";var lt=t=>{let e=Jd(23),[o]=Qd(),[n,r]=Zi(null),[i,l]=Zi(!1),[s,a,d]=em(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=tm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let N=nm()??om();r(N)},e[0]=h):h=e[0];let g=h,E;e[1]!==o||e[2]!==n?(E=()=>{n&&o.update(()=>{if(im(n)){let{anchor:N,focus:I}=n;zi(N.key)&&zi(I.key)&&lm(n.clone())}else rm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=E):E=e[3];let v=E,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let x=D,k,C;e[6]!==u||e[7]!==f||e[8]!==v||e[9]!==i?(k=()=>{if(!i)return;let N=f[u];N&&!N?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},C=[f,u,v,i],e[6]=u,e[7]=f,e[8]=v,e[9]=i,e[10]=k,e[11]=C):(k=e[10],C=e[11]),sm(k,C);let T;e[12]!==a?(T=N=>qd(a,{...N,onClick:()=>{g()}}),e[12]=a,e[13]=T):T=e[13];let L;e[14]!==p?(L=()=>{g(),p(),l(!0)},e[14]=p,e[15]=L):L=e[15];let w;return e[16]!==s||e[17]!==x||e[18]!==m||e[19]!==u||e[20]!==T||e[21]!==L?(w={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:T,openListDrawer:L},e[16]=s,e[17]=x,e[18]=m,e[19]=u,e[20]=T,e[21]=L,e[22]=w):w=e[22],w};var pm=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=um(o);r&&r.replace(We({relationTo:e,value:n}))}):t.dispatchCommand(Bo,{relationTo:e,value:n})},Yi=t=>{let e=am(16),{enabledCollectionSlugs:o}=t,[n]=cm(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i]=Xi(r),[l,s]=Xi(null),a=o||void 0,d;e[2]!==i||e[3]!==a?(d={collectionSlugs:a,selectedCollection:i},e[2]=i,e[3]=a,e[4]=d):d=e[4];let{closeListDrawer:c,ListDrawer:u,openListDrawer:m}=lt(d),p,f;e[5]!==n||e[6]!==m?(p=()=>n.registerCommand(Ge,v=>(s(v?.replace?v?.replace.nodeKey:null),m(),!0),dm),f=[n,m],e[5]=n,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),mm(p,f);let h;e[9]!==c||e[10]!==n||e[11]!==l?(h=v=>{let{collectionSlug:D,docID:x}=v;pm({editor:n,relationTo:D,replaceNodeKey:l,value:x}),c()},e[9]=c,e[10]=n,e[11]=l,e[12]=h):h=e[12];let g=h,E;return e[13]!==u||e[14]!==g?(E=Pt(u,{onSelect:g}),e[13]=u,e[14]=g,e[15]=E):E=e[15],E},Ji=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Pt(Yi,{...t}):Pt(bt,{...t,children:Pt(Yi,{...t})});var Bo=wm("INSERT_RELATIONSHIP_COMMAND"),Qi=t=>{let e=fm(10),{clientProps:o}=t,[n]=gm(),{config:r}=xm(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o?.disabledCollections||e[1]!==i){let u;e[3]!==o?.disabledCollections?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o?.disabledCollections,e[4]=u):u=e[4],c=i.filter(u).map(Nm),e[0]=o?.disabledCollections,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Ue]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Bo,Rm,Em)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),km(s,a);let d;return e[8]!==l?(d=hm(Ji,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function Nm(t){let{slug:e}=t;return e}function Lm(t){return qi(t)}function Rm(t){let e=_m()||bm();if(Tm(e)){let o=We(t);Cm(o);let{focus:n}=e,r=n.getNode();qi(r)&&r.getTextContentSize()===0&&r.getParentOrThrow().getChildren().filter(Lm).length>1&&r.remove()}return!0}var Sm=y({nodes:[Ue],plugins:[{Component:Qi,position:"normal"}],slashMenu:{groups:[Z([{Icon:Po,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:Po,isActive:({selection:t})=>{if(!Im(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]}});import{c as ll}from"react/compiler-runtime";import{jsx as ne,jsxs as zm}from"react/jsx-runtime";import{useLexicalComposerContext as Zm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Xm,useThrottledEffect as Ym,useTranslation as Jm}from"@payloadcms/ui";import*as Ce from"react";import{useMemo as qm}from"react";import{c as ym}from"react/compiler-runtime";import{jsx as vm}from"react/jsx-runtime";import{mergeRegister as Mm}from"@lexical/utils";import{$addUpdateTag as Dm,$getSelection as Am}from"lexical";import{useEffect as Bt,useState as Ho}from"react";var jo="toolbar-popup__button",st=t=>{let e=ym(34),{children:o,editor:n,item:r}=t,[i,l]=Ho(!0),[s,a]=Ho(!1),[d,c]=Ho(jo),u=B(),m;e[0]!==s||e[1]!==n||e[2]!==u||e[3]!==i||e[4]!==r?(m=()=>{n.getEditorState().read(()=>{let L=Am();if(L){if(r.isActive){let w=r.isActive({editor:n,editorConfigContext:u,selection:L});s!==w&&a(w)}if(r.isEnabled){let w=r.isEnabled({editor:n,editorConfigContext:u,selection:L});i!==w&&l(w)}}})},e[0]=s,e[1]=n,e[2]=u,e[3]=i,e[4]=r,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Bt(f,h);let g,E;e[9]!==p?(g=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),E=[p],e[9]=p,e[10]=g,e[11]=E):(g=e[10],E=e[11]),Bt(g,E);let v,D;e[12]!==n||e[13]!==p?(v=()=>Mm(n.registerUpdateListener(()=>{p()})),D=[n,p],e[12]=n,e[13]=p,e[14]=v,e[15]=D):(v=e[14],D=e[15]),Bt(v,D);let x;e[16]!==s||e[17]!==i||e[18]!==r.key?(x=()=>{c([jo,i===!1?"disabled":"",s?"active":"",r?.key?`${jo}-`+r.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=r.key,e[19]=x):x=e[19];let k;e[20]!==s||e[21]!==d||e[22]!==i||e[23]!==r.key?(k=[i,s,d,r.key],e[20]=s,e[21]=d,e[22]=i,e[23]=r.key,e[24]=k):k=e[24],Bt(x,k);let C;e[25]!==s||e[26]!==n||e[27]!==i||e[28]!==r?(C=()=>{if(i!==!1)return n.focus(()=>{n.update(Fm),r.onSelect?.({editor:n,isActive:s})}),!0},e[25]=s,e[26]=n,e[27]=i,e[28]=r,e[29]=C):C=e[29];let T;return e[30]!==o||e[31]!==d||e[32]!==C?(T=vm("button",{className:d,onClick:C,onMouseDown:Om,type:"button",children:o}),e[30]=o,e[31]=d,e[32]=C,e[33]=T):T=e[33],T};function Fm(){Dm("toolbar")}function Om(t){t.preventDefault()}import{c as il}from"react/compiler-runtime";import{jsx as Pe}from"react/jsx-runtime";import Wo,{useEffect as nl}from"react";import{mergeRegister as Um}from"@lexical/utils";import{useTranslation as Wm}from"@payloadcms/ui";import{$getSelection as Vm}from"lexical";import{jsx as Te,jsxs as el}from"react/jsx-runtime";import{Button as $m}from"@payloadcms/ui";import{$addUpdateTag as Pm}from"lexical";import Ht,{useCallback as Bm,useEffect as at,useMemo as Hm,useRef as Uo,useState as jt}from"react";import{createPortal as jm}from"react-dom";var Go="toolbar-popup__dropdown-item",tl=Ht.createContext(null);function ol({active:t,children:e,editor:o,enabled:n,Icon:r,item:i,tooltip:l}){let[s,a]=jt(Go);at(()=>{a([Go,n===!1?"disabled":"",t?"active":"",i?.key?`${Go}-${i.key}`:""].filter(Boolean).join(" "))},[n,t,s,i.key]);let d=Uo(null),c=Ht.useContext(tl);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return at(()=>{d?.current!=null&&u(d)},[d,u]),Te($m,{"aria-label":l,buttonStyle:"none",className:s,disabled:n===!1,icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Pm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function Gm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=jt(),[l,s]=jt(),a=Bm(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(r==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(p=>{if(p==null)return r[0];let f=r.indexOf(p)-1;return r[f===-1?r.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?r[0]:r[r.indexOf(p)+1])},c=Hm(()=>({registerItem:a}),[a]);return at(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),Te(tl.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function rl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Uo(null),d=Uo(null),[c,u]=jt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};at(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:g,top:E}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${E+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),at(()=>{let f=d.current;if(f!==null&&c){let h=g=>{let{target:E}=g;s!=null&&a.current!=null&&a.current.contains(E)||f.contains(E)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=jm(Te(Gm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return el(Ht.Fragment,{children:[el("button",{"aria-label":t,className:e+(c?" active":""),disabled:n,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[r&&Te(r,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Ht.Fragment,{children:p})]})}var Vo="toolbar-popup__dropdown",Km=t=>{let e=il(18),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=Wm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==i||e[4]!==l?(f=l?.Component&&Pe(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=o,e[1]=n,e[2]=r,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==d||e[7]!==s||e[8]!==l||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=d,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==o||e[12]!==m||e[13]!==r||e[14]!==i||e[15]!==l||e[16]!==u?(p=Pe(ol,{active:o,editor:r,enabled:i,Icon:l?.ChildComponent?Pe(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:Pe("span",{className:"text",children:m})},l.key),e[11]=o,e[12]=m,e[13]=r,e[14]=i,e[15]=l,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=il(36),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Wo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,g]=Wo.useState(f),[E,v]=Wo.useState(!0),D=B(),{items:x,key:k}=i,C;e[2]!==r||e[3]!==D||e[4]!==i||e[5]!==x||e[6]!==d||e[7]!==c?(C=()=>{r.getEditorState().read(()=>{let $=Vm();if(!$)return;let W=[],J=[],U=[];for(let H of x)H.isActive&&(!d||W.length<d)&&H.isActive({editor:r,editorConfigContext:D,selection:$})&&(W.push(H.key),J.push(H)),H.isEnabled?H.isEnabled({editor:r,editorConfigContext:D,selection:$})&&U.push(H.key):U.push(H.key);i.isEnabled&&v(i.isEnabled({editor:r,editorConfigContext:D,selection:$})),p(W),g(U),c&&c({activeItems:J})})},e[2]=r,e[3]=D,e[4]=i,e[5]=x,e[6]=d,e[7]=c,e[8]=C):C=e[8];let T=C,L,w;e[9]!==T?(L=()=>{T()},w=[T],e[9]=T,e[10]=L,e[11]=w):(L=e[10],w=e[11]),nl(L,w);let N,I;e[12]!==r||e[13]!==T?(N=()=>Um(r.registerUpdateListener(()=>{T()})),I=[r,T],e[12]=r,e[13]=T,e[14]=N,e[15]=I):(N=e[14],I=e[15]),nl(N,I);let b=`${k} dropdown`,_=`${Vo}-${k}`,S;e[16]!==n?(S=n||[],e[16]=n,e[17]=S):S=e[17];let R;e[18]!==S||e[19]!==_?(R=[Vo,_,...S].filter(Boolean),e[18]=S,e[19]=_,e[20]=R):R=e[20];let A=R.join(" "),M=!E,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let G;return e[23]!==l||e[24]!==m||e[25]!==o||e[26]!==r||e[27]!==h||e[28]!==k||e[29]!==x||e[30]!==a||e[31]!==A||e[32]!==M||e[33]!==O||e[34]!==b?(G=Pe(rl,{buttonAriaLabel:b,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Vo}-items`,...O],label:a,children:x.length?x.map($=>Pe(Km,{active:m.includes($.key),anchorElem:o,editor:r,enabled:h.includes($.key),item:$},$.key)):null},k),e[23]=l,e[24]=m,e[25]=o,e[26]=r,e[27]=h,e[28]=k,e[29]=x,e[30]=a,e[31]=A,e[32]=M,e[33]=O,e[34]=b,e[35]=G):G=e[35],G};function Qm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function ep(t){let e=ll(23),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=Jm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=Ce.useState(void 0),[p,f]=Ce.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],Ce.useEffect(h,g);let E;e[6]!==d||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==c?(E=k=>{let{activeItems:C}=k;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let T=C[0],L=T.key;T.label&&(L=typeof T.label=="function"?T.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):T.label),L.length>25&&(L=L.substring(0,25)+"..."),C.length===1?(m(L),f(()=>T.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=d,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=c,e[12]=E):E=e[12];let v=E,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[13]!==p||e[14]!==o||e[15]!==u||e[16]!==n||e[17]!==r.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==v||e[21]!==D?(x=zm("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?ne(Se,{anchorElem:o,editor:n,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):ne(Se,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):null,i.type==="buttons"&&i.items.length?i.items.map(k=>ne(Qm,{anchorElem:o,editor:n,item:k},k.key)):null,l<r.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[13]=p,e[14]=o,e[15]=u,e[16]=n,e[17]=r.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=v,e[21]=D,e[22]=x):x=e[22],x}function tp({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=Ce.useRef(null),{y:l}=Xm(),s=qm(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let d=r.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return Ym(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(Ce.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,d)=>ne(ep,{anchorElem:t,editor:o,editorConfig:n,group:a,index:d},a.key))})})}var sl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return sl(t.parentEditor)}return!1},al=t=>{let e=ll(6),{clientProps:o}=t,[n]=Zm(),r=B(),{editorConfig:i}=r,l=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,s=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||i,a,d;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==r){d=Symbol.for("react.early_return_sentinel");e:{let c=sl(r);if(o?.disableIfParentHasFixedToolbar&&c){d=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){d=null;break e}a=ne(tp,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=d}else a=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:a};var op=y({plugins:[{Component:al,position:"aboveContainer"}]});import{c as dl}from"react/compiler-runtime";import{jsx as se,jsxs as ml}from"react/jsx-runtime";import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as pl}from"@lexical/utils";import{$getSelection as fl,$isRangeSelection as cl,$isTextNode as np,COMMAND_PRIORITY_LOW as ip,SELECTION_CHANGE_COMMAND as lp}from"lexical";import{useCallback as Ut,useEffect as ct,useRef as ul,useState as sp}from"react";import*as Wt from"react";import{createPortal as ap}from"react-dom";function Ko(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function Gt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let u=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let g=0;return!e&&f<p.top&&!s&&(g=u.height+a.height+d*2,f+=g),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(f-=m.bottom-n+u.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),g}function cp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(st,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function up(t){let e=dl(19),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=B(),[s,a]=Wt.useState(),d;e[0]!==r.ChildComponent||e[1]!==r.items||e[2]!==r.type?(d=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},e[0]=r.ChildComponent,e[1]=r.items,e[2]=r.type,e[3]=d):d=e[3];let c;e[4]!==r?(c=[r],e[4]=r,e[5]=c):c=e[5],Wt.useEffect(d,c);let u;e[6]!==r.ChildComponent||e[7]!==r.items||e[8]!==r.type?(u=h=>{let{activeItems:g}=h;if(!g.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let E=g[0];a(()=>E.ChildComponent)},e[6]=r.ChildComponent,e[7]=r.items,e[8]=r.type,e[9]=u):u=e[9];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==n||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==r||e[15]!==i||e[16]!==m||e[17]!==p?(f=ml("div",{className:p,children:[r.type==="dropdown"&&r.items.length?s?se(Se,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):se(Se,{anchorElem:o,editor:n,group:r,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):null,r.type==="buttons"&&r.items.length?r.items.map(h=>se(cp,{anchorElem:o,editor:n,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&se("div",{className:"divider"})]},r.key),e[10]=s,e[11]=o,e[12]=n,e[13]=l.features.toolbarInline?.groups.length,e[14]=r,e[15]=i,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function dp({anchorElem:t,editor:e}){let o=ul(null),n=ul(null),{editorConfig:r}=B(),i=Ut(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ut(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ut(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ut(()=>{let d=fl(),c=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Ko(c,p),h=Gt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&Gt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),pl(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(lp,()=>(a(),!1),ip))),[e,a]),ml("div",{className:"inline-toolbar-popup",ref:o,children:[se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((d,c)=>se(up,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function mp(t,e){let o=dl(12),[n,r]=sp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=fl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!cl(m)||f===null||!f.contains(p.anchorNode))){r(!1);return}if(!cl(m))return;if(m.getTextContent()!==""){let g=m.getNodes(),E=!1;for(let v of g)if(np(v)){r(!0),E=!0;break}E||r(!1)}else r(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){r(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>pl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ct(d,c),!n||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=ap(se(dp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var hl=t=>{let{anchorElem:e}=t,[o]=rp();return mp(o,e)};var pp=y({plugins:[{Component:hl,position:"floatingAnchorElem"}]});import{TableCellNode as o1,TableNode as r1,TableRowNode as n1}from"@lexical/table";import{jsx as gl}from"react/jsx-runtime";import"react";var zo=()=>gl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as kp,$createTableNode as Np,$createTableRowNode as Lp,$isTableCellNode as El,$isTableNode as Zo,$isTableRowNode as Xo,TableCellHeaderStates as Vt,TableCellNode as Rp,TableNode as Ip,TableRowNode as Sp}from"@lexical/table";import{$isParagraphNode as yp,$isTextNode as vp}from"lexical";var Cl=/^[\t ]*$/,fp=/^(\s*)(\d+)\.\s/,hp=/^(\s*)[-*+]\s/,gp=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,xl=/^(#{1,6})\s/,Cp=/^>\s/,xp=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,bp=/[ \t]*(\\`\\`\\`|```)$/,_p=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Tp=/^\|(.+)\|\s?$/,Ep=/^(\| ?:?-*:? ?)+\|\s?$/,bl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,_l=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function wp(t,e=!1){let o=t.split(`
|
|
35
|
+
`)};var yi={type:"element",dependencies:[pd,md],export:(t,e)=>dd(t)?Ie(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Oe("check")};import{jsx as fd}from"react/jsx-runtime";import{CheckListPlugin as hd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var vi=()=>fd(hd,{});var Mi=[q([{ChildComponent:vo,isActive:({selection:t})=>{if(!xd(t))return!1;for(let e of t.getNodes()){if(Do(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Do(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(Do(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Di,void 0)},order:12}])],bd=y(({featureProviderMap:t})=>{let e=[{Component:vi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ae,position:"normal"}),{markdownTransformers:[yi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Cd,gd],plugins:e,slashMenu:{groups:[Fe([{Icon:vo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Di,void 0)}}])]},toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}});import{$isListNode as Fo,INSERT_ORDERED_LIST_COMMAND as Oi,ListItemNode as kd,ListNode as Nd}from"@lexical/list";import{$isRangeSelection as Ld}from"lexical";import{jsx as ot,jsxs as _d}from"react/jsx-runtime";import"react";var Ao=()=>_d("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:[ot("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),ot("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),ot("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Td,ListItemNode as Ed,ListNode as wd}from"@lexical/list";var Ai={type:"element",dependencies:[wd,Ed],export:(t,e)=>Td(t)?Ie(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Oe("number")};var Fi=[q([{ChildComponent:Ao,isActive:({selection:t})=>{if(!Ld(t))return!1;for(let e of t.getNodes()){if(Fo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Fo(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Fo(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oi,void 0)},order:10}])],Rd=y(({featureProviderMap:t})=>({markdownTransformers:[Ai],nodes:t.has("orderedList")?[]:[Nd,kd],plugins:t.has("orderedList")?[]:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Fe([{Icon:Ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Oi,void 0)}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}}));import{$isListNode as $o,INSERT_UNORDERED_LIST_COMMAND as Bi,ListItemNode as Md,ListNode as Dd}from"@lexical/list";import{$isRangeSelection as Ad}from"lexical";import{jsx as $e,jsxs as Id}from"react/jsx-runtime";import"react";var Oo=()=>Id("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:[$e("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Sd,ListItemNode as yd,ListNode as vd}from"@lexical/list";var $i={type:"element",dependencies:[vd,yd],export:(t,e)=>Sd(t)?Ie(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Oe("bullet")};var Pi=[q([{ChildComponent:Oo,isActive:({selection:t})=>{if(!Ad(t))return!1;for(let e of t.getNodes()){if($o(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($o(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!($o(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)},order:11}])],Fd=y({markdownTransformers:[$i],nodes:[Dd,Md],plugins:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Fe([{Icon:Oo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}});import{jsx as Od}from"react/jsx-runtime";import{addClassNamesToElement as $d}from"@lexical/utils";import{DecoratorNode as Pd}from"lexical";import*as Hi from"react";var Bd=Hi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),rt=class t extends Pd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Hd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return $d(o,"unknownConverted"),o}decorate(){return Od(Bd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Hd({data:t}){return new rt({data:t})}var jd=y(()=>({nodes:[rt]}));import{jsx as Gd}from"react/jsx-runtime";import{addClassNamesToElement as Ud}from"@lexical/utils";import{DecoratorNode as Wd}from"lexical";import*as ji from"react";var Vd=ji.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends Wd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Kd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Ud(o,"unknownConverted"),o}decorate(){return Gd(Vd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Kd({data:t}){return new nt({data:t})}var zd=y(()=>({nodes:[nt]}));import{$setBlocksType as Wi}from"@lexical/selection";import{$createParagraphNode as Vi,$getSelection as Ki,$isParagraphNode as Gi,$isRangeSelection as Zd}from"lexical";var Ui=[q([{ChildComponent:ze,isActive:({selection:t})=>{if(!Zd(t))return!1;for(let e of t.getNodes())if(!Gi(e)&&!Gi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})},order:1}])],Xd=y({slashMenu:{groups:[Z([{Icon:ze,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}});import{$isNodeSelection as Im}from"lexical";import{jsx as it,jsxs as Yd}from"react/jsx-runtime";import"react";var Po=()=>Yd("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:[it("g",{clipPath:"url(#clip0_4397_10817)",children:it("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),it("defs",{children:it("clipPath",{id:"clip0_4397_10817",children:it("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as fm}from"react/compiler-runtime";import{jsx as hm}from"react/jsx-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Cm}from"@lexical/utils";import{useConfig as xm}from"@payloadcms/ui";import{$getPreviousSelection as bm,$getSelection as _m,$isParagraphNode as qi,$isRangeSelection as Tm,COMMAND_PRIORITY_EDITOR as Em,createCommand as wm}from"lexical";import{useEffect as km}from"react";import{c as am}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as cm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as um,COMMAND_PRIORITY_EDITOR as dm}from"lexical";import{useEffect as mm,useState as Xi}from"react";import{c as Jd}from"react/compiler-runtime";import{jsx as qd}from"react/jsx-runtime";import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext";import{useListDrawer as em,useModal as tm}from"@payloadcms/ui";import{$getNodeByKey as zi,$getPreviousSelection as om,$getRoot as rm,$getSelection as nm,$isRangeSelection as im,$setSelection as lm}from"lexical";import{useEffect as sm,useState as Zi}from"react";var lt=t=>{let e=Jd(23),[o]=Qd(),[n,r]=Zi(null),[i,l]=Zi(!1),[s,a,d]=em(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=tm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let N=nm()??om();r(N)},e[0]=h):h=e[0];let g=h,E;e[1]!==o||e[2]!==n?(E=()=>{n&&o.update(()=>{if(im(n)){let{anchor:N,focus:I}=n;zi(N.key)&&zi(I.key)&&lm(n.clone())}else rm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=E):E=e[3];let v=E,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let x=D,k,C;e[6]!==u||e[7]!==f||e[8]!==v||e[9]!==i?(k=()=>{if(!i)return;let N=f[u];N&&!N?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},C=[f,u,v,i],e[6]=u,e[7]=f,e[8]=v,e[9]=i,e[10]=k,e[11]=C):(k=e[10],C=e[11]),sm(k,C);let T;e[12]!==a?(T=N=>qd(a,{...N,onClick:()=>{g()}}),e[12]=a,e[13]=T):T=e[13];let L;e[14]!==p?(L=()=>{g(),p(),l(!0)},e[14]=p,e[15]=L):L=e[15];let w;return e[16]!==s||e[17]!==x||e[18]!==m||e[19]!==u||e[20]!==T||e[21]!==L?(w={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:T,openListDrawer:L},e[16]=s,e[17]=x,e[18]=m,e[19]=u,e[20]=T,e[21]=L,e[22]=w):w=e[22],w};var pm=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=um(o);r&&r.replace(We({relationTo:e,value:n}))}):t.dispatchCommand(Bo,{relationTo:e,value:n})},Yi=t=>{let e=am(16),{enabledCollectionSlugs:o}=t,[n]=cm(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i]=Xi(r),[l,s]=Xi(null),a=o||void 0,d;e[2]!==i||e[3]!==a?(d={collectionSlugs:a,selectedCollection:i},e[2]=i,e[3]=a,e[4]=d):d=e[4];let{closeListDrawer:c,ListDrawer:u,openListDrawer:m}=lt(d),p,f;e[5]!==n||e[6]!==m?(p=()=>n.registerCommand(Ge,v=>(s(v?.replace?v?.replace.nodeKey:null),m(),!0),dm),f=[n,m],e[5]=n,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),mm(p,f);let h;e[9]!==c||e[10]!==n||e[11]!==l?(h=v=>{let{collectionSlug:D,docID:x}=v;pm({editor:n,relationTo:D,replaceNodeKey:l,value:x}),c()},e[9]=c,e[10]=n,e[11]=l,e[12]=h):h=e[12];let g=h,E;return e[13]!==u||e[14]!==g?(E=Pt(u,{onSelect:g}),e[13]=u,e[14]=g,e[15]=E):E=e[15],E},Ji=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Pt(Yi,{...t}):Pt(bt,{...t,children:Pt(Yi,{...t})});var Bo=wm("INSERT_RELATIONSHIP_COMMAND"),Qi=t=>{let e=fm(10),{clientProps:o}=t,[n]=gm(),{config:r}=xm(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o?.disabledCollections||e[1]!==i){let u;e[3]!==o?.disabledCollections?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o?.disabledCollections,e[4]=u):u=e[4],c=i.filter(u).map(Nm),e[0]=o?.disabledCollections,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Ue]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Bo,Rm,Em)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),km(s,a);let d;return e[8]!==l?(d=hm(Ji,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function Nm(t){let{slug:e}=t;return e}function Lm(t){return qi(t)}function Rm(t){let e=_m()||bm();if(Tm(e)){let o=We(t);Cm(o);let{focus:n}=e,r=n.getNode();qi(r)&&r.getTextContentSize()===0&&r.getParentOrThrow().getChildren().filter(Lm).length>1&&r.remove()}return!0}var Sm=y({nodes:[Ue],plugins:[{Component:Qi,position:"normal"}],slashMenu:{groups:[Z([{Icon:Po,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:Po,isActive:({selection:t})=>{if(!Im(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]}});import{c as ll}from"react/compiler-runtime";import{jsx as ne,jsxs as zm}from"react/jsx-runtime";import{useLexicalComposerContext as Zm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Xm,useThrottledEffect as Ym,useTranslation as Jm}from"@payloadcms/ui";import*as Ce from"react";import{useMemo as qm}from"react";import{c as ym}from"react/compiler-runtime";import{jsx as vm}from"react/jsx-runtime";import{mergeRegister as Mm}from"@lexical/utils";import{$addUpdateTag as Dm,$getSelection as Am}from"lexical";import{useEffect as Bt,useState as Ho}from"react";var jo="toolbar-popup__button",st=t=>{let e=ym(34),{children:o,editor:n,item:r}=t,[i,l]=Ho(!0),[s,a]=Ho(!1),[d,c]=Ho(jo),u=B(),m;e[0]!==s||e[1]!==n||e[2]!==u||e[3]!==i||e[4]!==r?(m=()=>{n.getEditorState().read(()=>{let L=Am();if(L){if(r.isActive){let w=r.isActive({editor:n,editorConfigContext:u,selection:L});s!==w&&a(w)}if(r.isEnabled){let w=r.isEnabled({editor:n,editorConfigContext:u,selection:L});i!==w&&l(w)}}})},e[0]=s,e[1]=n,e[2]=u,e[3]=i,e[4]=r,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Bt(f,h);let g,E;e[9]!==p?(g=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),E=[p],e[9]=p,e[10]=g,e[11]=E):(g=e[10],E=e[11]),Bt(g,E);let v,D;e[12]!==n||e[13]!==p?(v=()=>Mm(n.registerUpdateListener(()=>{p()})),D=[n,p],e[12]=n,e[13]=p,e[14]=v,e[15]=D):(v=e[14],D=e[15]),Bt(v,D);let x;e[16]!==s||e[17]!==i||e[18]!==r.key?(x=()=>{c([jo,i===!1?"disabled":"",s?"active":"",r?.key?`${jo}-`+r.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=r.key,e[19]=x):x=e[19];let k;e[20]!==s||e[21]!==d||e[22]!==i||e[23]!==r.key?(k=[i,s,d,r.key],e[20]=s,e[21]=d,e[22]=i,e[23]=r.key,e[24]=k):k=e[24],Bt(x,k);let C;e[25]!==s||e[26]!==n||e[27]!==i||e[28]!==r?(C=()=>{if(i!==!1)return n.focus(()=>{n.update(Fm),r.onSelect?.({editor:n,isActive:s})}),!0},e[25]=s,e[26]=n,e[27]=i,e[28]=r,e[29]=C):C=e[29];let T;return e[30]!==o||e[31]!==d||e[32]!==C?(T=vm("button",{className:d,onClick:C,onMouseDown:Om,type:"button",children:o}),e[30]=o,e[31]=d,e[32]=C,e[33]=T):T=e[33],T};function Fm(){Dm("toolbar")}function Om(t){t.preventDefault()}import{c as il}from"react/compiler-runtime";import{jsx as Pe}from"react/jsx-runtime";import Wo,{useEffect as nl}from"react";import{mergeRegister as Um}from"@lexical/utils";import{useTranslation as Wm}from"@payloadcms/ui";import{$getSelection as Vm}from"lexical";import{jsx as Te,jsxs as el}from"react/jsx-runtime";import{Button as $m}from"@payloadcms/ui";import{$addUpdateTag as Pm}from"lexical";import Ht,{useCallback as Bm,useEffect as at,useMemo as Hm,useRef as Uo,useState as jt}from"react";import{createPortal as jm}from"react-dom";var Go="toolbar-popup__dropdown-item",tl=Ht.createContext(null);function ol({active:t,children:e,editor:o,enabled:n,Icon:r,item:i,tooltip:l}){let[s,a]=jt(Go);at(()=>{a([Go,n===!1?"disabled":"",t?"active":"",i?.key?`${Go}-${i.key}`:""].filter(Boolean).join(" "))},[n,t,s,i.key]);let d=Uo(null),c=Ht.useContext(tl);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return at(()=>{d?.current!=null&&u(d)},[d,u]),Te($m,{"aria-label":l,buttonStyle:"none",className:s,disabled:n===!1,icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Pm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function Gm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=jt(),[l,s]=jt(),a=Bm(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(r==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(p=>{if(p==null)return r[0];let f=r.indexOf(p)-1;return r[f===-1?r.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?r[0]:r[r.indexOf(p)+1])},c=Hm(()=>({registerItem:a}),[a]);return at(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),Te(tl.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function rl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Uo(null),d=Uo(null),[c,u]=jt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};at(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:g,top:E}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${E+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),at(()=>{let f=d.current;if(f!==null&&c){let h=g=>{let{target:E}=g;s!=null&&a.current!=null&&a.current.contains(E)||f.contains(E)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=jm(Te(Gm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return el(Ht.Fragment,{children:[el("button",{"aria-label":t,className:e+(c?" active":""),disabled:n,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[r&&Te(r,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Ht.Fragment,{children:p})]})}var Vo="toolbar-popup__dropdown",Km=t=>{let e=il(18),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=Wm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==i||e[4]!==l?(f=l?.Component&&Pe(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=o,e[1]=n,e[2]=r,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==d||e[7]!==s||e[8]!==l||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=d,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==o||e[12]!==m||e[13]!==r||e[14]!==i||e[15]!==l||e[16]!==u?(p=Pe(ol,{active:o,editor:r,enabled:i,Icon:l?.ChildComponent?Pe(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:Pe("span",{className:"text",children:m})},l.key),e[11]=o,e[12]=m,e[13]=r,e[14]=i,e[15]=l,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=il(36),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Wo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,g]=Wo.useState(f),[E,v]=Wo.useState(!0),D=B(),{items:x,key:k}=i,C;e[2]!==r||e[3]!==D||e[4]!==i||e[5]!==x||e[6]!==d||e[7]!==c?(C=()=>{r.getEditorState().read(()=>{let $=Vm();if(!$)return;let W=[],J=[],U=[];for(let H of x)H.isActive&&(!d||W.length<d)&&H.isActive({editor:r,editorConfigContext:D,selection:$})&&(W.push(H.key),J.push(H)),H.isEnabled?H.isEnabled({editor:r,editorConfigContext:D,selection:$})&&U.push(H.key):U.push(H.key);i.isEnabled&&v(i.isEnabled({editor:r,editorConfigContext:D,selection:$})),p(W),g(U),c&&c({activeItems:J})})},e[2]=r,e[3]=D,e[4]=i,e[5]=x,e[6]=d,e[7]=c,e[8]=C):C=e[8];let T=C,L,w;e[9]!==T?(L=()=>{T()},w=[T],e[9]=T,e[10]=L,e[11]=w):(L=e[10],w=e[11]),nl(L,w);let N,I;e[12]!==r||e[13]!==T?(N=()=>Um(r.registerUpdateListener(()=>{T()})),I=[r,T],e[12]=r,e[13]=T,e[14]=N,e[15]=I):(N=e[14],I=e[15]),nl(N,I);let b=`${k} dropdown`,_=`${Vo}-${k}`,S;e[16]!==n?(S=n||[],e[16]=n,e[17]=S):S=e[17];let R;e[18]!==S||e[19]!==_?(R=[Vo,_,...S].filter(Boolean),e[18]=S,e[19]=_,e[20]=R):R=e[20];let A=R.join(" "),M=!E,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let G;return e[23]!==l||e[24]!==m||e[25]!==o||e[26]!==r||e[27]!==h||e[28]!==k||e[29]!==x||e[30]!==a||e[31]!==A||e[32]!==M||e[33]!==O||e[34]!==b?(G=Pe(rl,{buttonAriaLabel:b,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Vo}-items`,...O],label:a,children:x.length?x.map($=>Pe(Km,{active:m.includes($.key),anchorElem:o,editor:r,enabled:h.includes($.key),item:$},$.key)):null},k),e[23]=l,e[24]=m,e[25]=o,e[26]=r,e[27]=h,e[28]=k,e[29]=x,e[30]=a,e[31]=A,e[32]=M,e[33]=O,e[34]=b,e[35]=G):G=e[35],G};function Qm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function ep(t){let e=ll(23),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=Jm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=Ce.useState(void 0),[p,f]=Ce.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],Ce.useEffect(h,g);let E;e[6]!==d||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==c?(E=k=>{let{activeItems:C}=k;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let T=C[0],L=T.key;T.label&&(L=typeof T.label=="function"?T.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):T.label),L.length>25&&(L=L.substring(0,25)+"..."),C.length===1?(m(L),f(()=>T.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=d,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=c,e[12]=E):E=e[12];let v=E,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[13]!==p||e[14]!==o||e[15]!==u||e[16]!==n||e[17]!==r.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==v||e[21]!==D?(x=zm("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?ne(Se,{anchorElem:o,editor:n,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):ne(Se,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):null,i.type==="buttons"&&i.items.length?i.items.map(k=>ne(Qm,{anchorElem:o,editor:n,item:k},k.key)):null,l<r.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[13]=p,e[14]=o,e[15]=u,e[16]=n,e[17]=r.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=v,e[21]=D,e[22]=x):x=e[22],x}function tp({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=Ce.useRef(null),{y:l}=Xm(),s=qm(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let d=r.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return Ym(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(Ce.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,d)=>ne(ep,{anchorElem:t,editor:o,editorConfig:n,group:a,index:d},a.key))})})}var sl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return sl(t.parentEditor)}return!1},al=t=>{let e=ll(6),{clientProps:o}=t,[n]=Zm(),r=B(),{editorConfig:i}=r,l=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,s=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||i,a,d;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==r){d=Symbol.for("react.early_return_sentinel");e:{let c=sl(r);if(o?.disableIfParentHasFixedToolbar&&c){d=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){d=null;break e}a=ne(tp,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=d}else a=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:a};var op=y({plugins:[{Component:al,position:"aboveContainer"}]});import{c as dl}from"react/compiler-runtime";import{jsx as se,jsxs as ml}from"react/jsx-runtime";import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as pl}from"@lexical/utils";import{$getSelection as fl,$isRangeSelection as cl,$isTextNode as np,COMMAND_PRIORITY_LOW as ip,SELECTION_CHANGE_COMMAND as lp}from"lexical";import{useCallback as Ut,useEffect as ct,useRef as ul,useState as sp}from"react";import*as Wt from"react";import{createPortal as ap}from"react-dom";function Ko(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function Gt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let u=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let g=0;return!e&&f<p.top&&!s&&(g=u.height+a.height+d*2,f+=g),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(f-=m.bottom-n+u.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),g}function cp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(st,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function up(t){let e=dl(19),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=B(),[s,a]=Wt.useState(),d;e[0]!==r.ChildComponent||e[1]!==r.items||e[2]!==r.type?(d=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},e[0]=r.ChildComponent,e[1]=r.items,e[2]=r.type,e[3]=d):d=e[3];let c;e[4]!==r?(c=[r],e[4]=r,e[5]=c):c=e[5],Wt.useEffect(d,c);let u;e[6]!==r.ChildComponent||e[7]!==r.items||e[8]!==r.type?(u=h=>{let{activeItems:g}=h;if(!g.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let E=g[0];a(()=>E.ChildComponent)},e[6]=r.ChildComponent,e[7]=r.items,e[8]=r.type,e[9]=u):u=e[9];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==n||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==r||e[15]!==i||e[16]!==m||e[17]!==p?(f=ml("div",{className:p,children:[r.type==="dropdown"&&r.items.length?s?se(Se,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):se(Se,{anchorElem:o,editor:n,group:r,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):null,r.type==="buttons"&&r.items.length?r.items.map(h=>se(cp,{anchorElem:o,editor:n,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&se("div",{className:"divider"})]},r.key),e[10]=s,e[11]=o,e[12]=n,e[13]=l.features.toolbarInline?.groups.length,e[14]=r,e[15]=i,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function dp({anchorElem:t,editor:e}){let o=ul(null),n=ul(null),{editorConfig:r}=B(),i=Ut(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ut(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ut(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ut(()=>{let d=fl(),c=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Ko(c,p),h=Gt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&Gt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),pl(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(lp,()=>(a(),!1),ip))),[e,a]),ml("div",{className:"inline-toolbar-popup",ref:o,children:[se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((d,c)=>se(up,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function mp(t,e){let o=dl(12),[n,r]=sp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=fl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!cl(m)||f===null||!f.contains(p.anchorNode))){r(!1);return}if(!cl(m))return;if(m.getTextContent()!==""){let g=m.getNodes(),E=!1;for(let v of g)if(np(v)){r(!0),E=!0;break}E||r(!1)}else r(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){r(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>pl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ct(d,c),!n||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=ap(se(dp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var hl=t=>{let{anchorElem:e}=t,[o]=rp();return mp(o,e)};var pp=y({plugins:[{Component:hl,position:"floatingAnchorElem"}]});import{TableCellNode as o1,TableNode as r1,TableRowNode as n1}from"@lexical/table";import{jsx as gl}from"react/jsx-runtime";import"react";var zo=()=>gl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as kp,$createTableNode as Np,$createTableRowNode as Lp,$isTableCellNode as El,$isTableNode as Zo,$isTableRowNode as Xo,TableCellHeaderStates as Vt,TableCellNode as Rp,TableNode as Ip,TableRowNode as Sp}from"@lexical/table";import{$isParagraphNode as yp,$isTextNode as vp}from"lexical";var Cl=/^[\t ]*$/,fp=/^(\s*)(\d+)\.\s/,hp=/^(\s*)[-*+]\s/,gp=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,xl=/^(#{1,6})\s/,Cp=/^>\s/,xp=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,bp=/[ \t]*(\\`\\`\\`|```)$/,_p=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Tp=/^\|(.+)\|\s?$/,Ep=/^(\| ?:?-*:? ?)+\|\s?$/,bl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,_l=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function wp(t,e){let o=t.split(`
|
|
36
36
|
`),n=!1,r=[];for(let i=0;i<o.length;i++){let l=o[i],s=r[r.length-1];if(_p.test(l)){r.push(l);continue}if(xp.test(l)){n=!0,r.push(l);continue}if(bp.test(l)){n=!1,r.push(l);continue}if(n){r.push(l);continue}Cl.test(l)||Cl.test(s)||!s||xl.test(s)||xl.test(l)||Cp.test(l)||fp.test(l)||hp.test(l)||gp.test(l)||Tp.test(l)||Ep.test(l)||!e||bl.test(l)||_l.test(l)||bl.test(s)||_l.test(s)?r.push(l):r[r.length-1]=s+" "+l.trim()}return r.join(`
|
|
37
37
|
`)}function Tl(t,e=pr,o,n=!1,r=!0){let i=n?t:wp(t,r);return fr(i,e,o)}var kl=/^\|(.+)\|\s?$/,Mp=/^(\| ?:?-*:? ?)+\|\s?$/,Nl=({allTransformers:t})=>({type:"element",dependencies:[Ip,Sp,Rp],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())El(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:kl,replace:(e,o,n)=>{if(Mp.test(n[0])){let c=e.getPreviousSibling();if(!c||!Zo(c))return;let u=c.getChildren(),m=u[u.length-1];if(!m||!Xo(m))return;m.getChildren().forEach(p=>{El(p)&&p.setHeaderStyles(Vt.ROW,Vt.ROW)}),e.remove();return}let r=wl(n[0],t);if(r==null)return;let i=[r],l=e.getPreviousSibling(),s=r.length;for(;l&&!(!yp(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!vp(c))break;let u=wl(c.getTextContent(),t);if(u==null)break;s=Math.max(s,u.length),i.unshift(u);let m=l.getPreviousSibling();l.remove(),l=m}let a=Np();for(let c of i){let u=Lp();a.append(u);for(let m=0;m<s;m++)u.append(m<c.length?c[m]:Ll("",t))}let d=e.getPreviousSibling();Zo(d)&&Dp(d)===s?(d.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Dp(t){let e=t.getFirstChild();return Xo(e)?e.getChildrenSize():0}var Ll=(t,e)=>{t=t.replace(/\\n/g,`
|