@payloadcms/richtext-lexical 3.90.1 → 3.91.0-internal.07e4582

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/exports/client/Field-5ZXLEL3U.js +2 -0
  2. package/dist/exports/client/{Field-YZR46UCY.js.map → Field-5ZXLEL3U.js.map} +3 -3
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/{chunk-XFA5M7FY.js → chunk-IIZYDMRJ.js} +2 -2
  5. package/dist/exports/client/chunk-IIZYDMRJ.js.map +7 -0
  6. package/dist/exports/client/componentInline-YMJQCGVL.js +2 -0
  7. package/dist/exports/client/index.js +17 -17
  8. package/dist/exports/client/index.js.map +3 -3
  9. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  10. package/dist/features/blocks/client/component/index.js +6 -6
  11. package/dist/features/blocks/client/component/index.js.map +1 -1
  12. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  13. package/dist/features/blocks/client/componentInline/index.js +3 -3
  14. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  15. package/dist/field/bundled.css +1 -1
  16. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  17. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  18. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +23 -0
  19. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  20. package/dist/lexical/plugins/NodeViewOverridePlugin/index.spec.js +51 -0
  21. package/dist/lexical/plugins/NodeViewOverridePlugin/index.spec.js.map +1 -0
  22. package/package.json +6 -6
  23. package/dist/exports/client/Field-YZR46UCY.js +0 -2
  24. package/dist/exports/client/chunk-XFA5M7FY.js.map +0 -7
  25. package/dist/exports/client/componentInline-A4H3EY3L.js +0 -2
  26. /package/dist/exports/client/{componentInline-A4H3EY3L.js.map → componentInline-YMJQCGVL.js.map} +0 -0
@@ -1,26 +1,26 @@
1
- "use client";import{a as he,c as xt,d as Ct,e as bt}from"./chunk-XFA5M7FY.js";import{a as Ke}from"./chunk-DBWINSQN.js";import{a as kt,b as Je,c as Xe,d as ve,e as Ze}from"./chunk-OSMEE5HW.js";import{a as fe}from"./chunk-INBEEENE.js";import{a as bc}from"./chunk-F26IQ5RE.js";import{b as Xt,c as Zt,d as ne,e as hn,f as Uo,g as Go,h as kc,i as _c,k as Tc,m as wc,p as Sc}from"./chunk-QAW5QKEM.js";import{a as Cc,b as G}from"./chunk-BZZVLW4U.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Rc}from"react/compiler-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as ge}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as vc}from"@lexical/utils";import{$getSelection as Mc,$isElementNode as ce,$isNodeSelection as $c,$isRangeSelection as _t,COMMAND_PRIORITY_LOW as Dc,FORMAT_ELEMENT_COMMAND as Tt}from"lexical";import{useEffect as Ac}from"react";import{jsx as Wo,jsxs as Ec}from"react/jsx-runtime";import"react";var gn=()=>Ec("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:[Wo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Vo,jsxs as Nc}from"react/jsx-runtime";import"react";var xn=()=>Nc("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:[Vo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as zo,jsxs as Lc}from"react/jsx-runtime";import"react";var Yt=()=>Lc("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:[zo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ko,jsxs as yc}from"react/jsx-runtime";import"react";var Cn=()=>yc("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:[Ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var bn=t=>({type:"dropdown",ChildComponent:Yt,items:t,key:"align",order:30});var Me=t=>ce(t)?t.getFormatType():t.__format,kn=[bn([{ChildComponent:Yt,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="left")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"left")},order:1},{ChildComponent:gn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="center")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"center")},order:2},{ChildComponent:Cn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="right")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"right")},order:3},{ChildComponent:xn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"justify")},order:4}])],Oc=()=>{let t=Rc(3),[e]=Ic(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Tt,Bc,Dc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ac(o,r),null},Fc=M({plugins:[{Component:Oc,position:"normal"}],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});function Pc(t){return(ce(t)||ge(t))&&!t.isInline()}function Bc(t){let e=Mc();if(!_t(e)&&!$c(e))return!1;let o=e.getNodes();for(let r of o){let n=vc(r,Pc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as Ln,$isQuoteNode as En,QuoteNode as Uc}from"@lexical/rich-text";import{$setBlocksType as yn}from"@lexical/selection";import{$getSelection as Rn,$isRangeSelection as Gc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Jo=()=>_n("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:_n("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Tn}from"react/jsx-runtime";import"react";var wt=()=>Tn("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:Tn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ee=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});import{$createQuoteNode as jc,$isQuoteNode as wn,QuoteNode as Hc}from"@lexical/rich-text";var Sn={type:"element",dependencies:[Hc],export:(t,e)=>{if(!wn(t))return null;let o=e(t).split(`
1
+ "use client";import{a as fe,c as gt,d as xt,e as Ct}from"./chunk-IIZYDMRJ.js";import{a as Ve}from"./chunk-DBWINSQN.js";import{a as bt,b as ze,c as Ke,d as Le,e as Je}from"./chunk-OSMEE5HW.js";import{a as pe}from"./chunk-INBEEENE.js";import{a as bc}from"./chunk-F26IQ5RE.js";import{b as Jt,c as Xt,d as le,e as hn,f as Uo,g as Go,h as kc,i as _c,k as Tc,m as wc,p as Sc}from"./chunk-QAW5QKEM.js";import{a as Cc,b as G}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Rc}from"react/compiler-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as he}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as vc}from"@lexical/utils";import{$getSelection as Mc,$isElementNode as ce,$isNodeSelection as $c,$isRangeSelection as kt,COMMAND_PRIORITY_LOW as Dc,FORMAT_ELEMENT_COMMAND as _t}from"lexical";import{useEffect as Ac}from"react";import{jsx as Wo,jsxs as Ec}from"react/jsx-runtime";import"react";var gn=()=>Ec("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:[Wo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Vo,jsxs as Nc}from"react/jsx-runtime";import"react";var xn=()=>Nc("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:[Vo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as zo,jsxs as Lc}from"react/jsx-runtime";import"react";var Zt=()=>Lc("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:[zo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ko,jsxs as yc}from"react/jsx-runtime";import"react";var Cn=()=>yc("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:[Ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var v=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var bn=t=>({type:"dropdown",ChildComponent:Zt,items:t,key:"align",order:30});var ye=t=>ce(t)?t.getFormatType():t.__format,kn=[bn([{ChildComponent:Zt,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((ce(e)||he(e))&&ye(e)==="left")continue;let o=e.getParent();if(!((ce(o)||he(o))&&ye(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"left")},order:1},{ChildComponent:gn,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((ce(e)||he(e))&&ye(e)==="center")continue;let o=e.getParent();if(!((ce(o)||he(o))&&ye(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"center")},order:2},{ChildComponent:Cn,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((ce(e)||he(e))&&ye(e)==="right")continue;let o=e.getParent();if(!((ce(o)||he(o))&&ye(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"right")},order:3},{ChildComponent:xn,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((ce(e)||he(e))&&ye(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||he(o))&&ye(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"justify")},order:4}])],Oc=()=>{let t=Rc(3),[e]=Ic(),o,r;return t[0]!==e?(o=()=>e.registerCommand(_t,Bc,Dc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ac(o,r),null},Fc=v({plugins:[{Component:Oc,position:"normal"}],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});function Pc(t){return(ce(t)||he(t))&&!t.isInline()}function Bc(t){let e=Mc();if(!kt(e)&&!$c(e))return!1;let o=e.getNodes();for(let r of o){let n=vc(r,Pc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as Ln,$isQuoteNode as En,QuoteNode as Uc}from"@lexical/rich-text";import{$setBlocksType as yn}from"@lexical/selection";import{$getSelection as Rn,$isRangeSelection as Gc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Jo=()=>_n("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:_n("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Tn}from"react/jsx-runtime";import"react";var Tt=()=>Tn("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:Tn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var te=t=>({type:"dropdown",ChildComponent:Tt,items:t,key:"text",order:25});import{$createQuoteNode as jc,$isQuoteNode as wn,QuoteNode as Hc}from"@lexical/rich-text";var Sn={type:"element",dependencies:[Hc],export:(t,e)=>{if(!wn(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(wn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=jc();n.append(...e),t.replace(n),n.select(0,0)}};var Nn=[ee([{ChildComponent:Jo,isActive:({selection:t})=>{if(!Gc(t))return!1;for(let e of t.getNodes())if(!En(e)&&!En(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})},order:20}])],Wc=M({markdownTransformers:[Sn],nodes:[Uc],slashMenu:{groups:[X([{Icon:Jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})}}])]},toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}});import{getTranslation as so}from"@payloadcms/translations";import{jsx as Xo,jsxs as Vc}from"react/jsx-runtime";import"react";var qt=()=>Vc("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:[Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as In}from"react/jsx-runtime";import"react";var Qt=()=>In("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:In("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as zc}from"react/jsx-runtime";import"react";function eo(t,e){let{admin:o,imageAltText:r,imageURL:n}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=n,i=r),!s)return e;let d=i??"Block Image";return()=>zc("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Hn}from"lexical";import{JSOX as Zo}from"jsox";function to({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=Kc(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Kc(t,e){let o=t[e];return o==='"'?vn(t,e):o==="'"?vn(t,e,!0):o==="{"?Xc(t,e):o==="["?Jc(t,e):Yc(t,e)}function Jc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Zo.parse(`[${r}]`)}}function vn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Xc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Zc(r)}}function Zc(t){return t[0]!=="{"?Zo.parse(t):Zo.parse(t.replace(/(\w+):/g,'"$1":'))}function Yc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function St({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${qc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,Mn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Mn)}}`));return e.join(" ")}function qc(t){return t.replace(/"/g,"&quot;")}function Mn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function oo({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,n.index),g=0,T=r;e:for(let[S,x]of d.entries()){let b=l?x.trim():x,C=0;if(l)for(let _=0;_<x.length&&x[_]===" ";_++)C++;let k=0;for(S===0&&(k=(n.index??0)+n[0].length-C);k<b.length;){let _=b[k],$=b[k+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&$==="/"){if(u--,u<0){i[i.length-1]===`
4
- `&&(i=i.slice(0,-1)),T=S;for(let v=k;v<b.length;v++)if(b[v]===">"){g=v+1;break}break e}}else if(_==="/"&&$===">"){if(u--,u<0){i[i.length-1]===`
5
- `&&(i=i.slice(0,-1)),T=S,g=k+2;break e}}else _==="<"&&$!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&$===">"&&a===0&&!m){p=!0,T=S,g=k+2;break e}else if(_===">"&&a===0&&!m){c=!0,k++;continue}s+=_}k++}if(c?i?.length>0&&S>0&&(i+=`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(wn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=jc();n.append(...e),t.replace(n),n.select(0,0)}};var Nn=[te([{ChildComponent:Jo,isActive:({selection:t})=>{if(!Gc(t))return!1;for(let e of t.getNodes())if(!En(e)&&!En(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})},order:20}])],Wc=v({markdownTransformers:[Sn],nodes:[Uc],slashMenu:{groups:[Z([{Icon:Jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})}}])]},toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}});import{getTranslation as io}from"@payloadcms/translations";import{jsx as Xo,jsxs as Vc}from"react/jsx-runtime";import"react";var Yt=()=>Vc("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:[Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as In}from"react/jsx-runtime";import"react";var qt=()=>In("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:In("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as zc}from"react/jsx-runtime";import"react";function Qt(t,e){let{admin:o,imageAltText:r,imageURL:n}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=n,i=r),!s)return e;let d=i??"Block Image";return()=>zc("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Hn}from"lexical";import{JSOX as Zo}from"jsox";function eo({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=Kc(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Kc(t,e){let o=t[e];return o==='"'?vn(t,e):o==="'"?vn(t,e,!0):o==="{"?Xc(t,e):o==="["?Jc(t,e):Yc(t,e)}function Jc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Zo.parse(`[${r}]`)}}function vn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Xc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Zc(r)}}function Zc(t){return t[0]!=="{"?Zo.parse(t):Zo.parse(t.replace(/(\w+):/g,'"$1":'))}function Yc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function wt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${qc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,Mn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Mn)}}`));return e.join(" ")}function qc(t){return t.replace(/"/g,"&quot;")}function Mn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function to({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,n.index),g=0,T=r;e:for(let[S,x]of d.entries()){let b=l?x.trim():x,C=0;if(l)for(let _=0;_<x.length&&x[_]===" ";_++)C++;let k=0;for(S===0&&(k=(n.index??0)+n[0].length-C);k<b.length;){let _=b[k],D=b[k+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&D==="/"){if(u--,u<0){i[i.length-1]===`
4
+ `&&(i=i.slice(0,-1)),T=S;for(let I=k;I<b.length;I++)if(b[I]===">"){g=I+1;break}break e}}else if(_==="/"&&D===">"){if(u--,u<0){i[i.length-1]===`
5
+ `&&(i=i.slice(0,-1)),T=S,g=k+2;break e}}else _==="<"&&D!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&D===">"&&a===0&&!m){p=!0,T=S,g=k+2;break e}else if(_===">"&&a===0&&!m){c=!0,k++;continue}s+=_}k++}if(c?i?.length>0&&S>0&&(i+=`
6
6
  `):s+=`
7
7
  `,o&&u<0){let _=b.match(o);if(_?.index!==void 0){T=S,g=_.index+_[0].length-1;break}}if(S===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
8
8
  `)+`
9
9
 
10
- . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+T,endlineLastCharIndex:g,propsString:s}}import{jsx as vu}from"react/jsx-runtime";import Mu from"bson-objectid";import{$applyNodeReplacement as $u}from"lexical";import"react";import{DecoratorBlockNode as Qc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as eu}from"@lexical/utils";import tu from"bson-objectid";import{$applyNodeReplacement as ou}from"lexical";var Et=class extends Qc{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=ru(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return eu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function ru(t){return ou(new Et({fields:{...t,id:t?.id||new tu.default().toHexString()}}))}import{jsx as V,jsxs as Nt,Fragment as On}from"react/jsx-runtime";import{useLexicalComposerContext as du}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mu}from"@lexical/react/useLexicalEditable";import{getTranslation as pu}from"@payloadcms/translations";import{Button as Fn,Collapsible as fu,Drawer as hu,EditDepthProvider as gu,ErrorPill as xu,Form as Cu,formatDrawerSlug as bu,FormSubmit as ku,Pill as _u,RenderFields as Tu,SectionTitle as wu,useConfig as Su,useDocumentForm as Eu,useDocumentInfo as Pn,useEditDepth as Nu,useFormSubmitted as Lu,useServerFunctions as yu,useTranslation as Ru}from"@payloadcms/ui";import{abortAndIgnore as Yo}from"@payloadcms/ui/shared";import{$getNodeByKey as no,SKIP_DOM_SELECTION_TAG as qo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as lo,reduceFieldsToValues as Bn}from"payload/shared";import Ye,{useCallback as Qo,useEffect as er,useMemo as Ae,useRef as tr}from"react";import{v4 as Iu}from"uuid";import{c as nu}from"react/compiler-runtime";import{jsx as ro,jsxs as lu}from"react/jsx-runtime";import{useLexicalEditable as iu}from"@lexical/react/useLexicalEditable";import{RenderFields as su,useFormSubmitted as au}from"@payloadcms/ui";import cu,{createContext as uu}from"react";var $n=uu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),le=()=>cu.use($n),Dn=t=>{let e=nu(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=au()&&i>0,a=iu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...T}=f;return ro(o,{errorCount:i,fieldHasErrors:u,...T,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return r?lu($n,{value:h,children:[r,ro(s,{})]}):ro(p,{children:ro(su,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function An({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var jn=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=Lu(),{id:d,collectionSlug:c,globalSlug:u}=Pn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=G(),{fields:g}=Eu(),T=tr(new AbortController),E=Nu(),[S,x]=Ye.useState(0),{config:b}=Su(),C=bu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:E}),{toggleDrawer:k}=fe(C),{getDocPreferences:_,setDocFieldPreferences:$}=Pn(),[v]=du(),N=mu(),L=l.blockType,{getFormState:w}=yu(),y=`${h}.lexical_internal_feature.blocks.lexical_blocks.${L}.fields`,[I,D]=Ye.useState(()=>{let U=p?.[l.id]?.formState;if(!U)return!1;let Q=Object.fromEntries(Object.entries(U).map(([W,z])=>[W,W in l?{...z,initialValue:l[W],value:l[W]}:z]));return Q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},Q}),R=tr(!1),A=tr(e);er(()=>{R.current?(A.current!==e&&D(!1),A.current=e):R.current=!0},[e]);let[H]=Ye.useState(()=>Iu()),[B,J]=Ye.useState(()=>{if(!n)return I?._components?.customComponents?.BlockLabel??void 0}),[F,Ve]=Ye.useState(()=>{if(!r)return I?._components?.customComponents?.Block??void 0}),Ne=Ae(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):F,[r,o,l,s,F]),me=Ae(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):B,[n,o,l,s,B]);er(()=>{let U=new AbortController;return l&&!I&&(async()=>{let{state:W}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:lo(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!N,renderAllFields:!0,schemaPath:y,signal:U.signal});if(W){W.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let z=Bn(lo(W,{excludeFiles:!0}),!0);v.update(()=>{let Y=no(s);if(Y&&Oe(Y)){let re=z;re.blockType=L,Y.setFields(re,!0)}},{tag:qo}),D(W),n||J(W._components?.customComponents?.BlockLabel??void 0),r||Ve(W._components?.customComponents?.Block??void 0)}})(),()=>{Yo(U)}},[w,y,N,d,n,r,l,v,s,I,c,u,_,g,L]);let[ft,ht]=Ye.useState(p?.[l.id]?.collapsed??!1),ie=`${h}.lexical_internal_feature.blocks.lexical_blocks.${L}`,ye=a.blocks?.[ie]?.[0],q=ye.blockReferences?typeof ye?.blockReferences?.[0]=="string"?b.blocksMap[ye?.blockReferences?.[0]]:ye?.blockReferences?.[0]:ye?.blocks?.[0],{i18n:pe,t:Re}=Ru(),gt=Qo(async({formState:U,submit:Q})=>{Yo(T.current);let W=new AbortController;T.current=W;let{state:z}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:lo(g,{excludeFiles:!0}),formState:U,globalSlug:u,initialBlockFormState:U,operation:"update",readOnly:!N,renderAllFields:!!Q,schemaPath:y,signal:W.signal});if(!z)return U;U.blockName&&(z.blockName=U.blockName);let Y=Bn(An({fields:lo(z,{excludeFiles:!0})}),!0);if(setTimeout(()=>{v.update(()=>{let re=no(s);if(re&&Oe(re)){let ze=Y;ze.blockType=L,re.setFields(ze,!0)}},{tag:qo})},0),Q){n||J(z._components?.customComponents?.BlockLabel??void 0),r||Ve(z._components?.customComponents?.Block??void 0);let re=0;for(let ze of Object.values(z))ze?.valid===!1&&re++;x(re)}return z},[w,d,c,_,u,y,L,g,N,v,s,r,n]);er(()=>()=>{Yo(T.current)},[]);let zt=Qo(()=>{v.update(()=>{no(s)?.remove()})},[v,s]),Ie=q?.labels?.singular?pu(q.labels.singular,pe):q?.slug,cn=Qo(U=>{_().then(Q=>{let z=Q?.fields?.[m.name]?.collapsed,Y=z&&z?.length?z:[];U?Y.includes(l.id)||Y.push(l.id):Y.includes(l.id)&&Y.splice(Y.indexOf(l.id),1),$(m.name,{collapsed:Y,hello:"hi"})})},[_,m.name,$,l.id]),Kt=Ae(()=>()=>V(Fn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!N,el:"button",icon:"edit",onClick:U=>(U.preventDefault(),U.stopPropagation(),k(),!1),onMouseDown:U=>{U.preventDefault()},round:!0,size:"small",tooltip:Re("lexical:blocks:inlineBlocks:edit",{label:Ie})}),[o,N,Re,Ie,k]),Jt=Ae(()=>()=>V(Fn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!N,icon:"x",onClick:U=>{U.preventDefault(),zt()},round:!0,tooltip:"Remove Block"}),[o,N,zt]),jo=Ae(()=>({Actions:U,children:Q,className:W,collapsibleProps:z,disableBlockName:Y,editButton:re,errorCount:ze,fieldHasErrors:Ho,Label:mn,Pill:pn,removeButton:xc})=>V("div",{className:`${o}__container ${o}-${L}`,children:V(fu,{className:[`${o}__row`,Ho?`${o}__row--has-errors`:`${o}__row--no-errors`,W].filter(Boolean).join(" "),collapsibleStyle:Ho?"error":"default",header:Nt("div",{className:`${o}__block-header`,children:[typeof mn<"u"?mn:typeof me<"u"?me:Nt("div",{className:`${o}__block-label`,children:[typeof pn<"u"?pn:V(_u,{className:`${o}__block-pill ${o}__block-pill-${L}`,pillStyle:"white",size:"small",children:Ie??L}),!Y&&!q?.admin?.disableBlockName&&V(wu,{path:"blockName",readOnly:!N}),Ho&&V(xu,{count:ze??0,i18n:pe,withMessage:!0})]}),V("div",{className:`${o}__block-actions`,children:typeof U<"u"?U:Nt(On,{children:[Ne&&re!==!1||!Ne&&re?V(Kt,{}):null,xc!==!1&&N?V(Jt,{}):null]})})]}),isCollapsed:ft,onToggle:fn=>{cn(fn),ht(fn)},...z||{},children:Q},0)}),[Ne,me,Kt,Jt,Ie,o,q?.admin?.disableBlockName,L,pe,ft,cn,N]),un=l?.id,dn=Ae(()=>()=>V(gu,{children:V(hu,{className:"",slug:C,title:Re(`lexical:blocks:inlineBlocks:${un?"edit":"create"}`,{label:Ie??Re("lexical:blocks:inlineBlocks:label")}),children:I?Nt(On,{children:[V(Tu,{fields:q?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:y,permissions:!0,readOnly:!N}),V(ku,{programmaticSubmit:!0,children:Re("fields:saveChanges")})]}):null})}),[I,C,un,Ie,Re,N,q?.fields,y]),gc=Ae(()=>I?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(Cu,{beforeSubmit:[async({formState:U})=>await gt({formState:U,submit:!0})],el:"div",fields:q?.fields??[],initialState:I,onChange:[gt],onSubmit:(U,Q)=>{Q.blockType=L,v.update(()=>{let W=no(s);W&&Oe(W)&&W.setFields(Q,!0)},{tag:qo}),k()},submitted:i,uuid:H,children:V(Dn,{baseClass:o,BlockDrawer:dn,Collapsible:jo,CustomBlock:Ne,CustomLabel:me,EditButton:Kt,errorCount:S,formSchema:q?.fields??[],initialState:I,nodeKey:s,RemoveButton:Jt})})}):null,[jo,dn,Ne,me,L,C,Jt,Kt,o,v,S,k,q?.fields,H,I,s,gt,i]);return q?gc:V(jo,{disableBlockName:!0,fieldHasErrors:!0,children:Nt("div",{className:`${o}-not-found`,children:["Error: Block '",L,"' not found in the config but exists in the lexical data"]})})};var se=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return vu(jn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return $u(new se({fields:{...t,id:t?.id||new Mu.default().toHexString()}}))}function Oe(t){return t instanceof se}import{createHeadlessEditor as Du}from"@lexical/headless";function or(t,e){return({editorState:r})=>{let n=Du({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return n.getEditorState().read(()=>{l=Zt(e)}),l}}import{createHeadlessEditor as Au}from"@lexical/headless";function io(t,e){return({markdown:r})=>{let n=Au({nodes:t});return n.update(()=>{Xt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Ou(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Gn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Un(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Un(r,!0);n&&(o=o.concat(n))}return o};function Un(t,e){if(!t.jsx)return null;let o=Ou(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[xt],export:s=>{if(!bt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${u?" "+St({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+St({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=oo({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=oo({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=io(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?to({propsString:c}):{}});if(a===!1)return;let m=Ct({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:s=>{if(!Oe(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
10
+ . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+T,endlineLastCharIndex:g,propsString:s}}import{jsx as vu}from"react/jsx-runtime";import Mu from"bson-objectid";import{$applyNodeReplacement as $u}from"lexical";import"react";import{DecoratorBlockNode as Qc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as eu}from"@lexical/utils";import tu from"bson-objectid";import{$applyNodeReplacement as ou}from"lexical";var St=class extends Qc{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=ru(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return eu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function ru(t){return ou(new St({fields:{...t,id:t?.id||new tu.default().toHexString()}}))}import{jsx as V,jsxs as Et,Fragment as On}from"react/jsx-runtime";import{useLexicalComposerContext as du}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mu}from"@lexical/react/useLexicalEditable";import{getTranslation as pu}from"@payloadcms/translations";import{Button as Fn,Collapsible as fu,Drawer as hu,EditDepthProvider as gu,ErrorPill as xu,Form as Cu,formatDrawerSlug as bu,FormSubmit as ku,Pill as _u,RenderFields as Tu,SectionTitle as wu,useConfig as Su,useDocumentForm as Eu,useDocumentInfo as Pn,useEditDepth as Nu,useFormSubmitted as Lu,useServerFunctions as yu,useTranslation as Ru}from"@payloadcms/ui";import{abortAndIgnore as Yo}from"@payloadcms/ui/shared";import{$getNodeByKey as ro,SKIP_DOM_SELECTION_TAG as qo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as no,reduceFieldsToValues as Bn}from"payload/shared";import Xe,{useCallback as Qo,useEffect as er,useMemo as ve,useRef as tr}from"react";import{v4 as Iu}from"uuid";import{c as nu}from"react/compiler-runtime";import{jsx as oo,jsxs as lu}from"react/jsx-runtime";import{useLexicalEditable as iu}from"@lexical/react/useLexicalEditable";import{RenderFields as su,useFormSubmitted as au}from"@payloadcms/ui";import cu,{createContext as uu}from"react";var $n=uu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ie=()=>cu.use($n),Dn=t=>{let e=nu(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=au()&&i>0,a=iu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...T}=f;return oo(o,{errorCount:i,fieldHasErrors:u,...T,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return r?lu($n,{value:h,children:[r,oo(s,{})]}):oo(p,{children:oo(su,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function An({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var jn=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=Lu(),{id:d,collectionSlug:c,globalSlug:u}=Pn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=G(),{fields:g}=Eu(),T=tr(new AbortController),E=Nu(),[S,x]=Xe.useState(0),{config:b}=Su(),C=bu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:E}),{toggleDrawer:k}=pe(C),{getDocPreferences:_,setDocFieldPreferences:D}=Pn(),[I]=du(),N=mu(),L=l.blockType,w=`${h}.lexical_internal_feature.blocks.lexical_blocks.${L}`,$=a.blocks?.[w]?.[0],M=$?.blockReferences?typeof $.blockReferences[0]=="string"?b.blocksMap[$.blockReferences[0]]:$.blockReferences[0]:$?.blocks?.[0],{getFormState:y}=yu(),A=`${h}.lexical_internal_feature.blocks.lexical_blocks.${L}.fields`,[F,j]=Xe.useState(()=>{let U=p?.[l.id]?.formState;if(!U)return!1;let ee=Object.fromEntries(Object.entries(U).map(([W,z])=>[W,W in l?{...z,initialValue:l[W],value:l[W]}:z]));return ee.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},ee}),J=tr(!1),P=tr(e);er(()=>{J.current?(P.current!==e&&j(!1),P.current=e):J.current=!0},[e]);let[He]=Xe.useState(()=>Iu()),[mt,Ue]=Xe.useState(()=>{if(!n)return F?._components?.customComponents?.BlockLabel??void 0}),[pt,Ge]=Xe.useState(()=>{if(!r)return F?._components?.customComponents?.Block??void 0}),X=ve(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):pt,[r,o,l,s,pt]),Q=ve(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):mt,[n,o,l,s,mt]);er(()=>{let U=new AbortController;return M&&l&&!F&&(async()=>{let{state:W}=await y({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:no(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!N,renderAllFields:!0,schemaPath:A,signal:U.signal});if(W){W.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let z=Bn(no(W,{excludeFiles:!0}),!0);I.update(()=>{let q=ro(s);if(q&&Me(q)){let ne=z;ne.blockType=L,q.setFields(ne,!0)}},{tag:qo}),j(W),n||Ue(W._components?.customComponents?.BlockLabel??void 0),r||Ge(W._components?.customComponents?.Block??void 0)}})(),()=>{Yo(U)}},[y,A,N,d,n,r,l,I,s,F,c,u,_,g,L,M]);let[ft,Bo]=Xe.useState(p?.[l.id]?.collapsed??!1),{i18n:me,t:Ee}=Ru(),ht=Qo(async({formState:U,submit:ee})=>{Yo(T.current);let W=new AbortController;T.current=W;let{state:z}=await y({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:no(g,{excludeFiles:!0}),formState:U,globalSlug:u,initialBlockFormState:U,operation:"update",readOnly:!N,renderAllFields:!!ee,schemaPath:A,signal:W.signal});if(!z)return U;U.blockName&&(z.blockName=U.blockName);let q=Bn(An({fields:no(z,{excludeFiles:!0})}),!0);if(setTimeout(()=>{I.update(()=>{let ne=ro(s);if(ne&&Me(ne)){let We=q;We.blockType=L,ne.setFields(We,!0)}},{tag:qo})},0),ee){n||Ue(z._components?.customComponents?.BlockLabel??void 0),r||Ge(z._components?.customComponents?.Block??void 0);let ne=0;for(let We of Object.values(z))We?.valid===!1&&ne++;x(ne)}return z},[y,d,c,_,u,A,L,g,N,I,s,r,n]);er(()=>()=>{Yo(T.current)},[]);let Vt=Qo(()=>{I.update(()=>{ro(s)?.remove()})},[I,s]),Ne=M?.labels?.singular?pu(M.labels.singular,me):M?.slug,cn=Qo(U=>{_().then(ee=>{let z=ee?.fields?.[m.name]?.collapsed,q=z&&z?.length?z:[];U?q.includes(l.id)||q.push(l.id):q.includes(l.id)&&q.splice(q.indexOf(l.id),1),D(m.name,{collapsed:q,hello:"hi"})})},[_,m.name,D,l.id]),zt=ve(()=>()=>V(Fn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!N,el:"button",icon:"edit",onClick:U=>(U.preventDefault(),U.stopPropagation(),k(),!1),onMouseDown:U=>{U.preventDefault()},round:!0,size:"small",tooltip:Ee("lexical:blocks:inlineBlocks:edit",{label:Ne})}),[o,N,Ee,Ne,k]),Kt=ve(()=>()=>V(Fn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!N,icon:"x",onClick:U=>{U.preventDefault(),Vt()},round:!0,tooltip:"Remove Block"}),[o,N,Vt]),jo=ve(()=>({Actions:U,children:ee,className:W,collapsibleProps:z,disableBlockName:q,editButton:ne,errorCount:We,fieldHasErrors:Ho,Label:mn,Pill:pn,removeButton:xc})=>V("div",{className:`${o}__container ${o}-${L}`,children:V(fu,{className:[`${o}__row`,Ho?`${o}__row--has-errors`:`${o}__row--no-errors`,W].filter(Boolean).join(" "),collapsibleStyle:Ho?"error":"default",header:Et("div",{className:`${o}__block-header`,children:[typeof mn<"u"?mn:typeof Q<"u"?Q:Et("div",{className:`${o}__block-label`,children:[typeof pn<"u"?pn:V(_u,{className:`${o}__block-pill ${o}__block-pill-${L}`,pillStyle:"white",size:"small",children:Ne??L}),!q&&!M?.admin?.disableBlockName&&V(wu,{path:"blockName",readOnly:!N}),Ho&&V(xu,{count:We??0,i18n:me,withMessage:!0})]}),V("div",{className:`${o}__block-actions`,children:typeof U<"u"?U:Et(On,{children:[X&&ne!==!1||!X&&ne?V(zt,{}):null,xc!==!1&&N?V(Kt,{}):null]})})]}),isCollapsed:ft,onToggle:fn=>{cn(fn),Bo(fn)},...z||{},children:ee},0)}),[X,Q,zt,Kt,Ne,o,M?.admin?.disableBlockName,L,me,ft,cn,N]),un=l?.id,dn=ve(()=>()=>V(gu,{children:V(hu,{className:"",slug:C,title:Ee(`lexical:blocks:inlineBlocks:${un?"edit":"create"}`,{label:Ne??Ee("lexical:blocks:inlineBlocks:label")}),children:F?Et(On,{children:[V(Tu,{fields:M?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:A,permissions:!0,readOnly:!N}),V(ku,{programmaticSubmit:!0,children:Ee("fields:saveChanges")})]}):null})}),[F,C,un,Ne,Ee,N,M?.fields,A]),gc=ve(()=>F?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(Cu,{beforeSubmit:[async({formState:U})=>await ht({formState:U,submit:!0})],el:"div",fields:M?.fields??[],initialState:F,onChange:[ht],onSubmit:(U,ee)=>{ee.blockType=L,I.update(()=>{let W=ro(s);W&&Me(W)&&W.setFields(ee,!0)},{tag:qo}),k()},submitted:i,uuid:He,children:V(Dn,{baseClass:o,BlockDrawer:dn,Collapsible:jo,CustomBlock:X,CustomLabel:Q,EditButton:zt,errorCount:S,formSchema:M?.fields??[],initialState:F,nodeKey:s,RemoveButton:Kt})})}):null,[jo,dn,X,Q,L,C,Kt,zt,o,I,S,k,M?.fields,He,F,s,ht,i]);return M?gc:V(jo,{disableBlockName:!0,fieldHasErrors:!0,children:Et("div",{className:`${o}-not-found`,children:["Error: Block '",L,"' not found in the config but exists in the lexical data"]})})};var se=class extends St{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=$e(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return vu(jn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function $e(t){return $u(new se({fields:{...t,id:t?.id||new Mu.default().toHexString()}}))}function Me(t){return t instanceof se}import{createHeadlessEditor as Du}from"@lexical/headless";function or(t,e){return({editorState:r})=>{let n=Du({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return n.getEditorState().read(()=>{l=Xt(e)}),l}}import{createHeadlessEditor as Au}from"@lexical/headless";function lo(t,e){return({markdown:r})=>{let n=Au({nodes:t});return n.update(()=>{Jt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Ou(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Gn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Un(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Un(r,!0);n&&(o=o.concat(n))}return o};function Un(t,e){if(!t.jsx)return null;let o=Ou(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[gt],export:s=>{if(!Ct(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${u?" "+wt({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+wt({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=to({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=to({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=lo(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?eo({propsString:c}):{}});if(a===!1)return;let m=xt({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:s=>{if(!Me(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
11
11
  `))for(let h of m.split(`
12
12
  `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
13
13
  `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
- `;return`<${i.blockType}${u?" "+St({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+St({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:p,beforeStartLine:h,content:f,endLineIndex:g,propsString:T}=oo({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=f.endsWith(`
14
+ `;return`<${i.blockType}${u?" "+wt({props:a}):""}>
15
+ ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+wt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:p,beforeStartLine:h,content:f,endLineIndex:g,propsString:T}=to({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=f.endsWith(`
16
16
  `)?f.slice(0,-1):f;else if(f.includes(`
17
17
  `)){let C=f.split(`
18
18
  `),k=0;for(let _ of C){if(k++,_.startsWith(" "))E+=_.slice(2);else if(_==="")E+=_;else{E=f.endsWith(`
19
19
  `)?f.slice(0,-1):f;break}E+=k===C.length?"":`
20
20
  `}}else E=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,d];let S=io(n,l),x=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:T?to({propsString:T}):{}});if(x===!1)return[!1,d];let b=Fe({blockType:t.slug,...x});if(b){let C=null,k=null;if(h?.length){C=S({markdown:h})?.root?.children??[];let _=C?.[0];_&&i.append(Hn(_))}if(i.append(b),p?.length){k=S({markdown:p})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],$=Hn(k[0])?.getChildren();if($?.length)for(let v of $)_.append(v)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,c,u)=>{if(t?.jsx?.import){if(!u){let g="";if(i)for(let T of i)g+=T.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
21
+ `;if(!t?.jsx?.import)return[!1,d];let S=lo(n,l),x=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:T?eo({propsString:T}):{}});if(x===!1)return[!1,d];let b=$e({blockType:t.slug,...x});if(b){let C=null,k=null;if(h?.length){C=S({markdown:h})?.root?.children??[];let _=C?.[0];_&&i.append(Hn(_))}if(i.append(b),p?.length){k=S({markdown:p})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],D=Hn(k[0])?.getChildren();if(D?.length)for(let I of D)_.append(I)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,c,u)=>{if(t?.jsx?.import){if(!u){let g="";if(i)for(let T of i)g+=T.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
22
22
  `):a=u.join(`
23
- `).trim();let m=d[1]?.trim(),p=io(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?to({propsString:m}):{}});if(h===!1)return!1;let f=Fe({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Wn}from"lexical";var qe=Wn("INSERT_BLOCK_COMMAND"),Qe=Wn("INSERT_INLINE_BLOCK_COMMAND");import{c as Fu}from"react/compiler-runtime";import{useLexicalComposerContext as Pu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bu,$wrapNodeInElement as ju,mergeRegister as Hu}from"@lexical/utils";import{formatDrawerSlug as Uu,useEditDepth as Gu}from"@payloadcms/ui";import{$createParagraphNode as Wu,$getNodeByKey as Vu,$getPreviousSelection as zu,$getSelection as Ku,$insertNodes as Ju,$isParagraphNode as Xu,$isRangeSelection as Zu,$isRootOrShadowRoot as Yu,COMMAND_PRIORITY_EDITOR as Vn}from"lexical";import{useEffect as qu,useState as Qu}from"react";var zn=()=>{let t=Fu(12),[e]=Pu(),[o,r]=Qu(null),{setCreatedInlineBlock:n,uuid:l}=G(),s=Gu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Uu({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Hu(e.registerCommand(qe,p=>(e.update(()=>{let h=Ku()||zu();if(Zu(h)){let f=Fe(p),{focus:g}=h,T=g.getNode();Bu(f),Xu(T)&&!T.__first&&T.remove()}}),!0),Vn),e.registerCommand(Qe,p=>{if(o){let f=Vu(o);return!f||!bt(f)?!1:(f.setFields(p),r(null),!0)}let h=Ct(p);return n?.(h),Ju([h]),Yu(h.getParentOrThrow())&&ju(h,Wu).selectEnd(),!0},Vn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],qu(a,m),null};var ed=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:Gn({blocks:c,inlineBlocks:u}),nodes:[se,xt],plugins:[{Component:zn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:eo(a,qt),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?so(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Qt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?so(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Qe,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:qt,items:c.map((a,m)=>({ChildComponent:eo(a,qt),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?so(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(qe,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Qt,items:u.map((a,m)=>({ChildComponent:eo(a,Qt),isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?so(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Qe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as rd}from"react/compiler-runtime";import{jsx as Be,jsxs as ir}from"react/jsx-runtime";import{useLexicalComposerContext as nd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ld,$createTextNode as id,$getRoot as sd,getDOMSelection as rr}from"lexical";import*as Yn from"react";import{useCallback as Pe,useEffect as nr,useLayoutEffect as Jn,useRef as lr,useState as ao}from"react";var td=ne&&"documentMode"in document?document.documentMode:null,Kn=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),t6=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),o6=ne&&"InputEvent"in window&&!td?"getTargetRanges"in new window.InputEvent("input"):!1,r6=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),n6=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,l6=ne&&/Android/.test(navigator.userAgent),i6=ne&&/Win/.test(navigator.platform),od=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),s6=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!od;var ad=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},cd=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ud=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
23
+ `).trim();let m=d[1]?.trim(),p=lo(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?eo({propsString:m}):{}});if(h===!1)return!1;let f=$e({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Wn}from"lexical";var Ze=Wn("INSERT_BLOCK_COMMAND"),Ye=Wn("INSERT_INLINE_BLOCK_COMMAND");import{c as Fu}from"react/compiler-runtime";import{useLexicalComposerContext as Pu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bu,$wrapNodeInElement as ju,mergeRegister as Hu}from"@lexical/utils";import{formatDrawerSlug as Uu,useEditDepth as Gu}from"@payloadcms/ui";import{$createParagraphNode as Wu,$getNodeByKey as Vu,$getPreviousSelection as zu,$getSelection as Ku,$insertNodes as Ju,$isParagraphNode as Xu,$isRangeSelection as Zu,$isRootOrShadowRoot as Yu,COMMAND_PRIORITY_EDITOR as Vn}from"lexical";import{useEffect as qu,useState as Qu}from"react";var zn=()=>{let t=Fu(12),[e]=Pu(),[o,r]=Qu(null),{setCreatedInlineBlock:n,uuid:l}=G(),s=Gu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Uu({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=pe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Hu(e.registerCommand(Ze,p=>(e.update(()=>{let h=Ku()||zu();if(Zu(h)){let f=$e(p),{focus:g}=h,T=g.getNode();Bu(f),Xu(T)&&!T.__first&&T.remove()}}),!0),Vn),e.registerCommand(Ye,p=>{if(o){let f=Vu(o);return!f||!Ct(f)?!1:(f.setFields(p),r(null),!0)}let h=xt(p);return n?.(h),Ju([h]),Yu(h.getParentOrThrow())&&ju(h,Wu).selectEnd(),!0},Vn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],qu(a,m),null};var ed=v(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:Gn({blocks:c,inlineBlocks:u}),nodes:[se,gt],plugins:[{Component:zn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Qt(a,Yt),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?io(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ze,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:qt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?io(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ye,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Yt,items:c.map((a,m)=>({ChildComponent:Qt(a,Yt),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?io(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ze,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:qt,items:u.map((a,m)=>({ChildComponent:Qt(a,qt),isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?io(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ye,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as rd}from"react/compiler-runtime";import{jsx as Ae,jsxs as ir}from"react/jsx-runtime";import{useLexicalComposerContext as nd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ld,$createTextNode as id,$getRoot as sd,getDOMSelection as rr}from"lexical";import*as Yn from"react";import{useCallback as De,useEffect as nr,useLayoutEffect as Jn,useRef as lr,useState as so}from"react";var td=le&&"documentMode"in document?document.documentMode:null,Kn=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),t6=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),o6=le&&"InputEvent"in window&&!td?"getTargetRanges"in new window.InputEvent("input"):!1,r6=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),n6=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,l6=le&&/Android/.test(navigator.userAgent),i6=le&&/Win/.test(navigator.platform),od=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),s6=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!od;var ad=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},cd=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ud=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${n.anchorPath.toString()}],
26
26
  anchorOffset: ${n.anchorOffset},
@@ -30,7 +30,7 @@ ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+St({props:a}):""}/>`},handl
30
30
  `;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
31
31
  `);default:return` await repeat(${t.count}, async () => {
32
32
  ${o}
33
- );`}};function dd(t){return t.key.toLowerCase()==="a"&&(Kn?t.metaKey:t.ctrlKey)}function md(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function Xn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Zn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function pd(t){let[e,o]=ao([]),[r,n]=ao(!1),[,l]=ao(""),[s,i]=ao(""),d=lr(null),c=lr(!1),u=lr(null),a=Pe(()=>t,[t]),m=Pe(()=>{let x=t.getRootElement(),b=rr(t._window);return x==null||b==null||b.anchorNode==null||b.focusNode==null||!x.contains(b.anchorNode)||!x.contains(b.focusNode)?null:`
33
+ );`}};function dd(t){return t.key.toLowerCase()==="a"&&(Kn?t.metaKey:t.ctrlKey)}function md(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function Xn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Zn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function pd(t){let[e,o]=so([]),[r,n]=so(!1),[,l]=so(""),[s,i]=so(""),d=lr(null),c=lr(!1),u=lr(null),a=De(()=>t,[t]),m=De(()=>{let x=t.getRootElement(),b=rr(t._window);return x==null||b==null||b.anchorNode==null||b.focusNode==null||!x.contains(b.anchorNode)||!x.contains(b.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -51,16 +51,16 @@ ${e.map(ud).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=Pe((x,b)=>{o(C=>{let k=e.length-1,_=e[k];if(_&&_.name===x){if(x==="type")return[...e.slice(0,k),{..._,value:_.value+b}];if(_.value===b)return[...e.slice(0,k),{..._,count:_.count+1}]}return[...C,{name:x,count:1,value:b}]})},[e,o]);Jn(()=>{let x=C=>{if(!r)return;let k=C.key;dd(C)?p("selectAll",""):Zn.has(k)?p("press",C.key):[...k].length>1?p("keydown",C.key):p("type",C.key)},b=C=>{if(!r)return;let k=C.key;!Zn.has(k)&&[...k].length>1&&p("keyup",C.key)};return t.registerRootListener((C,k)=>{k!==null&&(k.removeEventListener("keydown",x),k.removeEventListener("keyup",b)),C!==null&&(C.addEventListener("keydown",x),C.addEventListener("keyup",b))})},[t,r,p]),Jn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),nr(()=>{if(e){let x=m();x!==null&&i(x),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),nr(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:C,editorState:k})=>{if(!r)return;let _=k._selection,$=d.current,v=c.current;if($!==_){if(C.size===0&&b.size===0&&!v){let L=rr(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=_}c.current=!1;let N=m();N!==null&&i(N)}),[t,m,r,p]),nr(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,r]);let h=Pe(x=>{r||(x.update(()=>{let b=sd();b.clear();let C=id();b.append(ld().append(C)),C.select()}),o([])),n(b=>!b)},[r]),f=Pe(()=>{if(!r)return;let x=rr(t._window);if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:b,anchorOffset:C,focusNode:k,focusOffset:_}=md(x),$=a().getRootElement(),v;b!==null&&(v=Xn(b,$));let N;k!==null&&(N=Xn(k,$)),p("snapshot",{anchorNode:b,anchorOffset:C,anchorPath:v,focusNode:k,focusOffset:_,focusPath:N})},[p,r,a]),g=Pe(()=>{ad(m())},[m]),T=Pe(()=>{cd("test.js",m())},[m]);return[Be("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{h(a()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ir("div",{className:"test-recorder-output",children:[ir("div",{className:"test-recorder-toolbar",children:[Be("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{f(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{T(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Be("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var qn=()=>{let t=rd(3),[e]=nd(),[o,r]=pd(e),n;return t[0]!==o||t[1]!==r?(n=ir(Yn.Fragment,{children:[Be("p",{children:"HI"}),o,r,Be("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var fd=M({plugins:[{Component:qn,position:"bottom"}]});import{c as hd}from"react/compiler-runtime";import{jsx as gd}from"react/jsx-runtime";import{useLexicalComposerContext as xd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Cd}from"@lexical/react/LexicalTreeView.js";import"react";var Qn=()=>{let t=hd(2),[e]=xd(),o;return t[0]!==e?(o=gd(Cd,{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 bd=M({plugins:[{Component:Qn,position:"bottom"}]});import{$isTableSelection as kd}from"@lexical/table";import{$isRangeSelection as _d,FORMAT_TEXT_COMMAND as Td}from"lexical";import{jsx as el}from"react/jsx-runtime";import"react";var tl=()=>el("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:el("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 Z=t=>({type:"buttons",items:t,key:"format",order:40});var ol={type:"text-format",format:["bold","italic"],tag:"***"},rl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},nl={type:"text-format",format:["bold"],tag:"**"},ll={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var il=[Z([{ChildComponent:tl,isActive:({selection:t})=>_d(t)||kd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Td,"bold")},order:1}])],wd=M(({featureProviderMap:t})=>{let e=[nl,ll];return t.get("italic")&&e.push(rl,ol),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:il},toolbarInline:{groups:il}}});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Nd,FORMAT_TEXT_COMMAND as Ld}from"lexical";import{jsx as sl,jsxs as Sd}from"react/jsx-runtime";import"react";var al=()=>Sd("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:[sl("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),sl("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var cl={type:"text-format",format:["code"],tag:"`"};var ul=[Z([{ChildComponent:al,isActive:({selection:t})=>Nd(t)||Ed(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ld,"code")},order:7}])],yd=M({enableFormats:["code"],markdownTransformers:[cl],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as Rd}from"@lexical/table";import{$isRangeSelection as Id,FORMAT_TEXT_COMMAND as vd}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("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:dl("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 pl={type:"text-format",format:["italic"],tag:"*"},fl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var hl=[Z([{ChildComponent:ml,isActive:({selection:t})=>Id(t)||Rd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(vd,"italic")},order:2}])],Md=M({enableFormats:["italic"],markdownTransformers:[pl,fl],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as Ad,FORMAT_TEXT_COMMAND as Od}from"lexical";import{jsx as gl,jsxs as $d}from"react/jsx-runtime";import"react";var xl=()=>$d("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:[gl("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"}),gl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Cl={type:"text-format",format:["strikethrough"],tag:"~~"};var bl=[Z([{ChildComponent:xl,isActive:({selection:t})=>Ad(t)||Dd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Od,"strikethrough")},order:4}])],Fd=M({enableFormats:["strikethrough"],markdownTransformers:[Cl],toolbarFixed:{groups:bl},toolbarInline:{groups:bl}});import{$isTableSelection as Pd}from"@lexical/table";import{$isRangeSelection as Bd,FORMAT_TEXT_COMMAND as jd}from"lexical";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("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:kl("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 Tl=[Z([{ChildComponent:_l,isActive:({selection:t})=>Bd(t)||Pd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(jd,"subscript")},order:5}])],Hd=M({enableFormats:["subscript"],toolbarFixed:{groups:Tl},toolbarInline:{groups:Tl}});import{$isTableSelection as Ud}from"@lexical/table";import{$isRangeSelection as Gd,FORMAT_TEXT_COMMAND as Wd}from"lexical";import{jsx as wl}from"react/jsx-runtime";import"react";var Sl=()=>wl("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:wl("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 El=[Z([{ChildComponent:Sl,isActive:({selection:t})=>Gd(t)||Ud(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Wd,"superscript")},order:6}])],Vd=M({enableFormats:["superscript"],toolbarFixed:{groups:El},toolbarInline:{groups:El}});import{$isTableSelection as Kd}from"@lexical/table";import{$isRangeSelection as Jd,FORMAT_TEXT_COMMAND as Xd}from"lexical";import{jsx as Nl,jsxs as zd}from"react/jsx-runtime";import"react";var Ll=()=>zd("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:[Nl("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"}),Nl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var yl=[Z([{ChildComponent:Ll,isActive:({selection:t})=>Jd(t)||Kd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Xd,"underline")},order:3}])],Zd=M({enableFormats:["underline"],toolbarFixed:{groups:yl},toolbarInline:{groups:yl}});import{jsx as ar}from"react/jsx-runtime";import{jsx as Yd}from"react/jsx-runtime";function qd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var co=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[qd(o),r])):{};return Yd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as em}from"@lexical/selection";import{$getNodeByKey as tm,$getState as om,$setState as rm,createState as nm,TextNode as lm}from"lexical";import{useEffect as im}from"react";function Rl(t){let e=new Map;for(let o in t){let r=t[o],n=nm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function sr(t,e,o,r){t.update(()=>{em(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);rm(n,l.stateConfig,r)})})}function Il({stateMap:t}){let[e]=Qd();return im(()=>e.registerMutationListener(lm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=tm(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=om(l,d.stateConfig);if(!u){delete s.dataset[c];return}s.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var vl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let s in l){let i=l[s];o.push({ChildComponent:()=>ar(co,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{sr(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>ar(co,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>ar(co,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)sr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},sm=M(({props:t})=>{let e=Rl(t.state);return{plugins:[{Component:()=>Il({stateMap:e}),position:"normal"}],toolbarFixed:{groups:vl(t,e)},toolbarInline:{groups:vl(t,e)}}});import{c as dm}from"react/compiler-runtime";import{useLexicalComposerContext as mm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as pm,$isHeadingNode as Vl,HeadingNode as Jl}from"@lexical/rich-text";import{$setBlocksType as fm}from"@lexical/selection";import{$getSelection as hm,$isRangeSelection as gm}from"lexical";import{useEffect as xm}from"react";import{jsx as Ml}from"react/jsx-runtime";import"react";var $l=()=>Ml("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:Ml("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 Dl}from"react/jsx-runtime";import"react";var Al=()=>Dl("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:Dl("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 Ol}from"react/jsx-runtime";import"react";var Fl=()=>Ol("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:Ol("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 Pl}from"react/jsx-runtime";import"react";var Bl=()=>Pl("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:Pl("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 jl}from"react/jsx-runtime";import"react";var Hl=()=>jl("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:jl("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 Ul}from"react/jsx-runtime";import"react";var Gl=()=>Ul("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:Ul("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 am,$isHeadingNode as cm,HeadingNode as um}from"@lexical/rich-text";var cr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Wl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[um],export:(n,l)=>{if(!cm(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:cr(n=>{let l="h"+n[1]?.length;return am(l)})}};var zl=t=>{let e=hm();fm(e,()=>pm(t))},Kl={h1:$l,h2:Al,h3:Fl,h4:Bl,h5:Hl,h6:Gl},Cm=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Kl[r],isActive:({selection:l})=>{if(!gm(l))return!1;for(let s of l.getNodes()){if(Vl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Vl(i)&&i.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{zl(r)})},order:n+2})))];return{markdownTransformers:[Wl(e)],nodes:[Jl],plugins:[{Component:bm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(r=>({Icon:Kl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{zl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),bm=t=>{let e=dm(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=mm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Jl,a=>{l.includes(a.getTag())||a.setTag(i)})},u=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=c,e[8]=u):(c=e[7],u=e[8]),xm(c,u),null};import{$isNodeSelection as Am}from"lexical";import{jsx as Xl}from"react/jsx-runtime";import"react";var ur=()=>Xl("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:Xl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Zl,jsxs as km}from"react/jsx-runtime";import"react";var Yl=()=>km("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Zl("path",{d:"M5 10h10",stroke:"currentColor"}),Zl("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Yl,items:t,key:"add",order:10});import{addClassNamesToElement as _m}from"@lexical/utils";import{$applyNodeReplacement as Tm,createCommand as wm,DecoratorNode as Sm}from"lexical";var yt=wm("INSERT_HORIZONTAL_RULE_COMMAND"),Lt=class extends Sm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Em,priority:0})}}static importJSON(e){return ql()}createDOM(e){let o=document.createElement("hr");return _m(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function Em(){return{node:ql()}}function ql(){return Tm(new Lt)}import{$applyNodeReplacement as Nm}from"lexical";import"react";var Ce=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return et()}decorate(){return null}exportJSON(){return super.exportJSON()}};function et(){return Nm(new Ce)}function Rt(t){return t instanceof Ce}var Ql={type:"element",dependencies:[Ce],export:(t,e)=>Rt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=et();e&&t.replace(e)}};import{c as Lm}from"react/compiler-runtime";import{useLexicalComposerContext as ym}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rm}from"@lexical/utils";import{$getSelection as Im,$isRangeSelection as vm,COMMAND_PRIORITY_EDITOR as Mm}from"lexical";import{useEffect as $m}from"react";var ei=()=>{let t=Lm(3),[e]=ym(),o,r;return t[0]!==e?(o=()=>e.registerCommand(yt,Dm,Mm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$m(o,r),null};function Dm(t){let e=Im();if(!vm(e))return!1;if(e.focus.getNode()!==null){let r=et();Rm(r)}return!0}var Om=M({markdownTransformers:[Ql],nodes:[Ce],plugins:[{Component:ei,position:"normal"}],slashMenu:{groups:[X([{Icon:ur,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:ur,isActive:({selection:t})=>{if(!Am(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Rt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]}});import{$findMatchingParent as ui}from"@lexical/utils";import{$isElementNode as Xm,INDENT_CONTENT_COMMAND as Zm,OUTDENT_CONTENT_COMMAND as Ym}from"lexical";import{jsx as uo,jsxs as Fm}from"react/jsx-runtime";import"react";var ti=()=>Fm("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:[uo("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as mo,jsxs as Pm}from"react/jsx-runtime";import"react";var oi=()=>Pm("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:[mo("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Bm}from"react/jsx-runtime";import{useLexicalComposerContext as jm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Hm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Um,mergeRegister as ri}from"@lexical/utils";import{$getSelection as Gm,$isElementNode as si,$isRangeSelection as Wm,COMMAND_PRIORITY_LOW as ni,INDENT_CONTENT_COMMAND as li,KEY_TAB_COMMAND as Vm,OUTDENT_CONTENT_COMMAND as zm,TabNode as Km}from"lexical";import{useEffect as ii}from"react";var ai=({clientProps:t})=>{let[e]=jm(),{disabledNodes:o,disableTabNode:r}=t;return ii(()=>{if(!(!e||!o?.length))return ri(e.registerCommand(li,()=>Jm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),ni),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);si(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ii(()=>{if(!(!e||!r))return ri(e.registerCommand(Vm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?zm:li,void 0)),ni),e.registerNodeTransform(Km,n=>{n.remove()}))},[e,r]),Bm(Hm,{})};function Jm(t){let e=Gm();if(!Wm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],s=l.getKey();if(o.has(s))continue;let i=Um(l,c=>si(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var ci=t=>({type:"buttons",items:t,key:"indent",order:35});var di=({disabledNodes:t})=>[ci([{ChildComponent:ti,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ui(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ym,void 0)},order:1},{ChildComponent:oi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ui(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Zm,void 0)},order:2}])],qm=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ai,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:di({disabledNodes:e})},toolbarInline:{groups:di({disabledNodes:e})}}}),mi=t=>Xm(t)&&t.canIndent();import{$findMatchingParent as gf}from"@lexical/utils";import{$getSelection as _r,$isRangeSelection as Gi}from"lexical";import{jsx as pi}from"react/jsx-runtime";import"react";var fi=()=>pi("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:pi("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 hi}from"@lexical/selection";function tt(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?hi(o)?r:n:hi(e)?r:n}var dr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as dp}from"lexical";function mr(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var Qm=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,ep=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function gi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Qm.test(t)||ep.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as tp,isHTMLAnchorElement as op}from"@lexical/utils";import hr from"bson-objectid";import{$applyNodeReplacement as rp,$createTextNode as xi,$getSelection as np,$isElementNode as Ci,$isRangeSelection as fr,createCommand as lp,ElementNode as ip}from"lexical";var sp=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends ip{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ap,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return 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 hr.default().toHexString(),e.version=3),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=pr(o.rel,"add","noopener")),tp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!fr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ci(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!sp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=pr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=pr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function ap(t){let e=null;if(op(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new hr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return rp(new te({id:t??new hr.default().toHexString(),fields:e}))}function K(t){return t instanceof te}var ue=lp("TOGGLE_LINK_COMMAND");function gr(t){let e=np();if(!fr(e)&&(t===null||!t.selectedNodes?.length))return;let o=fr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:cp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let s=l.getParent();if(!(s===n||s===null||Ci(l)&&!l.isInline())){if(K(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=be({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let i=l.getChildren();n.append(...i)}l.remove();return}n!==null&&n.append(l)}})}function cp(t){return up(t,e=>K(e))}function up(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function pr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var mp=(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=dp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},pp=t=>({type:"text-match",dependencies:[te],export:(e,o)=>{if(!K(e))return null;let r=e,n=r.getFields(),l;return n.linkType==="internal"?t?.internalDocToHref?l=mr(t.internalDocToHref({linkNode:r.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=mr(n.url??""),`[${o(r)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:mp,trigger:")"}),bi=pp();import{$applyNodeReplacement as fp,$isElementNode as hp}from"lexical";var ke=class extends te{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=It({}).updateFromJSON(e);return 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),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 r=this.getParentOrThrow().insertNewAfter(e,o);if(hp(r)){let n=It({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function It({fields:t}){return fp(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as gp}from"react/compiler-runtime";import{useLexicalComposerContext as xp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cp}from"@lexical/utils";import{$createTextNode as ki,$getSelection as bp,$isElementNode as Ti,$isLineBreakNode as wi,$isNodeSelection as kp,$isRangeSelection as _p,$isTextNode as vt,TextNode as Tp}from"lexical";import{useEffect as wp}from"react";function _i(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Si(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Sp=/[.,;\s]/;function fo(t){return t!==void 0&&Sp.test(t)}function Ei(t){return fo(t[t.length-1])}function Cr(t){return fo(t[0])}function Ep(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ni(t){let e=t.getPreviousSibling();return Ti(e)&&(e=e.getLastDescendant()),e===null||wi(e)||vt(e)&&Ei(e.getTextContent())}function Li(t){let e=t.getNextSibling();return Ti(e)&&(e=e.getFirstDescendant()),e===null||wi(e)||vt(e)&&Cr(e.getTextContent())}function Np(t,e,o,r){return(t>0?fo(o[t-1]):Ni(r[0]))?e<o.length?fo(o[e]):Li(r[r.length-1]):!1}function Lp(t,e,o){let r=[],n=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(r.push(c),s+=a):m>=o?l.push(c):n.push(c),i+=a,d.shift()}return[s,r,n,l]}function yp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=It({fields:n});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=ki(r.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,T]=a.splitText(o-h);g&&c.push(g),u=T}i+=p}),d){let a=bp(),m=a?a.getNodes().find(vt):void 0,p=ki(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(_p(a)?p.select(a.anchor.offset,a.focus.offset):kp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Rp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=Si(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if(Np(i+d,i+u,n,r)){let[m,,p,h]=Lp(r,i+d,i+u),f=i+d-m,g=i+u-m,T=yp(p,f,g,s);r=T?[T,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function xr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!vt(c)||!c.isSimpleText()){po(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Si(l,e);if(s===null||s.text!==l){po(t),o(null,t.getFields()?.url??null);return}if(!Ni(t)||!Li(t)){po(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Ip(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Cr(l)||Ep(l,s))&&(r.append(t),xr(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!Ei(l)&&(po(n),xr(n,e,o),o(null,n.getFields()?.url??null))}function po(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function vp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&vt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Mp(t,e,o){let r=gp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Cp(t.registerNodeTransform(Tp,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(_e(d))xr(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(Cr(i.getTextContent())||!_e(c))){let u=vp(i);Rp(u,e,s)}Ip(i,e,s)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),wp(n,l)}var $p=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Dp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ap=[_i($p,t=>t.startsWith("http")?t:`https://${t}`),_i(Dp,t=>`mailto:${t}`)],yi=()=>{let[t]=xp();return Mp(t,Ap),null};import{jsx as Op}from"react/jsx-runtime";import{ClickableLinkPlugin as Fp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ri=()=>Op(Fp,{});import{jsx as nf}from"react/jsx-runtime";import"react";import{createPortal as lf}from"react-dom";import{jsx as Te,jsxs as Mt,Fragment as Bp}from"react/jsx-runtime";import{useLexicalComposerContext as jp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Hp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Ii,mergeRegister as vi}from"@lexical/utils";import{getTranslation as br}from"@payloadcms/translations";import{CloseMenuIcon as Up,EditIcon as Gp,ExternalLinkIcon as Mi,formatDrawerSlug as Wp,useConfig as Vp,useEditDepth as zp,useLocale as Kp,useModal as Jp,useTranslation as Xp}from"@payloadcms/ui";import{requests as Zp}from"@payloadcms/ui/shared";import{$getSelection as $i,$isLineBreakNode as Yp,$isRangeSelection as Di,COMMAND_PRIORITY_HIGH as qp,COMMAND_PRIORITY_LOW as Ai,getDOMSelection as Qp,KEY_ESCAPE_COMMAND as ef,SELECTION_CHANGE_COMMAND as tf}from"lexical";import{formatAdminURL as of}from"payload/shared";import Oi,{useCallback as Fi,useEffect as xo,useLayoutEffect as rf,useRef as kr,useState as je}from"react";function ho(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-r,c=t.left-n;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(u<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,T=Math.min(u,f?h:a);T<u&&(e.style.width=`${T}px`,e.style.maxWidth=`${T}px`,e.offsetHeight),f&&(c=t.right-T),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+r*2),c+p.width>i.right&&(c=i.right-p.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Pp}from"lexical";var go=Pp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Pi(t){t.preventDefault()}function Bi({anchorElem:t}){let[e]=jp(),[o,r]=je(),n=kr(null),l=kr(null),[s,i]=je(null),[d,c]=je(null),{fieldProps:{schemaPath:u},uuid:a}=G(),m=Hp(),{config:p,getEntityConfig:h}=Vp(),{i18n:f,t:g}=Xp(),[T,E]=je(),S=zp(),[x,b]=je(!1),[C,k]=je([]),_=Kp(),[$,v]=je(!1),N=Wp({slug:"lexical-rich-text-link-"+a,depth:S}),{modalState:L}=Jp(),w=kr(!1);w.current=!!L[N]?.isOpen;let{toggleDrawer:y}=fe(N),I=Fi(()=>{b(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),v(!1),w.current||(i(null),c(null),k([]),E(void 0))},[]),D=Fi(()=>{let R=$i(),A;if(!Di(R)||!R){I();return}let H=tt(R);A=e.getElementByKey(H.getKey())?.getBoundingClientRect();let B=Ii(H,K),J=R.getNodes().filter(ie=>!Yp(ie)).find(ie=>{let Le=Ii(ie,K);return B&&!B.is(Le)||Le&&!Le.is(B)});if(B==null||J){I();return}r(B);let F=B.getFields(),Ve={...F,id:B.getID(),text:B.getTextContent()};if(F?.linkType==="custom")i(F?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${F?.doc?.relationTo}/${F?.doc?.value}`);let ie=F?.doc?.relationTo?h({collectionSlug:F?.doc?.relationTo}):void 0;if(!ie)c(F?.label?String(F?.label):null),i(F?.url?String(F?.url):null);else{let Le=typeof F.doc?.value=="object"?F.doc.value.id:F.doc?.value,ye=F.doc?.relationTo;if(!Le||!ye)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let q=g("fields:linkedTo",{label:`${br(ie.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(q),Zp.get(of({apiRoute:p.routes.api,path:`/${ye}/${Le}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:_?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let Re=await pe.json(),gt=ie?.admin?.useAsTitle||"id",zt=Re[gt],Ie=g("fields:linkedTo",{label:`${br(ie.labels.singular,f)} - ${zt}`}).replace(/<[^>]*>?/g,"");c(Ie)}).catch(()=>{let pe=g("fields:linkedTo",{label:`${br(ie.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Le}`}).replace(/<[^>]*>?/g,"");c(pe)})}}b(!0),w.current||(E(Ve),k(R?R?.getNodes():[])),_e(B)?v(!0):v(!1);let Ne=n.current,me=Qp(e._window),{activeElement:ft}=document;if(Ne===null)return;let ht=e.getRootElement();return me!==null&&ht!==null&&ht.contains(me.anchorNode)?(A||(A=me.getRangeAt(0).getBoundingClientRect()),A!=null&&(A.y+=40,l.current=A)):(ft==null||ft.className!=="link-input")&&(ht!==null&&ho(null,Ne,t),i(null),c(null)),!0},[e,I,p.routes.admin,p.routes.api,p.serverURL,h,g,f,_?.code,t]);return xo(()=>vi(e.registerCommand(go,R=>(e.dispatchCommand(ue,R),D(),y(),!0),Ai)),[e,D,y,N]),xo(()=>{let R=t.parentElement,A=()=>{e.getEditorState().read(()=>{D()})};return window.addEventListener("resize",A),R?.addEventListener("scroll",A),()=>{window.removeEventListener("resize",A),R?.removeEventListener("scroll",A)}},[t.parentElement,e,D]),xo(()=>vi(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{D()})}),e.registerCommand(tf,()=>(D(),!0),Ai),e.registerCommand(ef,()=>x?(I(),!0):!1,qp)),[e,D,x,I]),xo(()=>{e.getEditorState().read(()=>{D()})},[e,D]),rf(()=>{!x||!n.current||!t||!l.current||ho(l.current,n.current,t)},[s,d,x,t,o]),Mt(Oi.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Mt("div",{className:"link-input",children:[s&&s.length>0?Mt("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(Mi,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?Mt(Bp,{children:[o?.__fields.newTab?Te(Mi,{}):null,Te("span",{className:"link-input__label-pure",children:d})]}):null,m&&Mt(Oi.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:R=>{R.preventDefault(),y()},onMouseDown:Pi,tabIndex:0,type:"button",children:Te(Gp,{})}),!$&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:Pi,tabIndex:0,type:"button",children:Te(Up,{})})]})]})}),Te(kt,{className:"lexical-link-edit-drawer",data:T,drawerSlug:N,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,A)=>{let H=A,B={...H};delete B.text,e.update(()=>{let J=$i(),F=null;if(Di(J)?F=tt(J).getParent():C.length&&(F=C[0]?.getParent()??null),F&&_e(F)){let Ve=be({fields:B});F.replace(Ve,!0)}}),e.dispatchCommand(ue,{fields:B,selectedNodes:C,text:H.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var ji=t=>{let{anchorElem:e=document.body}=t;return lf(nf(Bi,{anchorElem:e}),e)};import{c as sf}from"react/compiler-runtime";import{useLexicalComposerContext as af}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as cf}from"@lexical/utils";import{$getSelection as uf,$isElementNode as df,$isRangeSelection as mf,COMMAND_PRIORITY_LOW as Hi,PASTE_COMMAND as pf}from"lexical";import{useEffect as ff}from"react";var Ui=t=>{let e=sf(5),{clientProps:o}=t,[r]=af(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return cf(r.registerCommand(ue,s=>s===null?(gr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),gr(s),!0),Hi),r.registerCommand(pf,s=>{let i=uf();if(!mf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!gi(d))return!1;if(!i.getNodes().some(hf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ue,{fields:c,text:null}),s.preventDefault(),!0}return!1},Hi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),ff(n,l),null};function hf(t){return df(t)}var Wi=[dr([{ChildComponent:fi,isActive:({selection:t})=>{if(Gi(t)){let e=tt(t);return gf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Gi(t)&&_r()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ue,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=_r()?.getTextContent(),r=_r()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(go,{fields:n,selectedNodes:r,text:o})}},order:1}])],xf=M(({props:t})=>({markdownTransformers:[bi],nodes:[te,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ui,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:yi,position:"normal"},{Component:Ri,position:"normal"},{Component:ji,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}}));import{$isListNode as Sr,INSERT_CHECK_LIST_COMMAND as Zi,ListItemNode as Rf,ListNode as If}from"@lexical/list";import{$isRangeSelection as vf}from"lexical";import{jsx as Vi,jsxs as Cf}from"react/jsx-runtime";import"react";var Tr=()=>Cf("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:[Vi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Vi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bf}from"react/jsx-runtime";import{ListPlugin as kf}from"@lexical/react/LexicalListPlugin.js";import"react";var ot=()=>bf(kf,{});function Co(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function rt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Sf,ListItemNode as Ef,ListNode as Nf}from"@lexical/list";import{$createListItemNode as _f,$createListNode as Tf,$isListItemNode as wf,$isListNode as wr}from"@lexical/list";var zi=4,nt=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=_f(t==="check"?r[3]==="x":void 0);if(wr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(wr(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=Tf(t,t==="number"?Number(r[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(r[1].length/zi);i&&s.setIndent(i)},He=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(wf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(wr(u)){r.push(He(u,e,o+1));continue}}let i=" ".repeat(o*zi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+c+e(s)),l++}return r.join(`
56
- `)};var Ki={type:"element",dependencies:[Nf,Ef],export:(t,e)=>Sf(t)?He(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:nt("check")};import{jsx as Lf}from"react/jsx-runtime";import{CheckListPlugin as yf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ji=()=>Lf(yf,{});var Xi=[ee([{ChildComponent:Tr,isActive:({selection:t})=>{if(!vf(t))return!1;for(let e of t.getNodes()){if(Sr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Sr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Sr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Zi,void 0)},order:12}])],Mf=M(({featureProviderMap:t})=>{let e=[{Component:Ji,position:"normal"}],o=Co("checklist",t);return o&&e.push({Component:ot,position:"normal"}),{markdownTransformers:[Ki],nodes:o?[If,Rf]:[],plugins:e,slashMenu:{groups:[rt([{Icon:Tr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Zi,void 0)}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}}});import{$isListNode as Nr,INSERT_ORDERED_LIST_COMMAND as Qi,ListItemNode as Ff,ListNode as Pf}from"@lexical/list";import{$isRangeSelection as Bf}from"lexical";import{jsx as $t,jsxs as $f}from"react/jsx-runtime";import"react";var Er=()=>$f("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:[$t("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"}),$t("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"}),$t("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Df,ListItemNode as Af,ListNode as Of}from"@lexical/list";var Yi={type:"element",dependencies:[Of,Af],export:(t,e)=>Df(t)?He(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:nt("number")};var qi=[ee([{ChildComponent:Er,isActive:({selection:t})=>{if(!Bf(t))return!1;for(let e of t.getNodes()){if(Nr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Nr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Nr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qi,void 0)},order:10}])],jf=M(({featureProviderMap:t})=>{let e=Co("ordered",t);return{markdownTransformers:[Yi],nodes:e?[Pf,Ff]:[],plugins:e?[{Component:ot,position:"normal"}]:[],slashMenu:{groups:[rt([{Icon:Er,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Qi,void 0)}}])]},toolbarFixed:{groups:qi},toolbarInline:{groups:qi}}});import{$isListNode as yr,INSERT_UNORDERED_LIST_COMMAND as os,ListItemNode as Vf,ListNode as zf}from"@lexical/list";import{$isRangeSelection as Kf}from"lexical";import{jsx as lt,jsxs as Hf}from"react/jsx-runtime";import"react";var Lr=()=>Hf("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:[lt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Uf,ListItemNode as Gf,ListNode as Wf}from"@lexical/list";var es={type:"element",dependencies:[Wf,Gf],export:(t,e)=>Uf(t)?He(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:nt("bullet")};var ts=[ee([{ChildComponent:Lr,isActive:({selection:t})=>{if(!Kf(t))return!1;for(let e of t.getNodes()){if(yr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(yr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(yr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(os,void 0)},order:11}])],Jf=M({markdownTransformers:[es],nodes:[zf,Vf],plugins:[{Component:ot,position:"normal"}],slashMenu:{groups:[rt([{Icon:Lr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(os,void 0)}}])]},toolbarFixed:{groups:ts},toolbarInline:{groups:ts}});import{jsx as Xf}from"react/jsx-runtime";import{addClassNamesToElement as Zf}from"@lexical/utils";import{$applyNodeReplacement as Yf,DecoratorNode as qf}from"lexical";import*as rs from"react";var Qf=rs.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Dt=class extends qf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return e0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Zf(o,"unknownConverted"),o}decorate(){return Xf(Qf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function e0({data:t}){return Yf(new Dt({data:t}))}var t0=M(()=>({nodes:[Dt]}));import{jsx as o0}from"react/jsx-runtime";import{addClassNamesToElement as r0}from"@lexical/utils";import{$applyNodeReplacement as n0,DecoratorNode as l0}from"lexical";import*as ns from"react";var i0=ns.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),At=class extends l0{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return s0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return r0(o,"unknownConverted"),o}decorate(){return o0(i0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function s0({data:t}){return n0(new At({data:t}))}var a0=M(()=>({nodes:[At]}));import{$setBlocksType as ss}from"@lexical/selection";import{$createParagraphNode as as,$getSelection as cs,$isParagraphNode as ls,$isRangeSelection as c0}from"lexical";var is=[ee([{ChildComponent:wt,isActive:({selection:t})=>{if(!c0(t))return!1;for(let e of t.getNodes())if(!ls(e)&&!ls(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=cs();ss(e,()=>as())})},order:1}])],u0=M({slashMenu:{groups:[X([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=cs();ss(e,()=>as())})}}])]},toolbarFixed:{groups:is},toolbarInline:{groups:is}});import{c as $0}from"react/compiler-runtime";import{jsx as vs}from"react/jsx-runtime";import{useLexicalComposerContext as D0}from"@lexical/react/LexicalComposerContext";import{useEffect as A0,useState as O0}from"react";import{jsx as Is,Fragment as M0}from"react/jsx-runtime";import"react";import{jsx as d0}from"react/jsx-runtime";var us={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return d0("blockquote",{children:o})}};import{jsx as m0}from"react/jsx-runtime";var ds=new Set(["h1","h2","h3","h4","h5","h6"]);var ms={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=ds.has(t.tag)?t.tag:"h1";return m0(r,{children:o})}};import{jsx as p0}from"react/jsx-runtime";var ps={horizontalrule:p0("hr",{})};import{jsx as f0}from"react/jsx-runtime";var fs={linebreak:f0("br",{})};import{jsx as hs}from"react/jsx-runtime";var gs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return hs("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),hs("a",{href:s,rel:n,target:l,children:r})}});import{jsx as it,jsxs as h0,Fragment as g0}from"react/jsx-runtime";import{v4 as x0}from"uuid";var xs=new Set(["ol","ul"]);var Cs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=xs.has(t.tag)?t.tag:"ul";return it(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=x0();return it("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:h0(g0,{children:[it("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),it("label",{htmlFor:l,children:n}),it("br",{})]})})}else return it("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as Rr}from"react/jsx-runtime";var bs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Rr("p",{children:o}):Rr("p",{children:Rr("br",{})})}};var ks={tab:" "};import{jsx as Ot}from"react/jsx-runtime";var _s={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Ot("div",{className:"lexical-table-container",children:Ot("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Ot("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Ot(r,{className:`lexical-table-cell ${n}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Ot("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ue}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},C0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,b0="\xA0",k0=`
54
+ `},[t,e]),p=De((x,b)=>{o(C=>{let k=e.length-1,_=e[k];if(_&&_.name===x){if(x==="type")return[...e.slice(0,k),{..._,value:_.value+b}];if(_.value===b)return[...e.slice(0,k),{..._,count:_.count+1}]}return[...C,{name:x,count:1,value:b}]})},[e,o]);Jn(()=>{let x=C=>{if(!r)return;let k=C.key;dd(C)?p("selectAll",""):Zn.has(k)?p("press",C.key):[...k].length>1?p("keydown",C.key):p("type",C.key)},b=C=>{if(!r)return;let k=C.key;!Zn.has(k)&&[...k].length>1&&p("keyup",C.key)};return t.registerRootListener((C,k)=>{k!==null&&(k.removeEventListener("keydown",x),k.removeEventListener("keyup",b)),C!==null&&(C.addEventListener("keydown",x),C.addEventListener("keyup",b))})},[t,r,p]),Jn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),nr(()=>{if(e){let x=m();x!==null&&i(x),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),nr(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:C,editorState:k})=>{if(!r)return;let _=k._selection,D=d.current,I=c.current;if(D!==_){if(C.size===0&&b.size===0&&!I){let L=rr(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=_}c.current=!1;let N=m();N!==null&&i(N)}),[t,m,r,p]),nr(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,r]);let h=De(x=>{r||(x.update(()=>{let b=sd();b.clear();let C=id();b.append(ld().append(C)),C.select()}),o([])),n(b=>!b)},[r]),f=De(()=>{if(!r)return;let x=rr(t._window);if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:b,anchorOffset:C,focusNode:k,focusOffset:_}=md(x),D=a().getRootElement(),I;b!==null&&(I=Xn(b,D));let N;k!==null&&(N=Xn(k,D)),p("snapshot",{anchorNode:b,anchorOffset:C,anchorPath:I,focusNode:k,focusOffset:_,focusPath:N})},[p,r,a]),g=De(()=>{ad(m())},[m]),T=De(()=>{cd("test.js",m())},[m]);return[Ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{h(a()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ir("div",{className:"test-recorder-output",children:[ir("div",{className:"test-recorder-toolbar",children:[Ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{f(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{T(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ae("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var qn=()=>{let t=rd(3),[e]=nd(),[o,r]=pd(e),n;return t[0]!==o||t[1]!==r?(n=ir(Yn.Fragment,{children:[Ae("p",{children:"HI"}),o,r,Ae("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var fd=v({plugins:[{Component:qn,position:"bottom"}]});import{c as hd}from"react/compiler-runtime";import{jsx as gd}from"react/jsx-runtime";import{useLexicalComposerContext as xd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Cd}from"@lexical/react/LexicalTreeView.js";import"react";var Qn=()=>{let t=hd(2),[e]=xd(),o;return t[0]!==e?(o=gd(Cd,{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 bd=v({plugins:[{Component:Qn,position:"bottom"}]});import{$isTableSelection as kd}from"@lexical/table";import{$isRangeSelection as _d,FORMAT_TEXT_COMMAND as Td}from"lexical";import{jsx as el}from"react/jsx-runtime";import"react";var tl=()=>el("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:el("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 ol={type:"text-format",format:["bold","italic"],tag:"***"},rl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},nl={type:"text-format",format:["bold"],tag:"**"},ll={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var il=[Y([{ChildComponent:tl,isActive:({selection:t})=>_d(t)||kd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Td,"bold")},order:1}])],wd=v(({featureProviderMap:t})=>{let e=[nl,ll];return t.get("italic")&&e.push(rl,ol),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:il},toolbarInline:{groups:il}}});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Nd,FORMAT_TEXT_COMMAND as Ld}from"lexical";import{jsx as sl,jsxs as Sd}from"react/jsx-runtime";import"react";var al=()=>Sd("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:[sl("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),sl("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var cl={type:"text-format",format:["code"],tag:"`"};var ul=[Y([{ChildComponent:al,isActive:({selection:t})=>Nd(t)||Ed(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ld,"code")},order:7}])],yd=v({enableFormats:["code"],markdownTransformers:[cl],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as Rd}from"@lexical/table";import{$isRangeSelection as Id,FORMAT_TEXT_COMMAND as vd}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("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:dl("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 pl={type:"text-format",format:["italic"],tag:"*"},fl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var hl=[Y([{ChildComponent:ml,isActive:({selection:t})=>Id(t)||Rd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(vd,"italic")},order:2}])],Md=v({enableFormats:["italic"],markdownTransformers:[pl,fl],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as Ad,FORMAT_TEXT_COMMAND as Od}from"lexical";import{jsx as gl,jsxs as $d}from"react/jsx-runtime";import"react";var xl=()=>$d("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:[gl("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"}),gl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Cl={type:"text-format",format:["strikethrough"],tag:"~~"};var bl=[Y([{ChildComponent:xl,isActive:({selection:t})=>Ad(t)||Dd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Od,"strikethrough")},order:4}])],Fd=v({enableFormats:["strikethrough"],markdownTransformers:[Cl],toolbarFixed:{groups:bl},toolbarInline:{groups:bl}});import{$isTableSelection as Pd}from"@lexical/table";import{$isRangeSelection as Bd,FORMAT_TEXT_COMMAND as jd}from"lexical";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("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:kl("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 Tl=[Y([{ChildComponent:_l,isActive:({selection:t})=>Bd(t)||Pd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(jd,"subscript")},order:5}])],Hd=v({enableFormats:["subscript"],toolbarFixed:{groups:Tl},toolbarInline:{groups:Tl}});import{$isTableSelection as Ud}from"@lexical/table";import{$isRangeSelection as Gd,FORMAT_TEXT_COMMAND as Wd}from"lexical";import{jsx as wl}from"react/jsx-runtime";import"react";var Sl=()=>wl("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:wl("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 El=[Y([{ChildComponent:Sl,isActive:({selection:t})=>Gd(t)||Ud(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Wd,"superscript")},order:6}])],Vd=v({enableFormats:["superscript"],toolbarFixed:{groups:El},toolbarInline:{groups:El}});import{$isTableSelection as Kd}from"@lexical/table";import{$isRangeSelection as Jd,FORMAT_TEXT_COMMAND as Xd}from"lexical";import{jsx as Nl,jsxs as zd}from"react/jsx-runtime";import"react";var Ll=()=>zd("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:[Nl("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"}),Nl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var yl=[Y([{ChildComponent:Ll,isActive:({selection:t})=>Jd(t)||Kd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Xd,"underline")},order:3}])],Zd=v({enableFormats:["underline"],toolbarFixed:{groups:yl},toolbarInline:{groups:yl}});import{jsx as ar}from"react/jsx-runtime";import{jsx as Yd}from"react/jsx-runtime";function qd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var ao=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[qd(o),r])):{};return Yd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as em}from"@lexical/selection";import{$getNodeByKey as tm,$getState as om,$setState as rm,createState as nm,TextNode as lm}from"lexical";import{useEffect as im}from"react";function Rl(t){let e=new Map;for(let o in t){let r=t[o],n=nm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function sr(t,e,o,r){t.update(()=>{em(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);rm(n,l.stateConfig,r)})})}function Il({stateMap:t}){let[e]=Qd();return im(()=>e.registerMutationListener(lm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=tm(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=om(l,d.stateConfig);if(!u){delete s.dataset[c];return}s.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var vl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let s in l){let i=l[s];o.push({ChildComponent:()=>ar(ao,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{sr(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>ar(ao,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>ar(ao,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)sr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},sm=v(({props:t})=>{let e=Rl(t.state);return{plugins:[{Component:()=>Il({stateMap:e}),position:"normal"}],toolbarFixed:{groups:vl(t,e)},toolbarInline:{groups:vl(t,e)}}});import{c as dm}from"react/compiler-runtime";import{useLexicalComposerContext as mm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as pm,$isHeadingNode as Vl,HeadingNode as Jl}from"@lexical/rich-text";import{$setBlocksType as fm}from"@lexical/selection";import{$getSelection as hm,$isRangeSelection as gm}from"lexical";import{useEffect as xm}from"react";import{jsx as Ml}from"react/jsx-runtime";import"react";var $l=()=>Ml("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:Ml("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 Dl}from"react/jsx-runtime";import"react";var Al=()=>Dl("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:Dl("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 Ol}from"react/jsx-runtime";import"react";var Fl=()=>Ol("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:Ol("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 Pl}from"react/jsx-runtime";import"react";var Bl=()=>Pl("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:Pl("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 jl}from"react/jsx-runtime";import"react";var Hl=()=>jl("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:jl("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 Ul}from"react/jsx-runtime";import"react";var Gl=()=>Ul("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:Ul("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 am,$isHeadingNode as cm,HeadingNode as um}from"@lexical/rich-text";var cr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Wl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[um],export:(n,l)=>{if(!cm(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:cr(n=>{let l="h"+n[1]?.length;return am(l)})}};var zl=t=>{let e=hm();fm(e,()=>pm(t))},Kl={h1:$l,h2:Al,h3:Fl,h4:Bl,h5:Hl,h6:Gl},Cm=v(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((r,n)=>({ChildComponent:Kl[r],isActive:({selection:l})=>{if(!gm(l))return!1;for(let s of l.getNodes()){if(Vl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Vl(i)&&i.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{zl(r)})},order:n+2})))];return{markdownTransformers:[Wl(e)],nodes:[Jl],plugins:[{Component:bm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Kl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{zl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),bm=t=>{let e=dm(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=mm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Jl,a=>{l.includes(a.getTag())||a.setTag(i)})},u=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=c,e[8]=u):(c=e[7],u=e[8]),xm(c,u),null};import{$isNodeSelection as Am}from"lexical";import{jsx as Xl}from"react/jsx-runtime";import"react";var ur=()=>Xl("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:Xl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Zl,jsxs as km}from"react/jsx-runtime";import"react";var Yl=()=>km("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Zl("path",{d:"M5 10h10",stroke:"currentColor"}),Zl("path",{d:"M10 15V5",stroke:"currentColor"})]});var ge=t=>({type:"dropdown",ChildComponent:Yl,items:t,key:"add",order:10});import{addClassNamesToElement as _m}from"@lexical/utils";import{$applyNodeReplacement as Tm,createCommand as wm,DecoratorNode as Sm}from"lexical";var Lt=wm("INSERT_HORIZONTAL_RULE_COMMAND"),Nt=class extends Sm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Em,priority:0})}}static importJSON(e){return ql()}createDOM(e){let o=document.createElement("hr");return _m(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function Em(){return{node:ql()}}function ql(){return Tm(new Nt)}import{$applyNodeReplacement as Nm}from"lexical";import"react";var xe=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return qe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function qe(){return Nm(new xe)}function yt(t){return t instanceof xe}var Ql={type:"element",dependencies:[xe],export:(t,e)=>yt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=qe();e&&t.replace(e)}};import{c as Lm}from"react/compiler-runtime";import{useLexicalComposerContext as ym}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rm}from"@lexical/utils";import{$getSelection as Im,$isRangeSelection as vm,COMMAND_PRIORITY_EDITOR as Mm}from"lexical";import{useEffect as $m}from"react";var ei=()=>{let t=Lm(3),[e]=ym(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Lt,Dm,Mm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$m(o,r),null};function Dm(t){let e=Im();if(!vm(e))return!1;if(e.focus.getNode()!==null){let r=qe();Rm(r)}return!0}var Om=v({markdownTransformers:[Ql],nodes:[xe],plugins:[{Component:ei,position:"normal"}],slashMenu:{groups:[Z([{Icon:ur,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]},toolbarFixed:{groups:[ge([{ChildComponent:ur,isActive:({selection:t})=>{if(!Am(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return yt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]}});import{$findMatchingParent as ui}from"@lexical/utils";import{$isElementNode as Xm,INDENT_CONTENT_COMMAND as Zm,OUTDENT_CONTENT_COMMAND as Ym}from"lexical";import{jsx as co,jsxs as Fm}from"react/jsx-runtime";import"react";var ti=()=>Fm("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:[co("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as uo,jsxs as Pm}from"react/jsx-runtime";import"react";var oi=()=>Pm("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:[uo("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Bm}from"react/jsx-runtime";import{useLexicalComposerContext as jm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Hm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Um,mergeRegister as ri}from"@lexical/utils";import{$getSelection as Gm,$isElementNode as si,$isRangeSelection as Wm,COMMAND_PRIORITY_LOW as ni,INDENT_CONTENT_COMMAND as li,KEY_TAB_COMMAND as Vm,OUTDENT_CONTENT_COMMAND as zm,TabNode as Km}from"lexical";import{useEffect as ii}from"react";var ai=({clientProps:t})=>{let[e]=jm(),{disabledNodes:o,disableTabNode:r}=t;return ii(()=>{if(!(!e||!o?.length))return ri(e.registerCommand(li,()=>Jm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),ni),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);si(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ii(()=>{if(!(!e||!r))return ri(e.registerCommand(Vm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?zm:li,void 0)),ni),e.registerNodeTransform(Km,n=>{n.remove()}))},[e,r]),Bm(Hm,{})};function Jm(t){let e=Gm();if(!Wm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],s=l.getKey();if(o.has(s))continue;let i=Um(l,c=>si(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var ci=t=>({type:"buttons",items:t,key:"indent",order:35});var di=({disabledNodes:t})=>[ci([{ChildComponent:ti,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ui(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ym,void 0)},order:1},{ChildComponent:oi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ui(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Zm,void 0)},order:2}])],qm=v(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ai,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:di({disabledNodes:e})},toolbarInline:{groups:di({disabledNodes:e})}}}),mi=t=>Xm(t)&&t.canIndent();import{$findMatchingParent as gf}from"@lexical/utils";import{$getSelection as _r,$isRangeSelection as Gi}from"lexical";import{jsx as pi}from"react/jsx-runtime";import"react";var fi=()=>pi("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:pi("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 hi}from"@lexical/selection";function Qe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?hi(o)?r:n:hi(e)?r:n}var dr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as dp}from"lexical";function mr(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var Qm=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,ep=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function gi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Qm.test(t)||ep.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as tp,isHTMLAnchorElement as op}from"@lexical/utils";import hr from"bson-objectid";import{$applyNodeReplacement as rp,$createTextNode as xi,$getSelection as np,$isElementNode as Ci,$isRangeSelection as fr,createCommand as lp,ElementNode as ip}from"lexical";var sp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends ip{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ap,priority:1})}}static importJSON(e){let o=Ce({}).updateFromJSON(e);return 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 hr.default().toHexString(),e.version=3),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=pr(o.rel,"add","noopener")),tp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!fr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ci(r)){let n=Ce({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!sp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=pr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=pr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function ap(t){let e=null;if(op(t)){let o=t.textContent;o!==null&&o!==""&&(e=Ce({id:new hr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Ce({id:t,fields:e}){return rp(new oe({id:t??new hr.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var ue=lp("TOGGLE_LINK_COMMAND");function gr(t){let e=np();if(!fr(e)&&(t===null||!t.selectedNodes?.length))return;let o=fr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:cp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let s=l.getParent();if(!(s===n||s===null||Ci(l)&&!l.isInline())){if(K(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=Ce({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let i=l.getChildren();n.append(...i)}l.remove();return}n!==null&&n.append(l)}})}function cp(t){return up(t,e=>K(e))}function up(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function pr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var mp=(t,e)=>{let[,o,r]=e,n=Ce({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=dp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},pp=t=>({type:"text-match",dependencies:[oe],export:(e,o)=>{if(!K(e))return null;let r=e,n=r.getFields(),l;return n.linkType==="internal"?t?.internalDocToHref?l=mr(t.internalDocToHref({linkNode:r.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=mr(n.url??""),`[${o(r)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:mp,trigger:")"}),bi=pp();import{$applyNodeReplacement as fp,$isElementNode as hp}from"lexical";var be=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Rt({}).updateFromJSON(e);return 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),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 r=this.getParentOrThrow().insertNewAfter(e,o);if(hp(r)){let n=Rt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Rt({fields:t}){return fp(new be({id:"",fields:t}))}function ke(t){return t instanceof be}import{c as gp}from"react/compiler-runtime";import{useLexicalComposerContext as xp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cp}from"@lexical/utils";import{$createTextNode as ki,$getSelection as bp,$isElementNode as Ti,$isLineBreakNode as wi,$isNodeSelection as kp,$isRangeSelection as _p,$isTextNode as It,TextNode as Tp}from"lexical";import{useEffect as wp}from"react";function _i(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Si(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Sp=/[.,;\s]/;function po(t){return t!==void 0&&Sp.test(t)}function Ei(t){return po(t[t.length-1])}function Cr(t){return po(t[0])}function Ep(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ni(t){let e=t.getPreviousSibling();return Ti(e)&&(e=e.getLastDescendant()),e===null||wi(e)||It(e)&&Ei(e.getTextContent())}function Li(t){let e=t.getNextSibling();return Ti(e)&&(e=e.getFirstDescendant()),e===null||wi(e)||It(e)&&Cr(e.getTextContent())}function Np(t,e,o,r){return(t>0?po(o[t-1]):Ni(r[0]))?e<o.length?po(o[e]):Li(r[r.length-1]):!1}function Lp(t,e,o){let r=[],n=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(r.push(c),s+=a):m>=o?l.push(c):n.push(c),i+=a,d.shift()}return[s,r,n,l]}function yp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Rt({fields:n});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=ki(r.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,T]=a.splitText(o-h);g&&c.push(g),u=T}i+=p}),d){let a=bp(),m=a?a.getNodes().find(It):void 0,p=ki(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(_p(a)?p.select(a.anchor.offset,a.focus.offset):kp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Rp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=Si(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if(Np(i+d,i+u,n,r)){let[m,,p,h]=Lp(r,i+d,i+u),f=i+d-m,g=i+u-m,T=yp(p,f,g,s);r=T?[T,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function xr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!It(c)||!c.isSimpleText()){mo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Si(l,e);if(s===null||s.text!==l){mo(t),o(null,t.getFields()?.url??null);return}if(!Ni(t)||!Li(t)){mo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Ip(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(ke(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Cr(l)||Ep(l,s))&&(r.append(t),xr(r,e,o),o(null,r.getFields()?.url??null))}ke(n)&&!Ei(l)&&(mo(n),xr(n,e,o),o(null,n.getFields()?.url??null))}function mo(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function vp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Mp(t,e,o){let r=gp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([be]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Cp(t.registerNodeTransform(Tp,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(ke(d))xr(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(Cr(i.getTextContent())||!ke(c))){let u=vp(i);Rp(u,e,s)}Ip(i,e,s)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),wp(n,l)}var $p=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Dp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ap=[_i($p,t=>t.startsWith("http")?t:`https://${t}`),_i(Dp,t=>`mailto:${t}`)],yi=()=>{let[t]=xp();return Mp(t,Ap),null};import{jsx as Op}from"react/jsx-runtime";import{ClickableLinkPlugin as Fp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ri=()=>Op(Fp,{});import{jsx as nf}from"react/jsx-runtime";import"react";import{createPortal as lf}from"react-dom";import{jsx as _e,jsxs as vt,Fragment as Bp}from"react/jsx-runtime";import{useLexicalComposerContext as jp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Hp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Ii,mergeRegister as vi}from"@lexical/utils";import{getTranslation as br}from"@payloadcms/translations";import{CloseMenuIcon as Up,EditIcon as Gp,ExternalLinkIcon as Mi,formatDrawerSlug as Wp,useConfig as Vp,useEditDepth as zp,useLocale as Kp,useModal as Jp,useTranslation as Xp}from"@payloadcms/ui";import{requests as Zp}from"@payloadcms/ui/shared";import{$getSelection as $i,$isLineBreakNode as Yp,$isRangeSelection as Di,COMMAND_PRIORITY_HIGH as qp,COMMAND_PRIORITY_LOW as Ai,getDOMSelection as Qp,KEY_ESCAPE_COMMAND as ef,SELECTION_CHANGE_COMMAND as tf}from"lexical";import{formatAdminURL as of}from"payload/shared";import Oi,{useCallback as Fi,useEffect as go,useLayoutEffect as rf,useRef as kr,useState as Oe}from"react";function fo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-r,c=t.left-n;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(u<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,T=Math.min(u,f?h:a);T<u&&(e.style.width=`${T}px`,e.style.maxWidth=`${T}px`,e.offsetHeight),f&&(c=t.right-T),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+r*2),c+p.width>i.right&&(c=i.right-p.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Pp}from"lexical";var ho=Pp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Pi(t){t.preventDefault()}function Bi({anchorElem:t}){let[e]=jp(),[o,r]=Oe(),n=kr(null),l=kr(null),[s,i]=Oe(null),[d,c]=Oe(null),{fieldProps:{schemaPath:u},uuid:a}=G(),m=Hp(),{config:p,getEntityConfig:h}=Vp(),{i18n:f,t:g}=Xp(),[T,E]=Oe(),S=zp(),[x,b]=Oe(!1),[C,k]=Oe([]),_=Kp(),[D,I]=Oe(!1),N=Wp({slug:"lexical-rich-text-link-"+a,depth:S}),{modalState:L}=Jp(),w=kr(!1);w.current=!!L[N]?.isOpen;let{toggleDrawer:R}=pe(N),$=Fi(()=>{b(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),I(!1),w.current||(i(null),c(null),k([]),E(void 0))},[]),M=Fi(()=>{let y=$i(),A;if(!Di(y)||!y){$();return}let F=Qe(y);A=e.getElementByKey(F.getKey())?.getBoundingClientRect();let j=Ii(F,K),J=y.getNodes().filter(X=>!Yp(X)).find(X=>{let Q=Ii(X,K);return j&&!j.is(Q)||Q&&!Q.is(j)});if(j==null||J){$();return}r(j);let P=j.getFields(),He={...P,id:j.getID(),text:j.getTextContent()};if(P?.linkType==="custom")i(P?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${P?.doc?.relationTo}/${P?.doc?.value}`);let X=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!X)c(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let Q=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,ft=P.doc?.relationTo;if(!Q||!ft)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Bo=g("fields:linkedTo",{label:`${br(X.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(Bo),Zp.get(of({apiRoute:p.routes.api,path:`/${ft}/${Q}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:_?.code}}).then(async me=>{if(!me.ok)throw new Error(`HTTP error! Status: ${me.status}`);let Ee=await me.json(),ht=X?.admin?.useAsTitle||"id",Vt=Ee[ht],Ne=g("fields:linkedTo",{label:`${br(X.labels.singular,f)} - ${Vt}`}).replace(/<[^>]*>?/g,"");c(Ne)}).catch(()=>{let me=g("fields:linkedTo",{label:`${br(X.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Q}`}).replace(/<[^>]*>?/g,"");c(me)})}}b(!0),w.current||(E(He),k(y?y?.getNodes():[])),ke(j)?I(!0):I(!1);let mt=n.current,Ue=Qp(e._window),{activeElement:pt}=document;if(mt===null)return;let Ge=e.getRootElement();return Ue!==null&&Ge!==null&&Ge.contains(Ue.anchorNode)?(A||(A=Ue.getRangeAt(0).getBoundingClientRect()),A!=null&&(A.y+=40,l.current=A)):(pt==null||pt.className!=="link-input")&&(Ge!==null&&fo(null,mt,t),i(null),c(null)),!0},[e,$,p.routes.admin,p.routes.api,p.serverURL,h,g,f,_?.code,t]);return go(()=>vi(e.registerCommand(ho,y=>(e.dispatchCommand(ue,y),M(),R(),!0),Ai)),[e,M,R,N]),go(()=>{let y=t.parentElement,A=()=>{e.getEditorState().read(()=>{M()})};return window.addEventListener("resize",A),y?.addEventListener("scroll",A),()=>{window.removeEventListener("resize",A),y?.removeEventListener("scroll",A)}},[t.parentElement,e,M]),go(()=>vi(e.registerUpdateListener(({editorState:y})=>{y.read(()=>{M()})}),e.registerCommand(tf,()=>(M(),!0),Ai),e.registerCommand(ef,()=>x?($(),!0):!1,qp)),[e,M,x,$]),go(()=>{e.getEditorState().read(()=>{M()})},[e,M]),rf(()=>{!x||!n.current||!t||!l.current||fo(l.current,n.current,t)},[s,d,x,t,o]),vt(Oi.Fragment,{children:[_e("div",{className:"link-editor",ref:n,children:vt("div",{className:"link-input",children:[s&&s.length>0?vt("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?_e(Mi,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?vt(Bp,{children:[o?.__fields.newTab?_e(Mi,{}):null,_e("span",{className:"link-input__label-pure",children:d})]}):null,m&&vt(Oi.Fragment,{children:[_e("button",{"aria-label":"Edit link",className:"link-edit",onClick:y=>{y.preventDefault(),R()},onMouseDown:Pi,tabIndex:0,type:"button",children:_e(Gp,{})}),!D&&_e("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:Pi,tabIndex:0,type:"button",children:_e(Up,{})})]})]})}),_e(bt,{className:"lexical-link-edit-drawer",data:T,drawerSlug:N,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(y,A)=>{let F=A,j={...F};delete j.text,e.update(()=>{let J=$i(),P=null;if(Di(J)?P=Qe(J).getParent():C.length&&(P=C[0]?.getParent()??null),P&&ke(P)){let He=Ce({fields:j});P.replace(He,!0)}}),e.dispatchCommand(ue,{fields:j,selectedNodes:C,text:F.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var ji=t=>{let{anchorElem:e=document.body}=t;return lf(nf(Bi,{anchorElem:e}),e)};import{c as sf}from"react/compiler-runtime";import{useLexicalComposerContext as af}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as cf}from"@lexical/utils";import{$getSelection as uf,$isElementNode as df,$isRangeSelection as mf,COMMAND_PRIORITY_LOW as Hi,PASTE_COMMAND as pf}from"lexical";import{useEffect as ff}from"react";var Ui=t=>{let e=sf(5),{clientProps:o}=t,[r]=af(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return cf(r.registerCommand(ue,s=>s===null?(gr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),gr(s),!0),Hi),r.registerCommand(pf,s=>{let i=uf();if(!mf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!gi(d))return!1;if(!i.getNodes().some(hf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ue,{fields:c,text:null}),s.preventDefault(),!0}return!1},Hi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),ff(n,l),null};function hf(t){return df(t)}var Wi=[dr([{ChildComponent:fi,isActive:({selection:t})=>{if(Gi(t)){let e=Qe(t);return gf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Gi(t)&&_r()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ue,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=_r()?.getTextContent(),r=_r()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(ho,{fields:n,selectedNodes:r,text:o})}},order:1}])],xf=v(({props:t})=>({markdownTransformers:[bi],nodes:[oe,t?.disableAutoLinks===!0?null:be].filter(Boolean),plugins:[{Component:Ui,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:yi,position:"normal"},{Component:Ri,position:"normal"},{Component:ji,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}}));import{$isListNode as Sr,INSERT_CHECK_LIST_COMMAND as Zi,ListItemNode as Rf,ListNode as If}from"@lexical/list";import{$isRangeSelection as vf}from"lexical";import{jsx as Vi,jsxs as Cf}from"react/jsx-runtime";import"react";var Tr=()=>Cf("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:[Vi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Vi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bf}from"react/jsx-runtime";import{ListPlugin as kf}from"@lexical/react/LexicalListPlugin.js";import"react";var et=()=>bf(kf,{});function xo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function tt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Sf,ListItemNode as Ef,ListNode as Nf}from"@lexical/list";import{$createListItemNode as _f,$createListNode as Tf,$isListItemNode as wf,$isListNode as wr}from"@lexical/list";var zi=4,ot=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=_f(t==="check"?r[3]==="x":void 0);if(wr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(wr(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=Tf(t,t==="number"?Number(r[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(r[1].length/zi);i&&s.setIndent(i)},Fe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(wf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(wr(u)){r.push(Fe(u,e,o+1));continue}}let i=" ".repeat(o*zi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+c+e(s)),l++}return r.join(`
56
+ `)};var Ki={type:"element",dependencies:[Nf,Ef],export:(t,e)=>Sf(t)?Fe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:ot("check")};import{jsx as Lf}from"react/jsx-runtime";import{CheckListPlugin as yf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ji=()=>Lf(yf,{});var Xi=[te([{ChildComponent:Tr,isActive:({selection:t})=>{if(!vf(t))return!1;for(let e of t.getNodes()){if(Sr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Sr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Sr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Zi,void 0)},order:12}])],Mf=v(({featureProviderMap:t})=>{let e=[{Component:Ji,position:"normal"}],o=xo("checklist",t);return o&&e.push({Component:et,position:"normal"}),{markdownTransformers:[Ki],nodes:o?[If,Rf]:[],plugins:e,slashMenu:{groups:[tt([{Icon:Tr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Zi,void 0)}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}}});import{$isListNode as Nr,INSERT_ORDERED_LIST_COMMAND as Qi,ListItemNode as Ff,ListNode as Pf}from"@lexical/list";import{$isRangeSelection as Bf}from"lexical";import{jsx as Mt,jsxs as $f}from"react/jsx-runtime";import"react";var Er=()=>$f("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:"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"}),Mt("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"}),Mt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Df,ListItemNode as Af,ListNode as Of}from"@lexical/list";var Yi={type:"element",dependencies:[Of,Af],export:(t,e)=>Df(t)?Fe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:ot("number")};var qi=[te([{ChildComponent:Er,isActive:({selection:t})=>{if(!Bf(t))return!1;for(let e of t.getNodes()){if(Nr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Nr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Nr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qi,void 0)},order:10}])],jf=v(({featureProviderMap:t})=>{let e=xo("ordered",t);return{markdownTransformers:[Yi],nodes:e?[Pf,Ff]:[],plugins:e?[{Component:et,position:"normal"}]:[],slashMenu:{groups:[tt([{Icon:Er,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Qi,void 0)}}])]},toolbarFixed:{groups:qi},toolbarInline:{groups:qi}}});import{$isListNode as yr,INSERT_UNORDERED_LIST_COMMAND as os,ListItemNode as Vf,ListNode as zf}from"@lexical/list";import{$isRangeSelection as Kf}from"lexical";import{jsx as rt,jsxs as Hf}from"react/jsx-runtime";import"react";var Lr=()=>Hf("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:[rt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),rt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),rt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),rt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Uf,ListItemNode as Gf,ListNode as Wf}from"@lexical/list";var es={type:"element",dependencies:[Wf,Gf],export:(t,e)=>Uf(t)?Fe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:ot("bullet")};var ts=[te([{ChildComponent:Lr,isActive:({selection:t})=>{if(!Kf(t))return!1;for(let e of t.getNodes()){if(yr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(yr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(yr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(os,void 0)},order:11}])],Jf=v({markdownTransformers:[es],nodes:[zf,Vf],plugins:[{Component:et,position:"normal"}],slashMenu:{groups:[tt([{Icon:Lr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(os,void 0)}}])]},toolbarFixed:{groups:ts},toolbarInline:{groups:ts}});import{jsx as Xf}from"react/jsx-runtime";import{addClassNamesToElement as Zf}from"@lexical/utils";import{$applyNodeReplacement as Yf,DecoratorNode as qf}from"lexical";import*as rs from"react";var Qf=rs.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),$t=class extends qf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return e0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Zf(o,"unknownConverted"),o}decorate(){return Xf(Qf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function e0({data:t}){return Yf(new $t({data:t}))}var t0=v(()=>({nodes:[$t]}));import{jsx as o0}from"react/jsx-runtime";import{addClassNamesToElement as r0}from"@lexical/utils";import{$applyNodeReplacement as n0,DecoratorNode as l0}from"lexical";import*as ns from"react";var i0=ns.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Dt=class extends l0{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return s0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return r0(o,"unknownConverted"),o}decorate(){return o0(i0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function s0({data:t}){return n0(new Dt({data:t}))}var a0=v(()=>({nodes:[Dt]}));import{$setBlocksType as ss}from"@lexical/selection";import{$createParagraphNode as as,$getSelection as cs,$isParagraphNode as ls,$isRangeSelection as c0}from"lexical";var is=[te([{ChildComponent:Tt,isActive:({selection:t})=>{if(!c0(t))return!1;for(let e of t.getNodes())if(!ls(e)&&!ls(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=cs();ss(e,()=>as())})},order:1}])],u0=v({slashMenu:{groups:[Z([{Icon:Tt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=cs();ss(e,()=>as())})}}])]},toolbarFixed:{groups:is},toolbarInline:{groups:is}});import{c as $0}from"react/compiler-runtime";import{jsx as vs}from"react/jsx-runtime";import{useLexicalComposerContext as D0}from"@lexical/react/LexicalComposerContext";import{useEffect as A0,useState as O0}from"react";import{jsx as Is,Fragment as M0}from"react/jsx-runtime";import"react";import{jsx as d0}from"react/jsx-runtime";var us={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return d0("blockquote",{children:o})}};import{jsx as m0}from"react/jsx-runtime";var ds=new Set(["h1","h2","h3","h4","h5","h6"]);var ms={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=ds.has(t.tag)?t.tag:"h1";return m0(r,{children:o})}};import{jsx as p0}from"react/jsx-runtime";var ps={horizontalrule:p0("hr",{})};import{jsx as f0}from"react/jsx-runtime";var fs={linebreak:f0("br",{})};import{jsx as hs}from"react/jsx-runtime";var gs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return hs("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),hs("a",{href:s,rel:n,target:l,children:r})}});import{jsx as nt,jsxs as h0,Fragment as g0}from"react/jsx-runtime";import{v4 as x0}from"uuid";var xs=new Set(["ol","ul"]);var Cs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=xs.has(t.tag)?t.tag:"ul";return nt(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=x0();return nt("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:h0(g0,{children:[nt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),nt("label",{htmlFor:l,children:n}),nt("br",{})]})})}else return nt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as Rr}from"react/jsx-runtime";var bs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Rr("p",{children:o}):Rr("p",{children:Rr("br",{})})}};var ks={tab:" "};import{jsx as At}from"react/jsx-runtime";var _s={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return At("div",{className:"lexical-table-container",children:At("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:At("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return At(r,{className:`lexical-table-cell ${n}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return At("tr",{className:"lexical-table-row",children:o})}};import{jsx as Pe}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},C0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,b0="\xA0",k0=`
57
57
 
58
- `,Ts="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ws="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",_0=new RegExp("^[^"+ws+"]*["+Ts+"]"),T0=new RegExp("^[^"+Ts+"]*["+ws+"]"),w0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},S0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},E0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},N0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},L0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},y0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Ss={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ue("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as Ft}from"react/jsx-runtime";var Es={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Ft("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ft("img",{alt:r,height:o.height,src:n,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push(Ft("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ft("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ft("picture",{children:l})}};var st={...bs,...Ss,...fs,...us,..._s,...ms,...ps,...Cs,...gs({}),...Es,...ks};import{jsx as ko,Fragment as R0}from"react/jsx-runtime";import bo from"react";function Ns(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!o}function I0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return ko("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function Ls(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,r={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return bo.createElement(t.Block,r)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},r=typeof t.html=="function"?t.html(o):t.html;return ko("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function v0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ls(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ls(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=I0(n))}return e}function ys({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(Ns(e)){let l=n?v0(n):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Rs({converters:s,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return ko(R0,{})}function Rs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>Rs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=ko("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),bo.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return bo.cloneElement(u,{key:d,style:m})}return bo.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Ir({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:st}):i=e:i=st;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ys({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Is(M0,{children:d}):Is("div",{className:t??"payload-richtext",children:d})}function Ms(){let t=$0(7),[e]=D0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=O0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),A0(l,s);let i;return t[5]!==r?(i=vs("div",{className:"debug-jsx-converter",children:vs(Ir,{converters:st,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var F0=M({plugins:[{Component:Ms,position:"bottom"}]});var j={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},P0={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as y1}from"lexical";import{jsx as Pt,jsxs as B0}from"react/jsx-runtime";import"react";var vr=()=>B0("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:[Pt("g",{clipPath:"url(#clip0_4397_10817)",children:Pt("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"})}),Pt("defs",{children:Pt("clipPath",{id:"clip0_4397_10817",children:Pt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as W0}from"react/jsx-runtime";import{$applyNodeReplacement as V0}from"lexical";import*as Ds from"react";import{DecoratorBlockNode as j0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as H0}from"@lexical/utils";import{$applyNodeReplacement as U0}from"lexical";function G0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:$s({relationTo:o,value:e})}:null}var Bt=class extends j0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:G0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=$s(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return H0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function $s(t){return U0(new Bt({data:t}))}var z0=Ds.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function K0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ge({relationTo:o,value:e})}:null}var we=class extends Bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:K0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Ge(o);return r.setFormat(e.format),r}decorate(e,o){return W0(z0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge(t){return V0(new we({data:t}))}function Mr(t){return t instanceof we}import{c as g1}from"react/compiler-runtime";import{jsx as x1}from"react/jsx-runtime";import{useLexicalComposerContext as C1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as b1}from"@lexical/utils";import{$getPreviousSelection as k1,$getSelection as _1,$isParagraphNode as T1,$isRangeSelection as w1,COMMAND_PRIORITY_EDITOR as S1,createCommand as E1}from"lexical";import{useEffect as N1}from"react";import{c as Fs}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as Ps}from"@lexical/react/LexicalComposerContext.js";import{toast as l1}from"@payloadcms/ui";import{$getNodeByKey as i1,COMMAND_PRIORITY_EDITOR as Bs}from"lexical";import{useEffect as js,useState as s1}from"react";import{c as J0}from"react/compiler-runtime";import{jsx as X0}from"react/jsx-runtime";import{useLexicalComposerContext as Z0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Y0,useModal as q0}from"@payloadcms/ui";import{$getNodeByKey as As,$getPreviousSelection as Q0,$getRoot as e1,$getSelection as t1,$isRangeSelection as o1,$setSelection as r1}from"lexical";import{useEffect as n1,useState as Os}from"react";var jt=t=>{let e=J0(23),[o]=Z0(),[r,n]=Os(null),[l,s]=Os(!1),[i,d,c]=Y0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=q0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let v=t1()??Q0();n(v)},e[0]=f):f=e[0];let g=f,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(o1(r)){let{anchor:v,focus:N}=r;As(v.key)&&As(N.key)&&r1(r.clone())}else e1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let E=T,S;e[4]!==u?(S=()=>{u()},e[4]=u,e[5]=S):S=e[5];let x=S,b,C;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let v=h[a];v&&!v?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},C=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=b,e[11]=C):(b=e[10],C=e[11]),n1(b,C);let k;e[12]!==d?(k=v=>X0(d,{...v,onClick:()=>{g()}}),e[12]=d,e[13]=k):k=e[13];let _;e[14]!==p?(_=()=>{g(),p(),s(!0)},e[14]=p,e[15]=_):_=e[15];let $;return e[16]!==i||e[17]!==x||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==_?($={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:_},e[16]=i,e[17]=x,e[18]=m,e[19]=a,e[20]=k,e[21]=_,e[22]=$):$=e[22],$};var a1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=i1(o);n&&n.replace(Ge({relationTo:e,value:r}))}):t.dispatchCommand(Dr,{relationTo:e,value:r})},c1=t=>{let e=Fs(14),{enabledCollectionSlugs:o}=t,[r]=Ps(),[n,l]=s1(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=jt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ke,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Bs),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),js(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:T,doc:E}=g;a1({editor:r,relationTo:T,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=$r(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},u1=()=>{let t=Fs(3),[e]=Ps(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,d1,Bs),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),js(o,r),null},Hs=({enabledCollectionSlugs:t})=>t?.length?$r(c1,{enabledCollectionSlugs:t}):$r(u1,{});function d1(){return l1.error("No relationship collections enabled"),!0}import{c as m1}from"react/compiler-runtime";import{useConfig as p1,useEntityVisibility as f1}from"@payloadcms/ui";import"react";var _o=t=>{let e=m1(11),{enabledCollectionSlugs:o}=t,{config:r}=p1(),{collections:n}=r,{visibleEntities:l}=f1(),s,i;if(e[0]!==n||e[1]!==o||e[2]!==l?.collections){let c;e[5]!==o||e[6]!==l?.collections?(c=a=>{let{slug:m}=a;return o.includes(m)&&l?.collections.includes(m)},e[5]=o,e[6]=l?.collections,e[7]=c):c=e[7];let u=n.filter(c);s=u,i=u.map(h1),e[0]=n,e[1]=o,e[2]=l?.collections,e[3]=s,e[4]=i}else s=e[3],i=e[4];let d;return e[8]!==s||e[9]!==i?(d={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=d):d=e[10],d};function h1(t){return t.slug}var Dr=E1("INSERT_RELATIONSHIP_COMMAND"),Us=t=>{let e=g1(7),{clientProps:o}=t,[r]=C1(),n;e[0]!==o.enabledCollectionSlugs?(n={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=n):n=e[1];let{enabledCollectionSlugs:l}=_o(n),s,i;e[2]!==r?(s=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Dr,L1,S1)},i=[r],e[2]=r,e[3]=s,e[4]=i):(s=e[3],i=e[4]),N1(s,i);let d;return e[5]!==l?(d=x1(Hs,{enabledCollectionSlugs:l}),e[5]=l,e[6]=d):d=e[6],d};function L1(t){let e=_1()||k1();if(w1(e)){let o=Ge(t),{focus:r}=e,n=r.getNode();b1(o),T1(n)&&!n.__first&&n.remove()}return!0}var R1=M({nodes:[we],plugins:[{Component:Us,position:"normal"}],slashMenu:{groups:[X([{Icon:vr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:vr,isActive:({selection:t})=>{if(!y1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Mr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as eh}from"react/compiler-runtime";import{jsx as de,jsxs as th}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ys}from"@lexical/react/useLexicalEditable";import{useScrollInfo as rh,useThrottledEffect as nh,useTranslation as lh}from"@payloadcms/ui";import*as Eo from"react";import{useMemo as Pr}from"react";import{c as I1}from"react/compiler-runtime";import{jsx as v1}from"react/jsx-runtime";import{$addUpdateTag as M1}from"lexical";import"react";var Gs="toolbar-popup__button",Ht=t=>{let e=I1(14),{active:o,children:r,editor:n,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Gs}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Gs,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let p=m.join(" "),h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==s?(h=()=>{d&&n.focus(()=>{n.update($1),s.onSelect?.({editor:n,isActive:i})})},e[4]=i,e[5]=n,e[6]=d,e[7]=s,e[8]=h):h=e[8];let f=h,g=D1,T;return e[9]!==r||e[10]!==p||e[11]!==f||e[12]!==s.key?(T=v1("button",{className:p,"data-button-key":s.key,onClick:f,onMouseDown:g,type:"button",children:r}),e[9]=r,e[10]=p,e[11]=f,e[12]=s.key,e[13]=T):T=e[13],T};function $1(){M1("toolbar")}function D1(t){t.preventDefault()}import{c as H1}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import U1,{useMemo as G1}from"react";import{useTranslation as W1}from"@payloadcms/ui";import{jsx as $e,jsxs as Ws}from"react/jsx-runtime";import{Button as A1}from"@payloadcms/ui";import{$addUpdateTag as O1,isDOMNode as F1}from"lexical";import To,{useCallback as P1,useEffect as wo,useMemo as zs,useRef as Ar,useState as Or}from"react";import{createPortal as B1}from"react-dom";var Vs="toolbar-popup__dropdown-item",Ks=To.createContext(null);function Js({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=zs(()=>[Vs,r===!1?"disabled":"",t?"active":"",l?.key?`${Vs}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Ar(null),u=To.use(Ks);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return wo(()=>{c?.current!=null&&a(c)},[c,a]),$e(A1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{O1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function j1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Or(),[s,i]=Or(),d=P1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let h=n.indexOf(p)-1;return n[h===-1?n.length-1:h]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=zs(()=>({registerItem:d}),[d]);return wo(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),$e(Ks,{value:u,children:$e("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Xs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Ar(null),u=Ar(null),[a,m]=Or(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};wo(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:T,top:E}=f.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;g.style.top=`${E+S+f.offsetHeight+5}px`,g.style.left=`${Math.min(T-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),wo(()=>{let f=u.current;if(f!==null&&a){let g=T=>{let E=T.target;F1(E)&&(d&&c.current&&c.current.contains(E)||f.contains(E)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=B1($e(j1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Ws(To.Fragment,{children:[Ws("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&$e(l,{}),i&&$e("span",{className:"toolbar-popup__dropdown-label",children:i}),$e("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&$e(To.Fragment,{children:h})]})}var Fr="toolbar-popup__dropdown",V1=t=>{let e=H1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=W1(),{fieldProps:d}=G(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&&at(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=at(Js,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?at(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:at("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},z1=U1.memo(V1),Ut=({anchorElem:t,classNames:e,editor:o,group:r,groupState:n,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=r,u=G1(()=>d?.length?d.map(a=>at(z1,{active:n.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:n.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,n.activeItemKeys,n.enabledItemKeys,t,o]);return at(Xs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Fr,`${Fr}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!n.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Fr}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as K1}from"@lexical/utils";import{$getSelection as J1}from"lexical";import{useCallback as X1,useDeferredValue as Z1,useEffect as Y1,useRef as Zs,useState as q1}from"react";function Q1(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let r of t){let n=[];for(let l of r.items)e.set(l.key,{active:!1,enabled:!0}),n.push(l.key);o.set(r.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:n})}return{groupStates:o,itemStates:e}}function So(t,e){let[o,r]=q1(()=>Q1(e)),n=Z1(o),l=G(),s=Zs(l);s.current=l;let i=Zs(e);i.current=e;let d=hn(),c=X1(()=>{t.getEditorState().read(()=>{let u=J1();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],T=[],E=[],S=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let b of f.items){let C=b.isActive?(!S||g.length<S)&&b.isActive({editor:t,editorConfigContext:m,selection:u}):!1,k=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;C&&(g.push(b.key),T.push(b)),k&&E.push(b.key),p.set(b.key,{active:C,enabled:k})}let x=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:T,enabledGroup:x,enabledItemKeys:E})}r({groupStates:h,itemStates:p})})},[t]);return Y1(()=>{d(c);let u=()=>{d(c)},a=K1(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),n}function ih({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&de(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?de(Ht,{active:t,editor:o,enabled:r,item:n,children:de(n.ChildComponent,{})},n.key):null}function sh({anchorElem:t,editor:e,editorConfig:o,group:r,index:n,toolbarStates:l}){let{i18n:s}=lh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=G(),c=l.groupStates.get(r.key),u=Pr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:r.ChildComponent},[r,c?.activeItems]),a=Pr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[r,c?.activeItems,s,i,d]);return th("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,"data-toolbar-group-key":r.key,children:[r.type==="dropdown"&&r.items.length&&c?de(Ut,{anchorElem:t,editor:e,group:r,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,r.type==="buttons"&&r.items.length?r.items.map(m=>{let p=l.itemStates.get(m.key);return de(ih,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,n<o.features.toolbarFixed?.groups.length-1&&de("div",{className:"divider"})]},r.key)}function ah({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Eo.useRef(null),s=Ys(),{y:i}=rh(),d=So(o,r?.features?.toolbarFixed?.groups),c=Pr(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let a=n.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return nh(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&de(Eo.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,a)=>de(sh,{anchorElem:t,editor:o,editorConfig:r,group:u,index:a,toolbarStates:d},u.key))})})}var qs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return qs(t.parentEditor)}return!1},Qs=t=>{let e=eh(6),{clientProps:o}=t,[r]=oh(),n=G();if(!Ys())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=qs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=de(ah,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var ch=M({plugins:[{Component:Qs,position:"aboveContainer"}]});import{c as uh}from"react/compiler-runtime";import{jsx as Se,jsxs as oa}from"react/jsx-runtime";import{useLexicalComposerContext as dh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as mh}from"@lexical/react/useLexicalEditable";import{mergeRegister as ra}from"@lexical/utils";import{$getSelection as na,$isRangeSelection as ea,$isTextNode as ph,COMMAND_PRIORITY_LOW as fh,getDOMSelection as la,SELECTION_CHANGE_COMMAND as hh}from"lexical";import{useCallback as Lo,useEffect as Gt,useMemo as gh,useRef as ta,useState as xh}from"react";import"react";import{createPortal as Ch}from"react-dom";function Br(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function No(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,n.style.opacity="1",i&&r!==0?(h-=m.bottom-r+a.height-3,n.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,n.style.transform=`translate(${f}px, ${h}px)`),g}function bh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&Se(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?Se(Ht,{active:t,editor:o,enabled:r,item:n,children:Se(n.ChildComponent,{})},n.key):null}function kh({anchorElem:t,editor:e,group:o,index:r,toolbarStates:n}){let{editorConfig:l}=G(),s=n.groupStates.get(o.key),i=gh(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return oa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(Ut,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=n.itemStates.get(d.key);return Se(bh,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,r<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function _h({anchorElem:t,editor:e}){let o=ta(null),r=ta(null),{editorConfig:n}=G(),l=So(e,n?.features?.toolbarInline?.groups),s=Lo(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=Lo(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=Lo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Gt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=Lo(()=>{let u=na(),a=la(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Br(a,h),g=No({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&No({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Gt(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Gt(()=>(e.getEditorState().read(()=>{c()}),ra(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(hh,()=>(c(),!1),fh))),[e,c]),oa("div",{className:"inline-toolbar-popup",ref:o,children:[Se("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,a)=>Se(kh,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function Th(t,e){let o=uh(12),[r,n]=xh(!1),l=mh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=na(),h=la(t._window),f=t.getRootElement();if(h!==null&&(!ea(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!ea(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(ph(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){n(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Gt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>ra(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Gt(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Ch(Se(_h,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ia=t=>{let{anchorElem:e}=t,[o]=dh();return Th(o,e)};var wh=M({plugins:[{Component:ia,position:"floatingAnchorElem"}]});import{TableCellNode as gx,TableNode as xx,TableRowNode as Cx}from"@lexical/table";import{jsx as sa}from"react/jsx-runtime";import"react";var jr=()=>sa("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sa("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 Sh,$createTableNode as Eh,$createTableRowNode as Nh,$isTableCellNode as aa,$isTableNode as Hr,$isTableRowNode as Ur,TableCellHeaderStates as yo,TableCellNode as Lh,TableNode as yh,TableRowNode as Rh}from"@lexical/table";import{$isParagraphNode as Ih,$isTextNode as vh}from"lexical";var ua=/^\|(.+)\|\s?$/,Mh=/^(\| ?:?-*:? ?)+\|\s?$/,da=({allTransformers:t})=>({type:"element",dependencies:[yh,Rh,Lh],export:e=>{if(!Hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Ur(r))continue;let l=!1;for(let s of r.getChildren())aa(s)&&(n.push(Zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===yo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
- `)},regExp:ua,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Mh.test(n)){let a=e.getPreviousSibling();if(!a||!Hr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Ur(p))return;p.getChildren().forEach(h=>{aa(h)&&h.setHeaderStyles(yo.ROW,yo.ROW)}),e.remove();return}let l=ca(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Ih(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!vh(a))break;let m=ca(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=Eh();for(let a of s){let m=Nh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ma("",t))}let u=e.getPreviousSibling();Hr(u)&&$h(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function $h(t){let e=t.getFirstChild();return Ur(e)?e.getChildrenSize():0}var ma=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=Sh(yo.NO_STATUS);return Xt(t,e,o),o},ca=(t,e)=>{let o=t.match(ua);return!o||!o[1]?null:o[1].split("|").map(r=>ma(r,e))};import{c as Fh}from"react/compiler-runtime";import{jsx as P,jsxs as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as xa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ph}from"@lexical/react/useLexicalEditable";import{$computeTableMap as Bh,$deleteTableColumnAtSelection as jh,$deleteTableRowAtSelection as Hh,$getNodeTriplet as Uh,$getTableCellNodeFromLexicalNode as ga,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as Gh,$insertTableColumnAtSelection as Wh,$insertTableRowAtSelection as Vh,$isTableCellNode as Ca,$isTableSelection as Wt,$mergeCells as zh,$setTableColumnIsHeader as Kh,$setTableRowIsHeader as Jh,$unmergeCell as Xh,getTableElement as Wr,getTableObserverFromTableElement as Vr,TableCellHeaderStates as ct,TableCellNode as Zh}from"@lexical/table";import{mergeRegister as Yh}from"@lexical/utils";import{useScrollInfo as qh}from"@payloadcms/ui";import{$getSelection as Io,$isElementNode as Qh,$isRangeSelection as zr,$isTextNode as eg,$setSelection as tg,COMMAND_PRIORITY_CRITICAL as og,getDOMSelection as rg,isDOMNode as ng,SELECTION_CHANGE_COMMAND as lg}from"lexical";import*as Kr from"react";import{useCallback as ae,useEffect as ut,useRef as Ro,useState as dt}from"react";import{createPortal as ba}from"react-dom";import{jsx as Gr,jsxs as Dh}from"react/jsx-runtime";import"react";var pa=()=>Dh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Gr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Gr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Gr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});import{$computeTableCellRectBoundary as Ah,$computeTableMap as Oh,$getNodeTriplet as fa}from"@lexical/table";function ha({selection:t}){let[e,,o]=fa(t.anchor),[r]=fa(t.focus),[n,l,s]=Oh(o,e,r),{maxColumn:i,maxRow:d,minColumn:c,minRow:u}=Ah(n,l,s);return{columns:i-c+1,rows:d-u+1}}function ig(){let t=Io();if(zr(t)&&!t.isCollapsed()||Wt(t)&&!t.anchor.is(t.focus)||!zr(t)&&!Wt(t))return!1;let[e]=Uh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function sg(t){let e=t.getLastDescendant();eg(e)?e.select():Qh(e)?e.selectEnd():e!==null&&e.selectNext()}function ag({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=xa(),s=Ro(null),[i,d]=dt(n),[c,u]=dt({columns:1,rows:1}),[a,m]=dt(!1),[p,h]=dt(!1),{y:f}=qh();ut(()=>l.registerMutationListener(Zh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),ut(()=>{l.getEditorState().read(()=>{let w=Io();if(Wt(w)){let y=ha({selection:w});u(y);let I=w.anchor.is(w.focus);m(!I&&(y.columns>1||y.rows>1))}h(ig())})},[l]),ut(()=>{let w=e.current,y=s.current,I=l.getRootElement();if(w!=null&&y!=null&&I!=null){let D=I.getBoundingClientRect(),R=w.getBoundingClientRect();y.style.opacity="1";let A=y.getBoundingClientRect(),H=5,B=R.right+H;if(B+A.width>window.innerWidth||B+A.width>D.right){let F=R.left-A.width-H;B=(F<0?H:F)+window.pageXOffset}y.style.left=`${B+window.pageXOffset}px`;let J=R.top;if(J+A.height>window.innerHeight){let F=R.bottom-A.height;J=F<0?H:F}y.style.top=`${J}px`}},[e,s,l,f]),ut(()=>{function w(y){s.current!=null&&e.current!=null&&ng(y.target)&&!s.current.contains(y.target)&&!e.current.contains(y.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=ae(()=>{l.update(()=>{if(i.isAttached()){let w=De(i),y=Wr(w,l.getElementByKey(w.getKey()));if(y===null)throw new Error("Expected to find tableElement in DOM");let I=Vr(y);I!==null&&I.$clearHighlight(),w.markDirty(),d(i.getLatest())}tg(null)})},[l,i]),T=()=>{l.update(()=>{let w=Io();if(!Wt(w))return;let I=w.getNodes().filter(Ca),D=zh(I);D&&(sg(D),o())})},E=()=>{l.update(()=>{Xh()}),g()},S=ae(w=>{l.update(()=>{for(let y=0;y<c.rows;y++)Vh(w);o()})},[l,o,c.rows]),x=ae(w=>{l.update(()=>{for(let y=0;y<c.columns;y++)Wh(w);o()})},[l,o,c.columns]),b=ae(()=>{l.update(()=>{Hh(),o()})},[l,o]),C=ae(()=>{l.update(()=>{De(i).remove(),g(),o()})},[l,i,g,o]),k=ae(()=>{l.update(()=>{jh(),o()})},[l,o]),_=ae(()=>{l.update(()=>{let w=De(i),y=Gh(i),I=!i.hasHeaderState(ct.ROW);Jh(w,y,I),g(),o()})},[l,i,g,o]),$=ae(()=>{l.update(()=>{let w=De(i),[,y]=Bh(w,i,i),I=!i.hasHeaderState(ct.COLUMN);Kh(w,y.startColumn,I),g(),o()})},[l,i,g,o]),v=ae(()=>{l.update(()=>{if(i.isAttached()){let w=De(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),N=ae(()=>{l.update(()=>{if(i.isAttached()){let w=De(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ba(Ee("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[L?Ee(Kr.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>v(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>S(!0),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Ee("span",{className:"text",children:[(i.__headerState&ct.ROW)===ct.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>$(),type:"button",children:Ee("span",{className:"text",children:[(i.__headerState&ct.COLUMN)===ct.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function cg({anchorElem:t,cellMerge:e}){let[o]=xa(),r=Ro(null),n=Ro(null),[l,s]=dt(!1),[i,d]=dt(null),c=ae(()=>{let a=r.current,m=Io(),p=rg(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return f();let g=o.getRootElement(),T=null,E=null;if(zr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let x=ga(m.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return f();let b=De(x),C=Wr(b,o.getElementByKey(b.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Vr(C),d(x)}else if(Wt(m)){let x=ga(m.anchor.getNode());if(!Ca(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=De(x),C=Wr(b,o.getElementByKey(b.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Vr(C),E=o.getElementByKey(x.getKey())}else if(!h)return f();if(T===null||E===null)return f();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let x=E.getBoundingClientRect(),b=t.getBoundingClientRect(),C=x.top-b.top,k=x.right-b.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);ut(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Yh(o.registerUpdateListener(p),o.registerCommand(lg,p,og),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=Ro(i);return ut(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),P("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&Ee(Kr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:P(pa,{})}),l&&P(ag,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ka=t=>{let e=Fh(3),{anchorElem:o}=t,r=Ph(),n;return e[0]!==o||e[1]!==r?(n=ba(r?P(cg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as ug}from"react/compiler-runtime";import{jsx as Mo,jsxs as dg}from"react/jsx-runtime";import{useLexicalComposerContext as mg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as pg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as fg,$getTableNodeFromLexicalNodeOrThrow as Jr,$getTableRowIndexFromTableCellNode as hg,$isTableCellNode as _a,$isTableRowNode as gg,getDOMCellFromTarget as xg,getTableElement as Cg,TableNode as Ta}from"@lexical/table";import{calculateZoomLevel as wa,mergeRegister as bg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Xr,isHTMLElement as kg,SKIP_SCROLL_INTO_VIEW_TAG as Sa}from"lexical";import*as Na from"react";import{useCallback as Vt,useEffect as Zr,useRef as vo,useState as mt}from"react";import{createPortal as _g}from"react-dom";var Tg=33,Ea=92;function wg({editor:t}){let e=vo(null),o=vo(null),r=vo(null),[n,l]=mt(!1),s=G(),i=vo(null),[d,c]=mt(null),[u,a]=mt(null),[m,p]=mt(!1),[h,f]=mt(null),g=Vt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),T=N=>(N.buttons&1)===1;Zr(()=>{let N=new Set;return bg(t.registerMutationListener(Ta,L=>{for(let[w,y]of L)y==="destroyed"?N.delete(w):N.add(w);l(N.size>0)}),t.registerNodeTransform(Ta,L=>{if(L.getColWidths())return L;let w=L.getColumnCount(),y=Ea;return L.setColWidths(Array(w).fill(y)),L}))},[t]),Zr(()=>{if(!n)return;let N=I=>{let D=I.target;if(kg(D)){if(h){c({x:I.clientX,y:I.clientY});return}if(p(T(I)),!(o.current&&o.current.contains(D))&&e.current!==D){e.current=D;let R=xg(D);R&&u!==R?t.getEditorState().read(()=>{let A=Xr(R.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let H=Jr(A),B=Cg(H,t.getElementByKey(H.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=D,r.current=B.getBoundingClientRect(),a(R)},{editor:t}):R==null&&g()}}},L=I=>{p(!0)},w=I=>{p(!1)},y=t.registerRootListener((I,D)=>{D?.removeEventListener("mousemove",N),D?.removeEventListener("mousedown",L),D?.removeEventListener("mouseup",w),I?.addEventListener("mousemove",N),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",w)});return()=>{y()}},[u,h,t,n,g]);let E=N=>N==="bottom",S=Vt(N=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Xr(u.elem);if(!_a(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(L),y=hg(L),I=w.getChildren(),R=L.getColSpan()===w.getColumnCount()?y:y+L.getRowSpan()-1;if(R>=I.length||R<0)throw new Error("Expected table cell to be inside of table row.");let A=I[R];if(!gg(A))throw new Error("Expected table row");let H=A.getHeight();if(H===void 0){let J=A.getChildren();H=Math.min(...J.map(F=>x(F,t)??1/0))}let B=Math.max(H+N,Tg);A.setHeight(B)},{tag:Sa})},[u,t]),x=(N,L)=>L.getElementByKey(N.getKey())?.clientHeight,b=(N,L)=>{let w;return L.forEach(y=>{y.forEach((I,D)=>{I.cell===N&&(w=D)})}),w},C=Vt(N=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Xr(u.elem);if(!_a(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(L),[y]=fg(w,null,null),I=b(L,y);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let D=w.getColWidths();if(!D)return;let R=D[I];if(R===void 0)return;let A=[...D],H=Math.max(R+N,Ea);A[I]=H,w.setColWidths(A)},{tag:Sa})},[u,t]),k=Vt(N=>{let L=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:y,y:I}=i.current;if(u===null)return;let D=wa(w.target);if(E(N)){let R=(w.clientY-I)/D;S(R)}else{let R=(w.clientX-y)/D;C(R)}g(),document.removeEventListener("mouseup",L)}};return L},[u,g,C,S]),_=Vt(N=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},c(i.current),f(N),document.addEventListener("mouseup",k(N))},[u,k]),[$,v]=mt({bottom:null,left:null,right:null,top:null});return Zr(()=>{if(u){let{height:N,left:L,top:w,width:y}=u.elem.getBoundingClientRect(),I=wa(u.elem),D=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${D}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+w+N-D/2}px`,width:`${y}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.scrollX+L+y-D/2}px`,top:`${window.scrollY+w}px`,width:`${D}px`}},A=r.current;h&&d&&A&&(E(h)?(R[h].left=`${window.scrollX+A.left}px`,R[h].top=`${window.scrollY+d.y/I}px`,R[h].height="3px",R[h].width=`${A.width}px`):(R[h].top=`${window.scrollY+A.top}px`,R[h].left=`${window.scrollX+d.x/I}px`,R[h].width="3px",R[h].height=`${A.height}px`),R[h].backgroundColor="#adf"),v(R)}else v({bottom:null,left:null,right:null,top:null})},[u,h,d]),Mo("div",{ref:o,children:u!=null&&!m&&dg(Na.Fragment,{children:[Mo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:$.right||void 0}),Mo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:$.bottom||void 0})]})})}var La=()=>{let t=ug(3),[e]=mg(),o=pg(),r;return t[0]!==e||t[1]!==o?(r=o?_g(Mo(wg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as vg}from"react/compiler-runtime";import{jsx as Yr,jsxs as Mg,Fragment as $g}from"react/jsx-runtime";import{useLexicalComposerContext as Dg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Aa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Ag,$getTableColumnIndexFromTableCellNode as Og,$getTableRowIndexFromTableCellNode as Fg,$insertTableColumnAtSelection as Pg,$insertTableRowAtSelection as Bg,$isTableCellNode as jg,$isTableNode as Ia,getTableElement as Hg,TableNode as Ug}from"@lexical/table";import{$findMatchingParent as Gg,mergeRegister as Wg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as va,isHTMLElement as Vg}from"lexical";import{useEffect as Ma,useMemo as zg,useRef as $a,useState as $o}from"react";import"react";import{createPortal as Kg}from"react-dom";import{c as yg}from"react/compiler-runtime";import{useEffect as Rg,useRef as Ig}from"react";var Sg="Expected a function",Eg=Math.max,Ng=Math.min;function Lg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Sg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?Eg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=r,_=s;return r=s=void 0,l=C,u=t.apply(_,k),u}function h(C){return l=C,a=setTimeout(T,e),i?p(C):u}function f(C){let k=C-n,_=C-l,$=e-k;return d?Ng($,c-_):$}function g(C){let k=C-n,_=C-l;return n===void 0||k>=e||k<0||d&&_>=c}function T(){let C=Date.now();if(g(C))return E(C);a=setTimeout(T,f(C))}function E(C){return a=void 0,m&&r?p(C):(r=s=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function x(){return a===void 0?u:E(Date.now())}function b(){let C=Date.now(),k=g(C);if(r=arguments,s=this,n=C,k){if(a===void 0)return h(n);if(d)return clearTimeout(a),a=setTimeout(T,e),p(n)}return a===void 0&&(a=setTimeout(T,e)),u}return b.cancel=S,b.flush=x,b}var ya=Lg;function Ra(t,e,o){let r=yg(6),n=Ig(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ya(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),Rg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Da=20;function Jg({anchorElem:t}){let[e]=Dg(),o=Aa(),r=G(),[n,l]=$o(!1),[s,i]=$o(!1),[d,c]=$o(!1),[u,a]=$o({}),m=$a(new Set),p=$a(null),h=Ra(T=>{let{isOutside:E,tableDOMNode:S}=Xg(T,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!S)return;p.current=S;let x=null,b=null,C=null;if(e.getEditorState().read(()=>{let R=va(S);if(jg(R)){let A=Gg(R,H=>Ia(H));if(!Ia(A))return;if(C=Hg(A,e.getElementByKey(A.getKey())),C){let H=A.getChildrenSize(),B=A.getChildAtIndex(0)?.getChildrenSize(),J=Fg(R),F=Og(R);J===H-1?x=R:F===B-1&&(b=R)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:_,height:$,left:v,right:N,width:L,y:w}=C.getBoundingClientRect(),y=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(y=k.scrollWidth>k.clientWidth);let{left:I,y:D}=t.getBoundingClientRect();x?(i(!1),l(!0),a({height:Da,left:y&&k?k.offsetLeft:v-I,top:_-D+5,width:y&&k?k.offsetWidth:L})):b&&(i(!0),l(!1),a({height:$,left:N-I+5,top:w-D,width:Da}))},50,250),f=zg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Ma(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Ma(()=>Wg(e.registerMutationListener(Ug,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,x]of T)switch(x){case"created":{m.current.add(S),E=!0;break}case"destroyed":{m.current.delete(S),E=!0;break}default:break}if(E){f.disconnect();for(let S of m.current){let{tableElement:x}=Ag(S);f.observe(x)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=T=>{e.update(()=>{p.current&&(va(p.current)?.selectEnd(),T?(Bg(),l(!1)):(Pg(),i(!1)))})};return o?Mg($g,{children:[n&&Yr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Yr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Xg(t,e){let o=t.target;if(Vg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Oa(t){let e=vg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Aa())return null;let l;return e[0]!==r?(l=Kg(Yr(Jg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Zg}from"react/compiler-runtime";import{jsx as qr,jsxs as Yg}from"react/jsx-runtime";import{useLexicalComposerContext as qg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Qg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ex,TableCellNode as tx,TableNode as ox,TableRowNode as rx}from"@lexical/table";import{mergeRegister as nx}from"@lexical/utils";import{formatDrawerSlug as lx,useEditDepth as ix}from"@payloadcms/ui";import{$getSelection as sx,$isRangeSelection as ax,COMMAND_PRIORITY_EDITOR as cx,createCommand as ux}from"lexical";import{createContext as dx,use as mx,useEffect as px,useMemo as fx,useState as hx}from"react";import*as Fa from"react";var Do=ux("OPEN_EMBED_DRAWER_COMMAND"),Pa=dx({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ba({children:t}){let[e,o]=hx({cellEditorConfig:null,cellEditorPlugins:null});return qr(Pa,{value:fx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ja=()=>{let t=Zg(16),[e]=qg(),o=mx(Pa),r=ix(),{fieldProps:n,uuid:l}=G(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=lx({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([ox,rx,tx]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return nx(e.registerCommand(Do,()=>{let f=null;return e.getEditorState().read(()=>{let g=sx();ax(g)&&(f=g)}),f&&u(),!0},cx))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],px(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(ex,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=Yg(Fa.Fragment,{children:[qr(kt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),qr(Qg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var bx=M({markdownTransformers:[da],nodes:[xx,gx,Cx],plugins:[{Component:ja,position:"normal"},{Component:La,position:"normal"},{Component:ka,position:"floatingAnchorElem"},{Component:Oa,position:"floatingAnchorElem"}],providers:[Ba],slashMenu:{groups:[X([{Icon:jr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:jr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]}});import{$isNodeSelection as Jx}from"lexical";import{jsx as Qr,jsxs as kx}from"react/jsx-runtime";import"react";var en=()=>kx("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:[Qr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Qr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Qr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as yx}from"react/compiler-runtime";import{jsx as Rx}from"react/jsx-runtime";import{useLexicalComposerContext as Ix}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ya,$insertNodeToNearestRoot as rn,mergeRegister as vx}from"@lexical/utils";import{useBulkUpload as Mx,useEffectEvent as $x,useModal as Dx}from"@payloadcms/ui";import nn from"bson-objectid";import{$createRangeSelection as Ax,$getPreviousSelection as za,$getSelection as Ka,$isParagraphNode as ln,$isRangeSelection as Ja,$setSelection as Ox,COMMAND_PRIORITY_EDITOR as Fx,COMMAND_PRIORITY_LOW as Xa,createCommand as Px,DROP_COMMAND as Bx,getDOMSelectionFromTarget as jx,isHTMLElement as Za,PASTE_COMMAND as Hx}from"lexical";import{useEffect as Ux}from"react";import{c as Ha}from"react/compiler-runtime";import{jsx as tn}from"react/jsx-runtime";import{useLexicalComposerContext as Ua}from"@lexical/react/LexicalComposerContext.js";import{toast as _x}from"@payloadcms/ui";import{$getNodeByKey as Tx,COMMAND_PRIORITY_EDITOR as Ga}from"lexical";import{useEffect as Wa,useState as wx}from"react";var Sx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Tx(o);n&&n.replace(ve({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(on,{fields:null,relationTo:e,value:r})},Ex=t=>{let e=Ha(13),{enabledCollectionSlugs:o}=t,[r]=Ua(),[n,l]=wx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=jt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Je,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ga),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Wa(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:T}=f;i(),Sx({editor:r,relationTo:g,replaceNodeKey:n,value:T.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=tn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},Nx=()=>{let t=Ha(3),[e]=Ua(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,Lx,Ga),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wa(o,r),null},Va=({enabledCollectionSlugs:t})=>t?.length?tn(Ex,{enabledCollectionSlugs:t}):tn(Nx,{});function Lx(){return _x.error("No upload collections enabled"),!0}function Gx(t){let e=t.target;return!!(Za(e)&&!e.closest("code, span.editor-image")&&Za(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Wx(t){let e,o=jx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var on=Px("INSERT_UPLOAD_COMMAND"),qa=t=>{let e=yx(20),{clientProps:o}=t,[r]=Ix(),n;e[0]!==o.enabledCollectionSlugs?(n={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=n):n=e[1];let{enabledCollectionSlugs:l}=_o(n),{drawerSlug:s,setCollectionSlug:i,setInitialForms:d,setOnCancel:c,setOnSuccess:u,setSelectableCollections:a}=Mx(),{isModalOpen:m,openModal:p}=Dx(),h;e[2]!==s||e[3]!==r||e[4]!==l||e[5]!==m||e[6]!==p||e[7]!==i||e[8]!==d||e[9]!==c||e[10]!==u||e[11]!==a?(h=S=>{let{files:x}=S;if(x?.length!==0&&(d(b=>[...b??[],...x.map(Vx)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),c(()=>{r.update(zx)}),u(b=>{let C=new Map(b.map(Kx));r.update(()=>{for(let k of Ya()){let _=k.node;if(Ze(_)){let $=_.getData();if($?.pending){let v=C.get($.pending?.formID);v&&_.replace(ve({data:{id:new nn.default().toHexString(),fields:{},relationTo:v.collectionSlug,value:v.doc.id}}))}}}})}),p(s)}},e[2]=s,e[3]=r,e[4]=l,e[5]=m,e[6]=p,e[7]=i,e[8]=d,e[9]=c,e[10]=u,e[11]=a,e[12]=h):h=e[12];let f=$x(h),g;e[13]!==r||e[14]!==f?(g=()=>{if(!r.hasNodes([Xe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return vx(r.registerNodeTransform(Xe,S=>{let x=S.getData();if(!x?.pending)return;(async function(){let k=null,_=x?.pending?.src,$=x?.pending?.formID;if(_?.startsWith("data:")){let v=_.match(/data:(image\/[a-zA-Z]+);base64,/),N=v?v[1]:"image/png",L=_.replace(/^data:image\/[a-zA-Z]+;base64,/,""),w=atob(L),y=new Array(w.length);for(let R=0;R<w.length;R++)y[R]=w.charCodeAt(R);let I=new Uint8Array(y);k={alt:void 0,file:new File([I],"pasted-image."+N?.split("/",2)[1],{type:N}),formID:$}}else if(_?.startsWith("http")||_?.startsWith("https")){let N=await(await fetch(_)).blob(),L=_.split("/").pop()||"pasted-image"+N.type.split("/",2)[1];k={alt:void 0,file:new File([N],L,{type:N.type}),formID:$}}k&&f({files:[k]})})()}),r.registerCommand(on,S=>(r.update(()=>{let x=Ka()||za();if(Ja(x)){let b=ve({data:{id:S.id,fields:S.fields,relationTo:S.relationTo,value:S.value}}),{focus:C}=x,k=C.getNode();rn(b),ln(k)&&!k.__first&&k.remove()}}),!0),Fx),r.registerCommand(Hx,S=>{if(!(S instanceof ClipboardEvent))return!1;let x=S.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(C=>{b.push({alt:"",file:C,formID:new nn.default().toHexString()})}),b.length?(r.update(()=>{let C=Ka()||za();if(Ja(C))for(let k of b){let _=ve({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:$}=C,v=$.getNode();rn(_),ln(v)&&!v.__first&&v.remove()}}),f({files:b}),!0):!1},Xa),r.registerCommand(Bx,S=>{if(!(S instanceof DragEvent))return!1;let x=S.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(C=>{b.push({alt:"",file:C,formID:new nn.default().toHexString()})}),b.length?(S.preventDefault(),S.stopPropagation(),r.update(()=>{if(Gx(S)){let C=Wx(S),k=Ax();C!=null&&k.applyDOMRange(C),Ox(k);for(let _ of b){let $=ve({data:{pending:{formID:_.formID,src:URL.createObjectURL(_.file)}}}),{focus:v}=k,N=v.getNode();rn($),ln(N)&&!N.__first&&N.remove()}}}),f({files:b}),!0):!1},Xa))},e[13]=r,e[14]=f,e[15]=g):g=e[15];let T;e[16]!==r?(T=[r],e[16]=r,e[17]=T):T=e[17],Ux(g,T);let E;return e[18]!==l?(E=Rx(Va,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function Vx(t){return{file:t.file,formID:t.formID}}function zx(){for(let t of Ya()){let e=t.node;Ze(e)&&e.getData()?.pending&&e.remove()}}function Kx(t){return[t.formID,t]}var Xx=M({nodes:[Xe],plugins:[{Component:qa,position:"normal"}],slashMenu:{groups:[X([{Icon:en,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:en,isActive:({selection:t})=>{if(!Jx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ze(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as Yx}from"react/compiler-runtime";import{jsx as Ao}from"react/jsx-runtime";import{createElement as qx}from"react";import{ShimmerEffect as Qx,useConfig as eC}from"@payloadcms/ui";import{lazy as tC,Suspense as oC,useEffect as rC,useState as nC}from"react";var Qa={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var sn={namespace:"lexical",theme:Qa};function ec({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as Zx}from"payload/shared";var tc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Zx(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function an(t,e,o,r){return{admin:o,features:tc(t),lexical:e,resolvedFeatureMap:t,view:r}}var lC=tC(()=>import("./Field-YZR46UCY.js").then(t=>({default:t.RichText}))),iC=t=>Ao(Uo,{inheritable:!0,views:t.views,children:Ao(sC,{...t})}),sC=t=>{let e=Yx(23),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,h=i===void 0?sn:i,{currentView:f}=Go(),g=c?.[f]?.admin??a,T=c?.[f]?.lexical,E;e[4]!==h||e[5]!==T?(E=typeof T=="function"?T(h):T??h,e[4]=h,e[5]=T,e[6]=E):E=e[6];let S=E,{config:x}=eC(),[b,C]=nC(null),k,_;e[7]!==r||e[8]!==x||e[9]!==f||e[10]!==g||e[11]!==S||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==d||e[17]!==c?(k=()=>{if(b&&b.view===f)return;let v=c?.[f],N=v?.filterFeatures?v.filterFeatures(r):r,L=[];for(let y of Object.values(N))y.clientFeatureProvider&&L.push(y.clientFeatureProvider(y.clientFeatureProps));let w=ec({config:x,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:L,lexical:S}});C(an(w,S,g,f))},_=[g,r,x,p,l,s,b,S,d,f,c],e[7]=r,e[8]=x,e[9]=f,e[10]=g,e[11]=S,e[12]=p,e[13]=l,e[14]=s,e[15]=b,e[16]=d,e[17]=c,e[18]=k,e[19]=_):(k=e[18],_=e[19]),rC(k,_);let $;return e[20]!==b||e[21]!==t?($=Ao(oC,{fallback:Ao(Qx,{height:"35vh"}),children:b&&qx(lC,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=$):$=e[22],$};function aC(t){return t instanceof HTMLElement}function cC(...t){return t.filter(Boolean).join(" ")}var Oo=new WeakMap;function oc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Fo(t,e){let o=Oo.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=oc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=oc(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Oo.set(t,o)}return o.listeners.add(e),()=>{uC(t,e)}}function uC(t,e){let o=Oo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Oo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function dC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function mC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function pC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function fC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as hC}from"react/compiler-runtime";import{jsx as gC}from"react/jsx-runtime";import"react";var xC=()=>{let t=hC(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?gC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as CC}from"react/compiler-runtime";import{jsx as bC}from"react/jsx-runtime";import"react";var kC=()=>{let t=CC(2),{RemoveButton:e}=he(),o;return t[0]!==e?(o=e?bC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _C}from"react/compiler-runtime";import{jsx as TC}from"react/jsx-runtime";import"react";var wC=()=>{let t=_C(2),{Label:e}=he(),o;return t[0]!==e?(o=e?TC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as SC}from"react/compiler-runtime";import{jsx as EC}from"react/jsx-runtime";import"react";var NC=t=>{let e=SC(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?EC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as LC}from"react/jsx-runtime";import"react";var yC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=le();return r?LC(r,{...o,children:e}):null};import{c as RC}from"react/compiler-runtime";import{jsx as IC}from"react/jsx-runtime";import"react";var vC=()=>{let t=RC(2),{EditButton:e}=le(),o;return t[0]!==e?(o=e?IC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as MC}from"react/compiler-runtime";import{jsx as $C}from"react/jsx-runtime";import"react";var DC=()=>{let t=MC(2),{RemoveButton:e}=le(),o;return t[0]!==e?(o=e?$C(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as AC}from"qs-esm";var OC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=AC({depth:e??0,draft:o??!1,locale:r,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var rc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,Ts="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ws="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",_0=new RegExp("^[^"+ws+"]*["+Ts+"]"),T0=new RegExp("^[^"+Ts+"]*["+ws+"]"),w0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},S0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},E0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},N0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},L0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},y0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Ss={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Pe("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Pe("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Pe("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Pe("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Pe("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Pe("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Pe("sup",{children:e})),e}};import{jsx as Ot}from"react/jsx-runtime";var Es={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Ot("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ot("img",{alt:r,height:o.height,src:n,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push(Ot("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ot("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ot("picture",{children:l})}};var lt={...bs,...Ss,...fs,...us,..._s,...ms,...ps,...Cs,...gs({}),...Es,...ks};import{jsx as bo,Fragment as R0}from"react/jsx-runtime";import Co from"react";function Ns(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!o}function I0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return bo("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function Ls(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,r={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return Co.createElement(t.Block,r)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},r=typeof t.html=="function"?t.html(o):t.html;return bo("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function v0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ls(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ls(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=I0(n))}return e}function ys({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(Ns(e)){let l=n?v0(n):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Rs({converters:s,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return bo(R0,{})}function Rs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>Rs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=bo("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),Co.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return Co.cloneElement(u,{key:d,style:m})}return Co.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Ir({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:lt}):i=e:i=lt;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ys({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Is(M0,{children:d}):Is("div",{className:t??"payload-richtext",children:d})}function Ms(){let t=$0(7),[e]=D0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=O0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),A0(l,s);let i;return t[5]!==r?(i=vs("div",{className:"debug-jsx-converter",children:vs(Ir,{converters:lt,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var F0=v({plugins:[{Component:Ms,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},P0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as y1}from"lexical";import{jsx as Ft,jsxs as B0}from"react/jsx-runtime";import"react";var vr=()=>B0("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:[Ft("g",{clipPath:"url(#clip0_4397_10817)",children:Ft("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"})}),Ft("defs",{children:Ft("clipPath",{id:"clip0_4397_10817",children:Ft("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as W0}from"react/jsx-runtime";import{$applyNodeReplacement as V0}from"lexical";import*as Ds from"react";import{DecoratorBlockNode as j0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as H0}from"@lexical/utils";import{$applyNodeReplacement as U0}from"lexical";function G0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:$s({relationTo:o,value:e})}:null}var Pt=class extends j0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:G0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=$s(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return H0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function $s(t){return U0(new Pt({data:t}))}var z0=Ds.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function K0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var Te=class extends Pt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:K0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Be(o);return r.setFormat(e.format),r}decorate(e,o){return W0(z0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return V0(new Te({data:t}))}function Mr(t){return t instanceof Te}import{c as g1}from"react/compiler-runtime";import{jsx as x1}from"react/jsx-runtime";import{useLexicalComposerContext as C1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as b1}from"@lexical/utils";import{$getPreviousSelection as k1,$getSelection as _1,$isParagraphNode as T1,$isRangeSelection as w1,COMMAND_PRIORITY_EDITOR as S1,createCommand as E1}from"lexical";import{useEffect as N1}from"react";import{c as Fs}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as Ps}from"@lexical/react/LexicalComposerContext.js";import{toast as l1}from"@payloadcms/ui";import{$getNodeByKey as i1,COMMAND_PRIORITY_EDITOR as Bs}from"lexical";import{useEffect as js,useState as s1}from"react";import{c as J0}from"react/compiler-runtime";import{jsx as X0}from"react/jsx-runtime";import{useLexicalComposerContext as Z0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Y0,useModal as q0}from"@payloadcms/ui";import{$getNodeByKey as As,$getPreviousSelection as Q0,$getRoot as e1,$getSelection as t1,$isRangeSelection as o1,$setSelection as r1}from"lexical";import{useEffect as n1,useState as Os}from"react";var Bt=t=>{let e=J0(23),[o]=Z0(),[r,n]=Os(null),[l,s]=Os(!1),[i,d,c]=Y0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=q0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let I=t1()??Q0();n(I)},e[0]=f):f=e[0];let g=f,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(o1(r)){let{anchor:I,focus:N}=r;As(I.key)&&As(N.key)&&r1(r.clone())}else e1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let E=T,S;e[4]!==u?(S=()=>{u()},e[4]=u,e[5]=S):S=e[5];let x=S,b,C;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let I=h[a];I&&!I?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},C=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=b,e[11]=C):(b=e[10],C=e[11]),n1(b,C);let k;e[12]!==d?(k=I=>X0(d,{...I,onClick:()=>{g()}}),e[12]=d,e[13]=k):k=e[13];let _;e[14]!==p?(_=()=>{g(),p(),s(!0)},e[14]=p,e[15]=_):_=e[15];let D;return e[16]!==i||e[17]!==x||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==_?(D={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:_},e[16]=i,e[17]=x,e[18]=m,e[19]=a,e[20]=k,e[21]=_,e[22]=D):D=e[22],D};var a1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=i1(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(Dr,{relationTo:e,value:r})},c1=t=>{let e=Fs(14),{enabledCollectionSlugs:o}=t,[r]=Ps(),[n,l]=s1(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Bt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ve,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Bs),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),js(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:T,doc:E}=g;a1({editor:r,relationTo:T,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=$r(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},u1=()=>{let t=Fs(3),[e]=Ps(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,d1,Bs),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),js(o,r),null},Hs=({enabledCollectionSlugs:t})=>t?.length?$r(c1,{enabledCollectionSlugs:t}):$r(u1,{});function d1(){return l1.error("No relationship collections enabled"),!0}import{c as m1}from"react/compiler-runtime";import{useConfig as p1,useEntityVisibility as f1}from"@payloadcms/ui";import"react";var ko=t=>{let e=m1(11),{enabledCollectionSlugs:o}=t,{config:r}=p1(),{collections:n}=r,{visibleEntities:l}=f1(),s,i;if(e[0]!==n||e[1]!==o||e[2]!==l?.collections){let c;e[5]!==o||e[6]!==l?.collections?(c=a=>{let{slug:m}=a;return o.includes(m)&&l?.collections.includes(m)},e[5]=o,e[6]=l?.collections,e[7]=c):c=e[7];let u=n.filter(c);s=u,i=u.map(h1),e[0]=n,e[1]=o,e[2]=l?.collections,e[3]=s,e[4]=i}else s=e[3],i=e[4];let d;return e[8]!==s||e[9]!==i?(d={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=d):d=e[10],d};function h1(t){return t.slug}var Dr=E1("INSERT_RELATIONSHIP_COMMAND"),Us=t=>{let e=g1(7),{clientProps:o}=t,[r]=C1(),n;e[0]!==o.enabledCollectionSlugs?(n={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=n):n=e[1];let{enabledCollectionSlugs:l}=ko(n),s,i;e[2]!==r?(s=()=>{if(!r.hasNodes([Te]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Dr,L1,S1)},i=[r],e[2]=r,e[3]=s,e[4]=i):(s=e[3],i=e[4]),N1(s,i);let d;return e[5]!==l?(d=x1(Hs,{enabledCollectionSlugs:l}),e[5]=l,e[6]=d):d=e[6],d};function L1(t){let e=_1()||k1();if(w1(e)){let o=Be(t),{focus:r}=e,n=r.getNode();b1(o),T1(n)&&!n.__first&&n.remove()}return!0}var R1=v({nodes:[Te],plugins:[{Component:Us,position:"normal"}],slashMenu:{groups:[Z([{Icon:vr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[ge([{ChildComponent:vr,isActive:({selection:t})=>{if(!y1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Mr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as eh}from"react/compiler-runtime";import{jsx as de,jsxs as th}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ys}from"@lexical/react/useLexicalEditable";import{useScrollInfo as rh,useThrottledEffect as nh,useTranslation as lh}from"@payloadcms/ui";import*as So from"react";import{useMemo as Pr}from"react";import{c as I1}from"react/compiler-runtime";import{jsx as v1}from"react/jsx-runtime";import{$addUpdateTag as M1}from"lexical";import"react";var Gs="toolbar-popup__button",jt=t=>{let e=I1(14),{active:o,children:r,editor:n,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Gs}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Gs,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let p=m.join(" "),h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==s?(h=()=>{d&&n.focus(()=>{n.update($1),s.onSelect?.({editor:n,isActive:i})})},e[4]=i,e[5]=n,e[6]=d,e[7]=s,e[8]=h):h=e[8];let f=h,g=D1,T;return e[9]!==r||e[10]!==p||e[11]!==f||e[12]!==s.key?(T=v1("button",{className:p,"data-button-key":s.key,onClick:f,onMouseDown:g,type:"button",children:r}),e[9]=r,e[10]=p,e[11]=f,e[12]=s.key,e[13]=T):T=e[13],T};function $1(){M1("toolbar")}function D1(t){t.preventDefault()}import{c as H1}from"react/compiler-runtime";import{jsx as it}from"react/jsx-runtime";import U1,{useMemo as G1}from"react";import{useTranslation as W1}from"@payloadcms/ui";import{jsx as Re,jsxs as Ws}from"react/jsx-runtime";import{Button as A1}from"@payloadcms/ui";import{$addUpdateTag as O1,isDOMNode as F1}from"lexical";import _o,{useCallback as P1,useEffect as To,useMemo as zs,useRef as Ar,useState as Or}from"react";import{createPortal as B1}from"react-dom";var Vs="toolbar-popup__dropdown-item",Ks=_o.createContext(null);function Js({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=zs(()=>[Vs,r===!1?"disabled":"",t?"active":"",l?.key?`${Vs}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Ar(null),u=_o.use(Ks);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return To(()=>{c?.current!=null&&a(c)},[c,a]),Re(A1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{O1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function j1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Or(),[s,i]=Or(),d=P1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let h=n.indexOf(p)-1;return n[h===-1?n.length-1:h]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=zs(()=>({registerItem:d}),[d]);return To(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),Re(Ks,{value:u,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Xs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Ar(null),u=Ar(null),[a,m]=Or(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};To(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:T,top:E}=f.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;g.style.top=`${E+S+f.offsetHeight+5}px`,g.style.left=`${Math.min(T-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),To(()=>{let f=u.current;if(f!==null&&a){let g=T=>{let E=T.target;F1(E)&&(d&&c.current&&c.current.contains(E)||f.contains(E)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=B1(Re(j1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Ws(_o.Fragment,{children:[Ws("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&Re(l,{}),i&&Re("span",{className:"toolbar-popup__dropdown-label",children:i}),Re("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Re(_o.Fragment,{children:h})]})}var Fr="toolbar-popup__dropdown",V1=t=>{let e=H1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=W1(),{fieldProps:d}=G(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&&it(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=it(Js,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?it(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:it("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},z1=U1.memo(V1),Ht=({anchorElem:t,classNames:e,editor:o,group:r,groupState:n,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=r,u=G1(()=>d?.length?d.map(a=>it(z1,{active:n.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:n.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,n.activeItemKeys,n.enabledItemKeys,t,o]);return it(Xs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Fr,`${Fr}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!n.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Fr}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as K1}from"@lexical/utils";import{$getSelection as J1}from"lexical";import{useCallback as X1,useDeferredValue as Z1,useEffect as Y1,useRef as Zs,useState as q1}from"react";function Q1(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let r of t){let n=[];for(let l of r.items)e.set(l.key,{active:!1,enabled:!0}),n.push(l.key);o.set(r.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:n})}return{groupStates:o,itemStates:e}}function wo(t,e){let[o,r]=q1(()=>Q1(e)),n=Z1(o),l=G(),s=Zs(l);s.current=l;let i=Zs(e);i.current=e;let d=hn(),c=X1(()=>{t.getEditorState().read(()=>{let u=J1();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],T=[],E=[],S=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let b of f.items){let C=b.isActive?(!S||g.length<S)&&b.isActive({editor:t,editorConfigContext:m,selection:u}):!1,k=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;C&&(g.push(b.key),T.push(b)),k&&E.push(b.key),p.set(b.key,{active:C,enabled:k})}let x=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:T,enabledGroup:x,enabledItemKeys:E})}r({groupStates:h,itemStates:p})})},[t]);return Y1(()=>{d(c);let u=()=>{d(c)},a=K1(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),n}function ih({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&de(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?de(jt,{active:t,editor:o,enabled:r,item:n,children:de(n.ChildComponent,{})},n.key):null}function sh({anchorElem:t,editor:e,editorConfig:o,group:r,index:n,toolbarStates:l}){let{i18n:s}=lh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=G(),c=l.groupStates.get(r.key),u=Pr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:r.ChildComponent},[r,c?.activeItems]),a=Pr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[r,c?.activeItems,s,i,d]);return th("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,"data-toolbar-group-key":r.key,children:[r.type==="dropdown"&&r.items.length&&c?de(Ht,{anchorElem:t,editor:e,group:r,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,r.type==="buttons"&&r.items.length?r.items.map(m=>{let p=l.itemStates.get(m.key);return de(ih,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,n<o.features.toolbarFixed?.groups.length-1&&de("div",{className:"divider"})]},r.key)}function ah({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=So.useRef(null),s=Ys(),{y:i}=rh(),d=wo(o,r?.features?.toolbarFixed?.groups),c=Pr(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let a=n.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return nh(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&de(So.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,a)=>de(sh,{anchorElem:t,editor:o,editorConfig:r,group:u,index:a,toolbarStates:d},u.key))})})}var qs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return qs(t.parentEditor)}return!1},Qs=t=>{let e=eh(6),{clientProps:o}=t,[r]=oh(),n=G();if(!Ys())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=qs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=de(ah,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var ch=v({plugins:[{Component:Qs,position:"aboveContainer"}]});import{c as uh}from"react/compiler-runtime";import{jsx as we,jsxs as oa}from"react/jsx-runtime";import{useLexicalComposerContext as dh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as mh}from"@lexical/react/useLexicalEditable";import{mergeRegister as ra}from"@lexical/utils";import{$getSelection as na,$isRangeSelection as ea,$isTextNode as ph,COMMAND_PRIORITY_LOW as fh,getDOMSelection as la,SELECTION_CHANGE_COMMAND as hh}from"lexical";import{useCallback as No,useEffect as Ut,useMemo as gh,useRef as ta,useState as xh}from"react";import"react";import{createPortal as Ch}from"react-dom";function Br(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function Eo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,n.style.opacity="1",i&&r!==0?(h-=m.bottom-r+a.height-3,n.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,n.style.transform=`translate(${f}px, ${h}px)`),g}function bh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&we(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?we(jt,{active:t,editor:o,enabled:r,item:n,children:we(n.ChildComponent,{})},n.key):null}function kh({anchorElem:t,editor:e,group:o,index:r,toolbarStates:n}){let{editorConfig:l}=G(),s=n.groupStates.get(o.key),i=gh(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return oa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?we(Ht,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=n.itemStates.get(d.key);return we(bh,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,r<l.features.toolbarInline?.groups.length-1&&we("div",{className:"divider"})]},o.key)}function _h({anchorElem:t,editor:e}){let o=ta(null),r=ta(null),{editorConfig:n}=G(),l=wo(e,n?.features?.toolbarInline?.groups),s=No(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=No(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=No(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ut(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=No(()=>{let u=na(),a=la(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Br(a,h),g=Eo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Eo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Ut(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Ut(()=>(e.getEditorState().read(()=>{c()}),ra(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(hh,()=>(c(),!1),fh))),[e,c]),oa("div",{className:"inline-toolbar-popup",ref:o,children:[we("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,a)=>we(kh,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function Th(t,e){let o=uh(12),[r,n]=xh(!1),l=mh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=na(),h=la(t._window),f=t.getRootElement();if(h!==null&&(!ea(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!ea(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(ph(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){n(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Ut(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>ra(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Ut(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Ch(we(_h,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ia=t=>{let{anchorElem:e}=t,[o]=dh();return Th(o,e)};var wh=v({plugins:[{Component:ia,position:"floatingAnchorElem"}]});import{TableCellNode as gx,TableNode as xx,TableRowNode as Cx}from"@lexical/table";import{jsx as sa}from"react/jsx-runtime";import"react";var jr=()=>sa("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sa("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 Sh,$createTableNode as Eh,$createTableRowNode as Nh,$isTableCellNode as aa,$isTableNode as Hr,$isTableRowNode as Ur,TableCellHeaderStates as Lo,TableCellNode as Lh,TableNode as yh,TableRowNode as Rh}from"@lexical/table";import{$isParagraphNode as Ih,$isTextNode as vh}from"lexical";var ua=/^\|(.+)\|\s?$/,Mh=/^(\| ?:?-*:? ?)+\|\s?$/,da=({allTransformers:t})=>({type:"element",dependencies:[yh,Rh,Lh],export:e=>{if(!Hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Ur(r))continue;let l=!1;for(let s of r.getChildren())aa(s)&&(n.push(Xt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Lo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:ua,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Mh.test(n)){let a=e.getPreviousSibling();if(!a||!Hr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Ur(p))return;p.getChildren().forEach(h=>{aa(h)&&h.setHeaderStyles(Lo.ROW,Lo.ROW)}),e.remove();return}let l=ca(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Ih(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!vh(a))break;let m=ca(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=Eh();for(let a of s){let m=Nh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ma("",t))}let u=e.getPreviousSibling();Hr(u)&&$h(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function $h(t){let e=t.getFirstChild();return Ur(e)?e.getChildrenSize():0}var ma=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=Sh(Lo.NO_STATUS);return Jt(t,e,o),o},ca=(t,e)=>{let o=t.match(ua);return!o||!o[1]?null:o[1].split("|").map(r=>ma(r,e))};import{c as Fh}from"react/compiler-runtime";import{jsx as B,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as xa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ph}from"@lexical/react/useLexicalEditable";import{$computeTableMap as Bh,$deleteTableColumnAtSelection as jh,$deleteTableRowAtSelection as Hh,$getNodeTriplet as Uh,$getTableCellNodeFromLexicalNode as ga,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as Gh,$insertTableColumnAtSelection as Wh,$insertTableRowAtSelection as Vh,$isTableCellNode as Ca,$isTableSelection as Gt,$mergeCells as zh,$setTableColumnIsHeader as Kh,$setTableRowIsHeader as Jh,$unmergeCell as Xh,getTableElement as Wr,getTableObserverFromTableElement as Vr,TableCellHeaderStates as st,TableCellNode as Zh}from"@lexical/table";import{mergeRegister as Yh}from"@lexical/utils";import{useScrollInfo as qh}from"@payloadcms/ui";import{$getSelection as Ro,$isElementNode as Qh,$isRangeSelection as zr,$isTextNode as eg,$setSelection as tg,COMMAND_PRIORITY_CRITICAL as og,getDOMSelection as rg,isDOMNode as ng,SELECTION_CHANGE_COMMAND as lg}from"lexical";import*as Kr from"react";import{useCallback as ae,useEffect as at,useRef as yo,useState as ct}from"react";import{createPortal as ba}from"react-dom";import{jsx as Gr,jsxs as Dh}from"react/jsx-runtime";import"react";var pa=()=>Dh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Gr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Gr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Gr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});import{$computeTableCellRectBoundary as Ah,$computeTableMap as Oh,$getNodeTriplet as fa}from"@lexical/table";function ha({selection:t}){let[e,,o]=fa(t.anchor),[r]=fa(t.focus),[n,l,s]=Oh(o,e,r),{maxColumn:i,maxRow:d,minColumn:c,minRow:u}=Ah(n,l,s);return{columns:i-c+1,rows:d-u+1}}function ig(){let t=Ro();if(zr(t)&&!t.isCollapsed()||Gt(t)&&!t.anchor.is(t.focus)||!zr(t)&&!Gt(t))return!1;let[e]=Uh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function sg(t){let e=t.getLastDescendant();eg(e)?e.select():Qh(e)?e.selectEnd():e!==null&&e.selectNext()}function ag({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=xa(),s=yo(null),[i,d]=ct(n),[c,u]=ct({columns:1,rows:1}),[a,m]=ct(!1),[p,h]=ct(!1),{y:f}=qh();at(()=>l.registerMutationListener(Zh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),at(()=>{l.getEditorState().read(()=>{let w=Ro();if(Gt(w)){let R=ha({selection:w});u(R);let $=w.anchor.is(w.focus);m(!$&&(R.columns>1||R.rows>1))}h(ig())})},[l]),at(()=>{let w=e.current,R=s.current,$=l.getRootElement();if(w!=null&&R!=null&&$!=null){let M=$.getBoundingClientRect(),y=w.getBoundingClientRect();R.style.opacity="1";let A=R.getBoundingClientRect(),F=5,j=y.right+F;if(j+A.width>window.innerWidth||j+A.width>M.right){let P=y.left-A.width-F;j=(P<0?F:P)+window.pageXOffset}R.style.left=`${j+window.pageXOffset}px`;let J=y.top;if(J+A.height>window.innerHeight){let P=y.bottom-A.height;J=P<0?F:P}R.style.top=`${J}px`}},[e,s,l,f]),at(()=>{function w(R){s.current!=null&&e.current!=null&&ng(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ie(i),R=Wr(w,l.getElementByKey(w.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let $=Vr(R);$!==null&&$.$clearHighlight(),w.markDirty(),d(i.getLatest())}tg(null)})},[l,i]),T=()=>{l.update(()=>{let w=Ro();if(!Gt(w))return;let $=w.getNodes().filter(Ca),M=zh($);M&&(sg(M),o())})},E=()=>{l.update(()=>{Xh()}),g()},S=ae(w=>{l.update(()=>{for(let R=0;R<c.rows;R++)Vh(w);o()})},[l,o,c.rows]),x=ae(w=>{l.update(()=>{for(let R=0;R<c.columns;R++)Wh(w);o()})},[l,o,c.columns]),b=ae(()=>{l.update(()=>{Hh(),o()})},[l,o]),C=ae(()=>{l.update(()=>{Ie(i).remove(),g(),o()})},[l,i,g,o]),k=ae(()=>{l.update(()=>{jh(),o()})},[l,o]),_=ae(()=>{l.update(()=>{let w=Ie(i),R=Gh(i),$=!i.hasHeaderState(st.ROW);Jh(w,R,$),g(),o()})},[l,i,g,o]),D=ae(()=>{l.update(()=>{let w=Ie(i),[,R]=Bh(w,i,i),$=!i.hasHeaderState(st.COLUMN);Kh(w,R.startColumn,$),g(),o()})},[l,i,g,o]),I=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ie(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),N=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ie(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),L=null;return t&&(a?L=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):p&&(L=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),ba(Se("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[L?Se(Kr.Fragment,{children:[L,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>N(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>S(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Se("span",{className:"text",children:[(i.__headerState&st.ROW)===st.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:Se("span",{className:"text",children:[(i.__headerState&st.COLUMN)===st.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function cg({anchorElem:t,cellMerge:e}){let[o]=xa(),r=yo(null),n=yo(null),[l,s]=ct(!1),[i,d]=ct(null),c=ae(()=>{let a=r.current,m=Ro(),p=rg(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return f();let g=o.getRootElement(),T=null,E=null;if(zr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let x=ga(m.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return f();let b=Ie(x),C=Wr(b,o.getElementByKey(b.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Vr(C),d(x)}else if(Gt(m)){let x=ga(m.anchor.getNode());if(!Ca(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=Ie(x),C=Wr(b,o.getElementByKey(b.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Vr(C),E=o.getElementByKey(x.getKey())}else if(!h)return f();if(T===null||E===null)return f();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let x=E.getBoundingClientRect(),b=t.getBoundingClientRect(),C=x.top-b.top,k=x.right-b.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);at(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Yh(o.registerUpdateListener(p),o.registerCommand(lg,p,og),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=yo(i);return at(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),B("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&Se(Kr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:B(pa,{})}),l&&B(ag,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ka=t=>{let e=Fh(3),{anchorElem:o}=t,r=Ph(),n;return e[0]!==o||e[1]!==r?(n=ba(r?B(cg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as ug}from"react/compiler-runtime";import{jsx as vo,jsxs as dg}from"react/jsx-runtime";import{useLexicalComposerContext as mg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as pg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as fg,$getTableNodeFromLexicalNodeOrThrow as Jr,$getTableRowIndexFromTableCellNode as hg,$isTableCellNode as _a,$isTableRowNode as gg,getDOMCellFromTarget as xg,getTableElement as Cg,TableNode as Ta}from"@lexical/table";import{calculateZoomLevel as wa,mergeRegister as bg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Xr,isHTMLElement as kg,SKIP_SCROLL_INTO_VIEW_TAG as Sa}from"lexical";import*as Na from"react";import{useCallback as Wt,useEffect as Zr,useRef as Io,useState as ut}from"react";import{createPortal as _g}from"react-dom";var Tg=33,Ea=92;function wg({editor:t}){let e=Io(null),o=Io(null),r=Io(null),[n,l]=ut(!1),s=G(),i=Io(null),[d,c]=ut(null),[u,a]=ut(null),[m,p]=ut(!1),[h,f]=ut(null),g=Wt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),T=N=>(N.buttons&1)===1;Zr(()=>{let N=new Set;return bg(t.registerMutationListener(Ta,L=>{for(let[w,R]of L)R==="destroyed"?N.delete(w):N.add(w);l(N.size>0)}),t.registerNodeTransform(Ta,L=>{if(L.getColWidths())return L;let w=L.getColumnCount(),R=Ea;return L.setColWidths(Array(w).fill(R)),L}))},[t]),Zr(()=>{if(!n)return;let N=$=>{let M=$.target;if(kg(M)){if(h){c({x:$.clientX,y:$.clientY});return}if(p(T($)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let y=xg(M);y&&u!==y?t.getEditorState().read(()=>{let A=Xr(y.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let F=Jr(A),j=Cg(F,t.getElementByKey(F.getKey()));if(!j)throw new Error("TableCellResizer: Table element not found.");e.current=M,r.current=j.getBoundingClientRect(),a(y)},{editor:t}):y==null&&g()}}},L=$=>{p(!0)},w=$=>{p(!1)},R=t.registerRootListener(($,M)=>{M?.removeEventListener("mousemove",N),M?.removeEventListener("mousedown",L),M?.removeEventListener("mouseup",w),$?.addEventListener("mousemove",N),$?.addEventListener("mousedown",L),$?.addEventListener("mouseup",w)});return()=>{R()}},[u,h,t,n,g]);let E=N=>N==="bottom",S=Wt(N=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Xr(u.elem);if(!_a(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(L),R=hg(L),$=w.getChildren(),y=L.getColSpan()===w.getColumnCount()?R:R+L.getRowSpan()-1;if(y>=$.length||y<0)throw new Error("Expected table cell to be inside of table row.");let A=$[y];if(!gg(A))throw new Error("Expected table row");let F=A.getHeight();if(F===void 0){let J=A.getChildren();F=Math.min(...J.map(P=>x(P,t)??1/0))}let j=Math.max(F+N,Tg);A.setHeight(j)},{tag:Sa})},[u,t]),x=(N,L)=>L.getElementByKey(N.getKey())?.clientHeight,b=(N,L)=>{let w;return L.forEach(R=>{R.forEach(($,M)=>{$.cell===N&&(w=M)})}),w},C=Wt(N=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Xr(u.elem);if(!_a(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(L),[R]=fg(w,null,null),$=b(L,R);if($===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let y=M[$];if(y===void 0)return;let A=[...M],F=Math.max(y+N,Ea);A[$]=F,w.setColWidths(A)},{tag:Sa})},[u,t]),k=Wt(N=>{let L=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:$}=i.current;if(u===null)return;let M=wa(w.target);if(E(N)){let y=(w.clientY-$)/M;S(y)}else{let y=(w.clientX-R)/M;C(y)}g(),document.removeEventListener("mouseup",L)}};return L},[u,g,C,S]),_=Wt(N=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},c(i.current),f(N),document.addEventListener("mouseup",k(N))},[u,k]),[D,I]=ut({bottom:null,left:null,right:null,top:null});return Zr(()=>{if(u){let{height:N,left:L,top:w,width:R}=u.elem.getBoundingClientRect(),$=wa(u.elem),M=10,y={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+w+N-M/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.scrollX+L+R-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},A=r.current;h&&d&&A&&(E(h)?(y[h].left=`${window.scrollX+A.left}px`,y[h].top=`${window.scrollY+d.y/$}px`,y[h].height="3px",y[h].width=`${A.width}px`):(y[h].top=`${window.scrollY+A.top}px`,y[h].left=`${window.scrollX+d.x/$}px`,y[h].width="3px",y[h].height=`${A.height}px`),y[h].backgroundColor="#adf"),I(y)}else I({bottom:null,left:null,right:null,top:null})},[u,h,d]),vo("div",{ref:o,children:u!=null&&!m&&dg(Na.Fragment,{children:[vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:D.right||void 0}),vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:D.bottom||void 0})]})})}var La=()=>{let t=ug(3),[e]=mg(),o=pg(),r;return t[0]!==e||t[1]!==o?(r=o?_g(vo(wg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as vg}from"react/compiler-runtime";import{jsx as Yr,jsxs as Mg,Fragment as $g}from"react/jsx-runtime";import{useLexicalComposerContext as Dg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Aa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Ag,$getTableColumnIndexFromTableCellNode as Og,$getTableRowIndexFromTableCellNode as Fg,$insertTableColumnAtSelection as Pg,$insertTableRowAtSelection as Bg,$isTableCellNode as jg,$isTableNode as Ia,getTableElement as Hg,TableNode as Ug}from"@lexical/table";import{$findMatchingParent as Gg,mergeRegister as Wg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as va,isHTMLElement as Vg}from"lexical";import{useEffect as Ma,useMemo as zg,useRef as $a,useState as Mo}from"react";import"react";import{createPortal as Kg}from"react-dom";import{c as yg}from"react/compiler-runtime";import{useEffect as Rg,useRef as Ig}from"react";var Sg="Expected a function",Eg=Math.max,Ng=Math.min;function Lg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Sg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?Eg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=r,_=s;return r=s=void 0,l=C,u=t.apply(_,k),u}function h(C){return l=C,a=setTimeout(T,e),i?p(C):u}function f(C){let k=C-n,_=C-l,D=e-k;return d?Ng(D,c-_):D}function g(C){let k=C-n,_=C-l;return n===void 0||k>=e||k<0||d&&_>=c}function T(){let C=Date.now();if(g(C))return E(C);a=setTimeout(T,f(C))}function E(C){return a=void 0,m&&r?p(C):(r=s=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function x(){return a===void 0?u:E(Date.now())}function b(){let C=Date.now(),k=g(C);if(r=arguments,s=this,n=C,k){if(a===void 0)return h(n);if(d)return clearTimeout(a),a=setTimeout(T,e),p(n)}return a===void 0&&(a=setTimeout(T,e)),u}return b.cancel=S,b.flush=x,b}var ya=Lg;function Ra(t,e,o){let r=yg(6),n=Ig(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ya(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),Rg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Da=20;function Jg({anchorElem:t}){let[e]=Dg(),o=Aa(),r=G(),[n,l]=Mo(!1),[s,i]=Mo(!1),[d,c]=Mo(!1),[u,a]=Mo({}),m=$a(new Set),p=$a(null),h=Ra(T=>{let{isOutside:E,tableDOMNode:S}=Xg(T,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!S)return;p.current=S;let x=null,b=null,C=null;if(e.getEditorState().read(()=>{let y=va(S);if(jg(y)){let A=Gg(y,F=>Ia(F));if(!Ia(A))return;if(C=Hg(A,e.getElementByKey(A.getKey())),C){let F=A.getChildrenSize(),j=A.getChildAtIndex(0)?.getChildrenSize(),J=Fg(y),P=Og(y);J===F-1?x=y:P===j-1&&(b=y)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:_,height:D,left:I,right:N,width:L,y:w}=C.getBoundingClientRect(),R=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=k.scrollWidth>k.clientWidth);let{left:$,y:M}=t.getBoundingClientRect();x?(i(!1),l(!0),a({height:Da,left:R&&k?k.offsetLeft:I-$,top:_-M+5,width:R&&k?k.offsetWidth:L})):b&&(i(!0),l(!1),a({height:D,left:N-$+5,top:w-M,width:Da}))},50,250),f=zg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Ma(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Ma(()=>Wg(e.registerMutationListener(Ug,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,x]of T)switch(x){case"created":{m.current.add(S),E=!0;break}case"destroyed":{m.current.delete(S),E=!0;break}default:break}if(E){f.disconnect();for(let S of m.current){let{tableElement:x}=Ag(S);f.observe(x)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=T=>{e.update(()=>{p.current&&(va(p.current)?.selectEnd(),T?(Bg(),l(!1)):(Pg(),i(!1)))})};return o?Mg($g,{children:[n&&Yr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Yr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Xg(t,e){let o=t.target;if(Vg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Oa(t){let e=vg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Aa())return null;let l;return e[0]!==r?(l=Kg(Yr(Jg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Zg}from"react/compiler-runtime";import{jsx as qr,jsxs as Yg}from"react/jsx-runtime";import{useLexicalComposerContext as qg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Qg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ex,TableCellNode as tx,TableNode as ox,TableRowNode as rx}from"@lexical/table";import{mergeRegister as nx}from"@lexical/utils";import{formatDrawerSlug as lx,useEditDepth as ix}from"@payloadcms/ui";import{$getSelection as sx,$isRangeSelection as ax,COMMAND_PRIORITY_EDITOR as cx,createCommand as ux}from"lexical";import{createContext as dx,use as mx,useEffect as px,useMemo as fx,useState as hx}from"react";import*as Fa from"react";var $o=ux("OPEN_EMBED_DRAWER_COMMAND"),Pa=dx({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ba({children:t}){let[e,o]=hx({cellEditorConfig:null,cellEditorPlugins:null});return qr(Pa,{value:fx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ja=()=>{let t=Zg(16),[e]=qg(),o=mx(Pa),r=ix(),{fieldProps:n,uuid:l}=G(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=lx({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=pe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([ox,rx,tx]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return nx(e.registerCommand($o,()=>{let f=null;return e.getEditorState().read(()=>{let g=sx();ax(g)&&(f=g)}),f&&u(),!0},cx))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],px(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(ex,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=Yg(Fa.Fragment,{children:[qr(bt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),qr(Qg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var bx=v({markdownTransformers:[da],nodes:[xx,gx,Cx],plugins:[{Component:ja,position:"normal"},{Component:La,position:"normal"},{Component:ka,position:"floatingAnchorElem"},{Component:Oa,position:"floatingAnchorElem"}],providers:[Ba],slashMenu:{groups:[Z([{Icon:jr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand($o,{})}}])]},toolbarFixed:{groups:[ge([{ChildComponent:jr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand($o,{})}}])]}});import{$isNodeSelection as Jx}from"lexical";import{jsx as Qr,jsxs as kx}from"react/jsx-runtime";import"react";var en=()=>kx("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:[Qr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Qr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Qr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as yx}from"react/compiler-runtime";import{jsx as Rx}from"react/jsx-runtime";import{useLexicalComposerContext as Ix}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ya,$insertNodeToNearestRoot as rn,mergeRegister as vx}from"@lexical/utils";import{useBulkUpload as Mx,useEffectEvent as $x,useModal as Dx}from"@payloadcms/ui";import nn from"bson-objectid";import{$createRangeSelection as Ax,$getPreviousSelection as za,$getSelection as Ka,$isParagraphNode as ln,$isRangeSelection as Ja,$setSelection as Ox,COMMAND_PRIORITY_EDITOR as Fx,COMMAND_PRIORITY_LOW as Xa,createCommand as Px,DROP_COMMAND as Bx,getDOMSelectionFromTarget as jx,isHTMLElement as Za,PASTE_COMMAND as Hx}from"lexical";import{useEffect as Ux}from"react";import{c as Ha}from"react/compiler-runtime";import{jsx as tn}from"react/jsx-runtime";import{useLexicalComposerContext as Ua}from"@lexical/react/LexicalComposerContext.js";import{toast as _x}from"@payloadcms/ui";import{$getNodeByKey as Tx,COMMAND_PRIORITY_EDITOR as Ga}from"lexical";import{useEffect as Wa,useState as wx}from"react";var Sx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Tx(o);n&&n.replace(Le({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(on,{fields:null,relationTo:e,value:r})},Ex=t=>{let e=Ha(13),{enabledCollectionSlugs:o}=t,[r]=Ua(),[n,l]=wx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Bt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(ze,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ga),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Wa(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:T}=f;i(),Sx({editor:r,relationTo:g,replaceNodeKey:n,value:T.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=tn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},Nx=()=>{let t=Ha(3),[e]=Ua(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,Lx,Ga),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wa(o,r),null},Va=({enabledCollectionSlugs:t})=>t?.length?tn(Ex,{enabledCollectionSlugs:t}):tn(Nx,{});function Lx(){return _x.error("No upload collections enabled"),!0}function Gx(t){let e=t.target;return!!(Za(e)&&!e.closest("code, span.editor-image")&&Za(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Wx(t){let e,o=jx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var on=Px("INSERT_UPLOAD_COMMAND"),qa=t=>{let e=yx(20),{clientProps:o}=t,[r]=Ix(),n;e[0]!==o.enabledCollectionSlugs?(n={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=n):n=e[1];let{enabledCollectionSlugs:l}=ko(n),{drawerSlug:s,setCollectionSlug:i,setInitialForms:d,setOnCancel:c,setOnSuccess:u,setSelectableCollections:a}=Mx(),{isModalOpen:m,openModal:p}=Dx(),h;e[2]!==s||e[3]!==r||e[4]!==l||e[5]!==m||e[6]!==p||e[7]!==i||e[8]!==d||e[9]!==c||e[10]!==u||e[11]!==a?(h=S=>{let{files:x}=S;if(x?.length!==0&&(d(b=>[...b??[],...x.map(Vx)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),c(()=>{r.update(zx)}),u(b=>{let C=new Map(b.map(Kx));r.update(()=>{for(let k of Ya()){let _=k.node;if(Je(_)){let D=_.getData();if(D?.pending){let I=C.get(D.pending?.formID);I&&_.replace(Le({data:{id:new nn.default().toHexString(),fields:{},relationTo:I.collectionSlug,value:I.doc.id}}))}}}})}),p(s)}},e[2]=s,e[3]=r,e[4]=l,e[5]=m,e[6]=p,e[7]=i,e[8]=d,e[9]=c,e[10]=u,e[11]=a,e[12]=h):h=e[12];let f=$x(h),g;e[13]!==r||e[14]!==f?(g=()=>{if(!r.hasNodes([Ke]))throw new Error("UploadPlugin: UploadNode not registered on editor");return vx(r.registerNodeTransform(Ke,S=>{let x=S.getData();if(!x?.pending)return;(async function(){let k=null,_=x?.pending?.src,D=x?.pending?.formID;if(_?.startsWith("data:")){let I=_.match(/data:(image\/[a-zA-Z]+);base64,/),N=I?I[1]:"image/png",L=_.replace(/^data:image\/[a-zA-Z]+;base64,/,""),w=atob(L),R=new Array(w.length);for(let y=0;y<w.length;y++)R[y]=w.charCodeAt(y);let $=new Uint8Array(R);k={alt:void 0,file:new File([$],"pasted-image."+N?.split("/",2)[1],{type:N}),formID:D}}else if(_?.startsWith("http")||_?.startsWith("https")){let N=await(await fetch(_)).blob(),L=_.split("/").pop()||"pasted-image"+N.type.split("/",2)[1];k={alt:void 0,file:new File([N],L,{type:N.type}),formID:D}}k&&f({files:[k]})})()}),r.registerCommand(on,S=>(r.update(()=>{let x=Ka()||za();if(Ja(x)){let b=Le({data:{id:S.id,fields:S.fields,relationTo:S.relationTo,value:S.value}}),{focus:C}=x,k=C.getNode();rn(b),ln(k)&&!k.__first&&k.remove()}}),!0),Fx),r.registerCommand(Hx,S=>{if(!(S instanceof ClipboardEvent))return!1;let x=S.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(C=>{b.push({alt:"",file:C,formID:new nn.default().toHexString()})}),b.length?(r.update(()=>{let C=Ka()||za();if(Ja(C))for(let k of b){let _=Le({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:D}=C,I=D.getNode();rn(_),ln(I)&&!I.__first&&I.remove()}}),f({files:b}),!0):!1},Xa),r.registerCommand(Bx,S=>{if(!(S instanceof DragEvent))return!1;let x=S.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(C=>{b.push({alt:"",file:C,formID:new nn.default().toHexString()})}),b.length?(S.preventDefault(),S.stopPropagation(),r.update(()=>{if(Gx(S)){let C=Wx(S),k=Ax();C!=null&&k.applyDOMRange(C),Ox(k);for(let _ of b){let D=Le({data:{pending:{formID:_.formID,src:URL.createObjectURL(_.file)}}}),{focus:I}=k,N=I.getNode();rn(D),ln(N)&&!N.__first&&N.remove()}}}),f({files:b}),!0):!1},Xa))},e[13]=r,e[14]=f,e[15]=g):g=e[15];let T;e[16]!==r?(T=[r],e[16]=r,e[17]=T):T=e[17],Ux(g,T);let E;return e[18]!==l?(E=Rx(Va,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function Vx(t){return{file:t.file,formID:t.formID}}function zx(){for(let t of Ya()){let e=t.node;Je(e)&&e.getData()?.pending&&e.remove()}}function Kx(t){return[t.formID,t]}var Xx=v({nodes:[Ke],plugins:[{Component:qa,position:"normal"}],slashMenu:{groups:[Z([{Icon:en,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[ge([{ChildComponent:en,isActive:({selection:t})=>{if(!Jx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Je(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as Yx}from"react/compiler-runtime";import{jsx as Do}from"react/jsx-runtime";import{createElement as qx}from"react";import{ShimmerEffect as Qx,useConfig as eC}from"@payloadcms/ui";import{lazy as tC,Suspense as oC,useEffect as rC,useState as nC}from"react";var Qa={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var sn={namespace:"lexical",theme:Qa};function ec({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as Zx}from"payload/shared";var tc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Zx(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function an(t,e,o,r){return{admin:o,features:tc(t),lexical:e,resolvedFeatureMap:t,view:r}}var lC=tC(()=>import("./Field-5ZXLEL3U.js").then(t=>({default:t.RichText}))),iC=t=>Do(Uo,{inheritable:!0,views:t.views,children:Do(sC,{...t})}),sC=t=>{let e=Yx(23),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,h=i===void 0?sn:i,{currentView:f}=Go(),g=c?.[f]?.admin??a,T=c?.[f]?.lexical,E;e[4]!==h||e[5]!==T?(E=typeof T=="function"?T(h):T??h,e[4]=h,e[5]=T,e[6]=E):E=e[6];let S=E,{config:x}=eC(),[b,C]=nC(null),k,_;e[7]!==r||e[8]!==x||e[9]!==f||e[10]!==g||e[11]!==S||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==d||e[17]!==c?(k=()=>{if(b&&b.view===f)return;let I=c?.[f],N=I?.filterFeatures?I.filterFeatures(r):r,L=[];for(let R of Object.values(N))R.clientFeatureProvider&&L.push(R.clientFeatureProvider(R.clientFeatureProps));let w=ec({config:x,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:L,lexical:S}});C(an(w,S,g,f))},_=[g,r,x,p,l,s,b,S,d,f,c],e[7]=r,e[8]=x,e[9]=f,e[10]=g,e[11]=S,e[12]=p,e[13]=l,e[14]=s,e[15]=b,e[16]=d,e[17]=c,e[18]=k,e[19]=_):(k=e[18],_=e[19]),rC(k,_);let D;return e[20]!==b||e[21]!==t?(D=Do(oC,{fallback:Do(Qx,{height:"35vh"}),children:b&&qx(lC,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=D):D=e[22],D};function aC(t){return t instanceof HTMLElement}function cC(...t){return t.filter(Boolean).join(" ")}var Ao=new WeakMap;function oc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Oo(t,e){let o=Ao.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=oc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=oc(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Ao.set(t,o)}return o.listeners.add(e),()=>{uC(t,e)}}function uC(t,e){let o=Ao.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Ao.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function dC(t,e){return Oo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function mC(t,e){return Oo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function pC(t,e){return Oo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function fC(t,e){return Oo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as hC}from"react/compiler-runtime";import{jsx as gC}from"react/jsx-runtime";import"react";var xC=()=>{let t=hC(2),{EditButton:e}=fe(),o;return t[0]!==e?(o=e?gC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as CC}from"react/compiler-runtime";import{jsx as bC}from"react/jsx-runtime";import"react";var kC=()=>{let t=CC(2),{RemoveButton:e}=fe(),o;return t[0]!==e?(o=e?bC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _C}from"react/compiler-runtime";import{jsx as TC}from"react/jsx-runtime";import"react";var wC=()=>{let t=_C(2),{Label:e}=fe(),o;return t[0]!==e?(o=e?TC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as SC}from"react/compiler-runtime";import{jsx as EC}from"react/jsx-runtime";import"react";var NC=t=>{let e=SC(3),{children:o}=t,{InlineBlockContainer:r}=fe(),n;return e[0]!==r||e[1]!==o?(n=r?EC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as LC}from"react/jsx-runtime";import"react";var yC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ie();return r?LC(r,{...o,children:e}):null};import{c as RC}from"react/compiler-runtime";import{jsx as IC}from"react/jsx-runtime";import"react";var vC=()=>{let t=RC(2),{EditButton:e}=ie(),o;return t[0]!==e?(o=e?IC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as MC}from"react/compiler-runtime";import{jsx as $C}from"react/jsx-runtime";import"react";var DC=()=>{let t=MC(2),{RemoveButton:e}=ie(),o;return t[0]!==e?(o=e?$C(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as AC}from"qs-esm";var OC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=AC({depth:e??0,draft:o??!1,locale:r,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var rc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
61
61
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
62
62
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
63
63
  `)&&(t=t.slice(1)),t.endsWith(`
64
64
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
65
- `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as FC}from"react/jsx-runtime";import{CodeField as PC,useFormFields as BC}from"@payloadcms/ui";import{useId as jC,useMemo as HC}from"react";var Po={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var UC=({autoComplete:t,field:e,forceRender:o,languages:r=Po,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=BC(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",p=jC(),h=r[m],f=HC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&FC(PC,{autoComplete:t,field:f,forceRender:o,onMount:(T,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async x=>{let C=await(await fetch(x.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(C,x.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as oe,jsxs as dc}from"react/jsx-runtime";import{useLexicalEditable as XC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as ZC,Combobox as YC,CopyToClipboard as qC,PopupList as QC,RenderFields as e2,useForm as t2,useFormFields as mc,useTranslation as o2}from"@payloadcms/ui";import r2 from"react";import{jsx as nc}from"react/jsx-runtime";import"react";var lc=()=>nc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:nc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as sc}from"react/jsx-runtime";import"react";import{useCollapsible as WC}from"@payloadcms/ui";import{jsx as ic}from"react/jsx-runtime";import"react";var Bo=()=>ic("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:ic("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var GC="code-block-collapse-button",ac=()=>{let{toggle:t}=WC();return sc("button",{className:GC,onClick:t,type:"button",children:sc(Bo,{})})};import{jsx as cc,jsxs as VC}from"react/jsx-runtime";import"react";import{useCollapsible as KC,useTranslation as JC}from"@payloadcms/ui";var zC="code-block-floating-collapse-button",uc=()=>{let{isCollapsed:t,toggle:e}=KC(),{t:o}=JC();return t?VC("button",{className:zC,onClick:e,type:"button",children:[cc("span",{children:o("general:collapse")}),cc(Bo,{})]}):null};var We="payload-richtext-code-block",n2=t=>{let{languages:e}=t,o=e||Po,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=le(),{setModified:s}=t2(),{t:i}=o2(),{codeField:d}=mc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=mc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=XC(),p=r2.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:oe(QC.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${We}__language-code`,"data-language":h,children:f})})})),[o,u]);return oe(r,{Actions:dc("div",{className:`${We}__actions`,children:[oe(YC,{button:dc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(ZC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(qC,{value:d?.value??""}),oe(ac,{}),m&&oe(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:oe(uc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${We}__pill`,children:oe(lc,{})}),children:oe(e2,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as l2}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as i2,FieldPathContext as pc,ServerFunctionsContext as fc,ShimmerEffect as s2,useServerFunctions as a2}from"@payloadcms/ui";import c2,{useEffect as u2,useRef as d2}from"react";var m2=t=>{let e=l2(10),{name:o,field:r,initialValue:n,label:l,Loading:s,path:i,schemaPath:d,setValue:c,value:u}=t,[a,m]=c2.useState(null),p=a2(),{_internal_renderField:h}=p,[f,g]=d.split(".",2),T=o!==void 0?o:r?.name,E=l!==void 0?l:r?.label,S=i??T??"",x;e[0]!==h||e[1]!==E||e[2]!==T||e[3]!==n||e[4]!==i||e[5]!==d?(x=()=>{(async function(){let{Field:w}=await h({name:T,hidden:!1,initialValue:n??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:d});m(w)})()},e[0]=h,e[1]=E,e[2]=T,e[3]=n,e[4]=i,e[5]=d,e[6]=x):x=e[6];let b=x,C=d2(!1),k,_;if(e[7]!==b?(k=()=>{C.current||(C.current=!0,b())},_=[b],e[7]=b,e[8]=k,e[9]=_):(k=e[8],_=e[9]),u2(k,_),!a)return typeof s<"u"?s:pt(s2,{});let $={...p,getFormState:async N=>p.getFormState({...N,collectionSlug:f==="collection"?g:void 0,globalSlug:f==="global"?g:void 0})};if(typeof u>"u"&&!c)return pt(fc,{value:{...$},children:pt(pc,{value:S,children:a},S)});let v={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:S,setValue:c??p2,showError:!1,value:u};return pt(fc,{value:{...$},children:pt(pc,{value:S,children:pt(i2,{value:v,children:a})},S)})};function p2(){}function hc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var f2=hc;export{It as $createAutoLinkNode,Fe as $createBlockNode,et as $createHorizontalRuleNode,Ct as $createInlineBlockNode,be as $createLinkNode,Ge as $createRelationshipNode,ve as $createUploadNode,_e as $isAutoLinkNode,Oe as $isBlockNode,Rt as $isHorizontalRuleNode,bt as $isInlineBlockNode,K as $isLinkNode,Mr as $isRelationshipNode,Ze as $isUploadNode,Fc as AlignFeatureClient,ke as AutoLinkNode,yC as BlockCollapsible,vC as BlockEditButton,se as BlockNode,DC as BlockRemoveButton,Wc as BlockquoteFeatureClient,ed as BlocksFeatureClient,wd as BoldFeatureClient,ne as CAN_USE_DOM,Mf as ChecklistFeatureClient,n2 as CodeBlockBlockComponent,UC as CodeComponent,S0 as DETAIL_TYPE_TO_DETAIL,k0 as DOUBLE_LINE_BREAK,F0 as DebugJsxConverterFeatureClient,N0 as ELEMENT_FORMAT_TO_TYPE,E0 as ELEMENT_TYPE_TO_FORMAT,Tc as ENABLE_SLASH_MENU_COMMAND,Cc as EditorConfigProvider,kt as FieldsDrawer,ch as FixedToolbarFeatureClient,Cm as HeadingFeatureClient,Om as HorizontalRuleFeatureClient,Ce as HorizontalRuleNode,qe as INSERT_BLOCK_COMMAND,Qe as INSERT_INLINE_BLOCK_COMMAND,C0 as IS_ALL_FORMATTING,qm as IndentFeatureClient,NC as InlineBlockContainer,xC as InlineBlockEditButton,wC as InlineBlockLabel,xt as InlineBlockNode,kC as InlineBlockRemoveButton,yd as InlineCodeFeatureClient,wh as InlineToolbarFeatureClient,Md as ItalicFeatureClient,T0 as LTR_REGEX,t0 as LexicalPluginToLexicalFeatureClient,xf as LinkFeatureClient,te as LinkNode,b0 as NON_BREAKING_SPACE,O as NodeFormat,jf as OrderedListFeatureClient,u0 as ParagraphFeatureClient,kc as Point,_0 as RTL_REGEX,wc as Rect,R1 as RelationshipFeatureClient,we as RelationshipNode,m2 as RenderLexical,iC as RichTextField,Uo as RichTextViewProvider,a0 as SlateToLexicalFeatureClient,Fd as StrikethroughFeatureClient,Hd as SubscriptFeatureClient,Vd as SuperscriptFeatureClient,L0 as TEXT_MODE_TO_TYPE,w0 as TEXT_TYPE_TO_FORMAT,y0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,bx as TableFeatureClient,fd as TestRecorderFeatureClient,sm as TextStateFeatureClient,Ht as ToolbarButton,Ut as ToolbarDropdown,bd as TreeViewFeatureClient,Zd as UnderlineFeatureClient,Jf as UnorderedListFeatureClient,Xx as UploadFeatureClient,Xe as UploadNode,fC as addSwipeDownListener,dC as addSwipeLeftListener,mC as addSwipeRightListener,pC as addSwipeUpListener,f2 as buildDefaultEditorState,hc as buildEditorState,rc as codeConverterClient,cr as createBlockNode,M as createClientFeature,P0 as defaultColors,sn as defaultEditorLexicalConfig,Br as getDOMRangeRect,Sc as getEnabledNodes,OC as getRestPopulateFn,tt as getSelectedNode,aC as isHTMLElement,_c as isPoint,cC as joinClasses,an as sanitizeClientEditorConfig,tc as sanitizeClientFeatures,No as setFloatingElemPosition,ho as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,dr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,le as useBlockComponentContext,G as useEditorConfigContext,he as useInlineBlockComponentContext,bc as useLexicalDocumentDrawer,fe as useLexicalDrawer,jt as useLexicalListDrawer,Go as useRichTextView};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as FC}from"react/jsx-runtime";import{CodeField as PC,useFormFields as BC}from"@payloadcms/ui";import{useId as jC,useMemo as HC}from"react";var Fo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var UC=({autoComplete:t,field:e,forceRender:o,languages:r=Fo,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=BC(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",p=jC(),h=r[m],f=HC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&FC(PC,{autoComplete:t,field:f,forceRender:o,onMount:(T,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async x=>{let C=await(await fetch(x.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(C,x.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as re,jsxs as dc}from"react/jsx-runtime";import{useLexicalEditable as XC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as ZC,Combobox as YC,CopyToClipboard as qC,PopupList as QC,RenderFields as e2,useForm as t2,useFormFields as mc,useTranslation as o2}from"@payloadcms/ui";import r2 from"react";import{jsx as nc}from"react/jsx-runtime";import"react";var lc=()=>nc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:nc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as sc}from"react/jsx-runtime";import"react";import{useCollapsible as WC}from"@payloadcms/ui";import{jsx as ic}from"react/jsx-runtime";import"react";var Po=()=>ic("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:ic("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var GC="code-block-collapse-button",ac=()=>{let{toggle:t}=WC();return sc("button",{className:GC,onClick:t,type:"button",children:sc(Po,{})})};import{jsx as cc,jsxs as VC}from"react/jsx-runtime";import"react";import{useCollapsible as KC,useTranslation as JC}from"@payloadcms/ui";var zC="code-block-floating-collapse-button",uc=()=>{let{isCollapsed:t,toggle:e}=KC(),{t:o}=JC();return t?VC("button",{className:zC,onClick:e,type:"button",children:[cc("span",{children:o("general:collapse")}),cc(Po,{})]}):null};var je="payload-richtext-code-block",n2=t=>{let{languages:e}=t,o=e||Fo,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=ie(),{setModified:s}=t2(),{t:i}=o2(),{codeField:d}=mc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=mc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=XC(),p=r2.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:re(QC.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:re("span",{className:`${je}__language-code`,"data-language":h,children:f})})})),[o,u]);return re(r,{Actions:dc("div",{className:`${je}__actions`,children:[re(YC,{button:dc("div",{className:`${je}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(ZC,{className:`${je}__chevron`})]}),buttonType:"custom",className:`${je}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(qC,{value:d?.value??""}),re(ac,{}),m&&re(l,{})]}),className:je,collapsibleProps:{AfterCollapsible:re(uc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${je}__pill`,children:re(lc,{})}),children:re(e2,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as l2}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import{FieldContext as i2,FieldPathContext as pc,ServerFunctionsContext as fc,ShimmerEffect as s2,useServerFunctions as a2}from"@payloadcms/ui";import c2,{useEffect as u2,useRef as d2}from"react";var m2=t=>{let e=l2(10),{name:o,field:r,initialValue:n,label:l,Loading:s,path:i,schemaPath:d,setValue:c,value:u}=t,[a,m]=c2.useState(null),p=a2(),{_internal_renderField:h}=p,[f,g]=d.split(".",2),T=o!==void 0?o:r?.name,E=l!==void 0?l:r?.label,S=i??T??"",x;e[0]!==h||e[1]!==E||e[2]!==T||e[3]!==n||e[4]!==i||e[5]!==d?(x=()=>{(async function(){let{Field:w}=await h({name:T,hidden:!1,initialValue:n??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:d});m(w)})()},e[0]=h,e[1]=E,e[2]=T,e[3]=n,e[4]=i,e[5]=d,e[6]=x):x=e[6];let b=x,C=d2(!1),k,_;if(e[7]!==b?(k=()=>{C.current||(C.current=!0,b())},_=[b],e[7]=b,e[8]=k,e[9]=_):(k=e[8],_=e[9]),u2(k,_),!a)return typeof s<"u"?s:dt(s2,{});let D={...p,getFormState:async N=>p.getFormState({...N,collectionSlug:f==="collection"?g:void 0,globalSlug:f==="global"?g:void 0})};if(typeof u>"u"&&!c)return dt(fc,{value:{...D},children:dt(pc,{value:S,children:a},S)});let I={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:S,setValue:c??p2,showError:!1,value:u};return dt(fc,{value:{...D},children:dt(pc,{value:S,children:dt(i2,{value:I,children:a})},S)})};function p2(){}function hc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var f2=hc;export{Rt as $createAutoLinkNode,$e as $createBlockNode,qe as $createHorizontalRuleNode,xt as $createInlineBlockNode,Ce as $createLinkNode,Be as $createRelationshipNode,Le as $createUploadNode,ke as $isAutoLinkNode,Me as $isBlockNode,yt as $isHorizontalRuleNode,Ct as $isInlineBlockNode,K as $isLinkNode,Mr as $isRelationshipNode,Je as $isUploadNode,Fc as AlignFeatureClient,be as AutoLinkNode,yC as BlockCollapsible,vC as BlockEditButton,se as BlockNode,DC as BlockRemoveButton,Wc as BlockquoteFeatureClient,ed as BlocksFeatureClient,wd as BoldFeatureClient,le as CAN_USE_DOM,Mf as ChecklistFeatureClient,n2 as CodeBlockBlockComponent,UC as CodeComponent,S0 as DETAIL_TYPE_TO_DETAIL,k0 as DOUBLE_LINE_BREAK,F0 as DebugJsxConverterFeatureClient,N0 as ELEMENT_FORMAT_TO_TYPE,E0 as ELEMENT_TYPE_TO_FORMAT,Tc as ENABLE_SLASH_MENU_COMMAND,Cc as EditorConfigProvider,bt as FieldsDrawer,ch as FixedToolbarFeatureClient,Cm as HeadingFeatureClient,Om as HorizontalRuleFeatureClient,xe as HorizontalRuleNode,Ze as INSERT_BLOCK_COMMAND,Ye as INSERT_INLINE_BLOCK_COMMAND,C0 as IS_ALL_FORMATTING,qm as IndentFeatureClient,NC as InlineBlockContainer,xC as InlineBlockEditButton,wC as InlineBlockLabel,gt as InlineBlockNode,kC as InlineBlockRemoveButton,yd as InlineCodeFeatureClient,wh as InlineToolbarFeatureClient,Md as ItalicFeatureClient,T0 as LTR_REGEX,t0 as LexicalPluginToLexicalFeatureClient,xf as LinkFeatureClient,oe as LinkNode,b0 as NON_BREAKING_SPACE,O as NodeFormat,jf as OrderedListFeatureClient,u0 as ParagraphFeatureClient,kc as Point,_0 as RTL_REGEX,wc as Rect,R1 as RelationshipFeatureClient,Te as RelationshipNode,m2 as RenderLexical,iC as RichTextField,Uo as RichTextViewProvider,a0 as SlateToLexicalFeatureClient,Fd as StrikethroughFeatureClient,Hd as SubscriptFeatureClient,Vd as SuperscriptFeatureClient,L0 as TEXT_MODE_TO_TYPE,w0 as TEXT_TYPE_TO_FORMAT,y0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,bx as TableFeatureClient,fd as TestRecorderFeatureClient,sm as TextStateFeatureClient,jt as ToolbarButton,Ht as ToolbarDropdown,bd as TreeViewFeatureClient,Zd as UnderlineFeatureClient,Jf as UnorderedListFeatureClient,Xx as UploadFeatureClient,Ke as UploadNode,fC as addSwipeDownListener,dC as addSwipeLeftListener,mC as addSwipeRightListener,pC as addSwipeUpListener,f2 as buildDefaultEditorState,hc as buildEditorState,rc as codeConverterClient,cr as createBlockNode,v as createClientFeature,P0 as defaultColors,sn as defaultEditorLexicalConfig,Br as getDOMRangeRect,Sc as getEnabledNodes,OC as getRestPopulateFn,Qe as getSelectedNode,aC as isHTMLElement,_c as isPoint,cC as joinClasses,an as sanitizeClientEditorConfig,tc as sanitizeClientFeatures,Eo as setFloatingElemPosition,fo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,ge as toolbarAddDropdownGroupWithItems,dr as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ie as useBlockComponentContext,G as useEditorConfigContext,fe as useInlineBlockComponentContext,bc as useLexicalDocumentDrawer,pe as useLexicalDrawer,Bt as useLexicalListDrawer,Go as useRichTextView};
66
66
  //# sourceMappingURL=index.js.map