@payloadcms/richtext-lexical 3.1.0 → 3.1.1-canary.8409de7

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 (50) hide show
  1. package/dist/exports/client/{Field-OHQPCDNR.js → Field-US3A77DK.js} +2 -2
  2. package/dist/exports/client/Field-US3A77DK.js.map +7 -0
  3. package/dist/exports/client/chunk-RVUPNSJ7.js +2 -0
  4. package/dist/exports/client/{chunk-KYPSISKB.js.map → chunk-RVUPNSJ7.js.map} +3 -3
  5. package/dist/exports/client/componentInline-ZAGE2KFL.js +2 -0
  6. package/dist/exports/client/index.js +11 -11
  7. package/dist/exports/client/index.js.map +3 -3
  8. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  9. package/dist/features/blocks/client/component/index.js +2 -4
  10. package/dist/features/blocks/client/component/index.js.map +1 -1
  11. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  12. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -3
  13. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  14. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  15. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +1 -3
  16. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  17. package/dist/features/link/server/index.d.ts.map +1 -1
  18. package/dist/features/link/server/index.js +2 -3
  19. package/dist/features/link/server/index.js.map +1 -1
  20. package/dist/field/rscEntry.d.ts.map +1 -1
  21. package/dist/field/rscEntry.js +2 -0
  22. package/dist/field/rscEntry.js.map +1 -1
  23. package/dist/getDefaultSanitizedEditorConfig.d.ts +7 -0
  24. package/dist/getDefaultSanitizedEditorConfig.d.ts.map +1 -0
  25. package/dist/getDefaultSanitizedEditorConfig.js +22 -0
  26. package/dist/getDefaultSanitizedEditorConfig.js.map +1 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +32 -30
  29. package/dist/index.js.map +1 -1
  30. package/dist/lexical/LexicalProvider.js +2 -2
  31. package/dist/lexical/LexicalProvider.js.map +1 -1
  32. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  33. package/dist/lexical/config/server/loader.js +9 -8
  34. package/dist/lexical/config/server/loader.js.map +1 -1
  35. package/dist/types.d.ts +4 -3
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js.map +1 -1
  38. package/dist/utilities/buildInitialState.d.ts +2 -1
  39. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  40. package/dist/utilities/buildInitialState.js +1 -0
  41. package/dist/utilities/buildInitialState.js.map +1 -1
  42. package/dist/utilities/initLexicalFeatures.d.ts +2 -1
  43. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  44. package/dist/utilities/initLexicalFeatures.js +3 -43
  45. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  46. package/package.json +6 -6
  47. package/dist/exports/client/Field-OHQPCDNR.js.map +0 -7
  48. package/dist/exports/client/chunk-KYPSISKB.js +0 -2
  49. package/dist/exports/client/componentInline-EYXL5S2C.js +0 -2
  50. /package/dist/exports/client/{componentInline-EYXL5S2C.js.map → componentInline-ZAGE2KFL.js.map} +0 -0
@@ -1,6 +1,6 @@
1
- "use client";import{a as be,c as ro,d as no,e as io}from"./chunk-KYPSISKB.js";import{a as Be,b as gt,c as Ct,d as xt}from"./chunk-XCEM47RI.js";import{a as je,b as Ge,c as Ue,d as lo}from"./chunk-ZTAS32RX.js";import{a as He,b as bt,c as We,d as Ve,e as Ke,f as so}from"./chunk-DOK5S7LE.js";import{a as ce}from"./chunk-2CYU43GM.js";import{a as ds}from"./chunk-5PBXL4HT.js";import{a as us,b as mr,d as pr,e as fr,f as hr,g as ms,h as ps,i as fs,k as hs,m as gs,n as Cs}from"./chunk-2L2Z4JHF.js";import{a as cs,b as B}from"./chunk-CUIBIFW2.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as _e,$isRangeSelection as Tt,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{jsx as ao,jsxs as xs}from"react/jsx-runtime";import"react";var gr=()=>xs("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:[ao("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as co,jsxs as bs}from"react/jsx-runtime";import"react";var Cr=()=>bs("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 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as uo,jsxs as _s}from"react/jsx-runtime";import"react";var _t=()=>_s("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 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as mo,jsxs as Ts}from"react/jsx-runtime";import"react";var xr=()=>Ts("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:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({featureClientSchemaMap:n,featureProviderMap:i,field:l,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d})=>{let c=t({featureClientSchemaMap:n,featureProviderMap:i,field:l,props:o,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d});return c.sanitizedClientFeatureProps===null&&(c.sanitizedClientFeatureProps=o),c};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var br=t=>({type:"dropdown",ChildComponent:_t,items:t,key:"align",order:30});var _r=[br([{ChildComponent:_t,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:gr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:xr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Cr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],Es=y({toolbarFixed:{groups:_r},toolbarInline:{groups:_r}});import{$createQuoteNode as Rr,$isQuoteNode as Nr,QuoteNode as Ls}from"@lexical/rich-text";import{$setBlocksType as Sr}from"@lexical/selection";import{$getSelection as Ir,$isRangeSelection as Rs}from"lexical";import{jsx as Tr}from"react/jsx-runtime";import"react";var po=()=>Tr("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:Tr("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 Er}from"react/jsx-runtime";import"react";var ze=()=>Er("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:Er("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 q=t=>({type:"dropdown",ChildComponent:ze,items:t,key:"text",order:25});import{$createQuoteNode as ws,$isQuoteNode as wr,QuoteNode as ks}from"@lexical/rich-text";import{$createLineBreakNode as Ns}from"lexical";var kr={type:"element",dependencies:[ks],export:(t,e)=>{if(!wr(t))return null;let o=e(t).split(`
1
+ "use client";import{a as be,c as ro,d as no,e as io}from"./chunk-RVUPNSJ7.js";import{a as Be,b as gt,c as Ct,d as xt}from"./chunk-XCEM47RI.js";import{a as je,b as Ge,c as Ue,d as lo}from"./chunk-ZTAS32RX.js";import{a as He,b as bt,c as We,d as Ve,e as Ke,f as so}from"./chunk-DOK5S7LE.js";import{a as ce}from"./chunk-2CYU43GM.js";import{a as ds}from"./chunk-5PBXL4HT.js";import{a as us,b as mr,d as pr,e as fr,f as hr,g as ms,h as ps,i as fs,k as hs,m as gs,n as Cs}from"./chunk-2L2Z4JHF.js";import{a as cs,b as B}from"./chunk-CUIBIFW2.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as _e,$isRangeSelection as Tt,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{jsx as ao,jsxs as xs}from"react/jsx-runtime";import"react";var gr=()=>xs("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:[ao("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as co,jsxs as bs}from"react/jsx-runtime";import"react";var Cr=()=>bs("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 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as uo,jsxs as _s}from"react/jsx-runtime";import"react";var _t=()=>_s("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 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as mo,jsxs as Ts}from"react/jsx-runtime";import"react";var xr=()=>Ts("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:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({featureClientSchemaMap:n,featureProviderMap:i,field:l,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d})=>{let c=t({featureClientSchemaMap:n,featureProviderMap:i,field:l,props:o,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d});return c.sanitizedClientFeatureProps===null&&(c.sanitizedClientFeatureProps=o),c};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var br=t=>({type:"dropdown",ChildComponent:_t,items:t,key:"align",order:30});var _r=[br([{ChildComponent:_t,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:gr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:xr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Cr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],Es=y({toolbarFixed:{groups:_r},toolbarInline:{groups:_r}});import{$createQuoteNode as Rr,$isQuoteNode as Nr,QuoteNode as Ls}from"@lexical/rich-text";import{$setBlocksType as Ir}from"@lexical/selection";import{$getSelection as Sr,$isRangeSelection as Rs}from"lexical";import{jsx as Tr}from"react/jsx-runtime";import"react";var po=()=>Tr("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:Tr("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 Er}from"react/jsx-runtime";import"react";var ze=()=>Er("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:Er("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 q=t=>({type:"dropdown",ChildComponent:ze,items:t,key:"text",order:25});import{$createQuoteNode as ws,$isQuoteNode as wr,QuoteNode as ks}from"@lexical/rich-text";import{$createLineBreakNode as Ns}from"lexical";var kr={type:"element",dependencies:[ks],export:(t,e)=>{if(!wr(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 i=t.getPreviousSibling();if(wr(i)){i.splice(i.getChildrenSize(),0,[Ns(),...e]),i.select(0,0),t.remove();return}}let n=ws();n.append(...e),t.replace(n),n.select(0,0)}};var Lr=[q([{ChildComponent:po,isActive:({selection:t})=>{if(!Rs(t))return!1;for(let e of t.getNodes())if(!Nr(e)&&!Nr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ir();Sr(e,()=>Rr())})},order:20}])],Ss=y({markdownTransformers:[kr],nodes:[Ls],slashMenu:{groups:[Z([{Icon:po,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ir();Sr(e,()=>Rr())})}}])]},toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{getTranslation as It}from"@payloadcms/translations";import{jsx as fo,jsxs as Is}from"react/jsx-runtime";import"react";var wt=()=>Is("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:[fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as yr}from"react/jsx-runtime";import"react";var kt=()=>yr("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:yr("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 la}from"react/jsx-runtime";import sa from"bson-objectid";import"react";import{DecoratorBlockNode as ys}from"@lexical/react/LexicalDecoratorBlockNode.js";import vs from"bson-objectid";import{deepCopyObjectSimple as Ms}from"payload/shared";var Ze=class extends ys{__fields;constructor({fields:e,format:o,key:r}){super(o,r),this.__fields=e}static clone(e){return new this({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=Ds(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=Ms(e),r=this.getWritable();r.__fields=o}};function Ds(t){return new Ze({fields:{...t,id:t?.id||new vs.default().toHexString()}})}import{jsx as X,jsxs as Lt,Fragment as Hs}from"react/jsx-runtime";import{Button as Ar,Collapsible as js,Drawer as Gs,EditDepthProvider as Us,ErrorPill as Ws,Form as Vs,formatDrawerSlug as Ks,FormSubmit as zs,Pill as Zs,RenderFields as Xs,SectionTitle as Ys,useDocumentInfo as Or,useEditDepth as Js,useFormSubmitted as qs,useServerFunctions as Qs,useTranslation as ea}from"@payloadcms/ui";import{abortAndIgnore as ho}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as ta,reduceFieldsToValues as Fr}from"payload/shared";import Xe,{useCallback as go,useEffect as $r,useMemo as Ye,useRef as oa}from"react";import{useLexicalComposerContext as ra}from"@lexical/react/LexicalComposerContext";import{getTranslation as na}from"@payloadcms/translations";import{$getNodeByKey as Co}from"lexical";import{v4 as ia}from"uuid";import{c as As}from"react/compiler-runtime";import{jsx as Nt,jsxs as Os}from"react/jsx-runtime";import{RenderFields as Fs,useFormSubmitted as $s}from"@payloadcms/ui";import Ps,{createContext as Bs}from"react";var vr=Bs({initialState:!1}),ve=()=>Ps.useContext(vr),Mr=t=>{let e=As(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:d,RemoveButton:c}=t,m=$s()&&l>0,p,f;e[0]!==r||e[1]!==l||e[2]!==m?(f=w=>Nt(r,{editButton:w.editButton,errorCount:l,fieldHasErrors:m,Label:w.Label,removeButton:w.removeButton,children:w.children}),e[0]=r,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,C;return e[4]!==n||e[5]!==h||e[6]!==i||e[7]!==a||e[8]!==d||e[9]!==c||e[10]!==o||e[11]!==s?(C=n?Os(vr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:d,RemoveButton:c},children:[n,Nt(o,{})]}):Nt(h,{children:Nt(Fs,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=n,e[5]=h,e[6]=i,e[7]=a,e[8]=d,e[9]=c,e[10]=o,e[11]=s,e[12]=C):C=e[12],C};function Dr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var re="lexical-block",Pr=t=>{let{formData:e,nodeKey:o}=t,r=qs(),{id:n,collectionSlug:i,globalSlug:l}=Or(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:d,permissions:c,readOnly:u,schemaPath:m},uuid:p}=B(),f=oa(new AbortController),h=Js(),[C,w]=Xe.useState(0),v=Ks({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:D}=ce(v),{getDocPreferences:x,setDocFieldPreferences:E}=Or(),[g]=ra(),{getFormState:_}=Qs(),N=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[k,R]=Xe.useState(d?.[e.id]?.formState?{...d?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1),[S,b]=Xe.useState(k?._components?.customComponents?.BlockLabel),[T,I]=Xe.useState(k?._components?.customComponents?.Block);$r(()=>{let j=new AbortController;return e&&!k&&(async()=>{let{state:K}=await _({id:n,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await x(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:N,signal:j.signal});K&&(K.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},R(K),b(K._components?.customComponents?.BlockLabel),I(K._components?.customComponents?.Block))})(),()=>{ho(j)}},[_,N,n,e,k,i,l,x]);let[L,A]=Xe.useState(d?.[e.id]?.collapsed??!1),M=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,$=s.blocks[M][0].blocks[0],{i18n:W,t:J}=ea(),U=go(async({formState:j,submit:te})=>{ho(f.current);let K=new AbortController;f.current=K;let{state:z}=await _({id:n,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),formState:j,globalSlug:l,operation:"update",renderAllFields:!!te,schemaPath:N,signal:K.signal});if(!z)return j;z.blockName=j.blockName;let oe=Fr(Dr({fields:ta(z)}),!0);if(setTimeout(()=>{g.update(()=>{let xe=Co(o);if(xe&&Rt(xe)){let ye={...oe,blockType:e.blockType};xe.setFields(ye)}})},0),te){b(z._components?.customComponents?.BlockLabel),I(z._components?.customComponents?.Block);let xe=0;for(let ye of Object.values(z))ye?.valid===!1&&xe++;w(xe)}return z},[_,n,i,x,l,N,e.blockType,g,o]);$r(()=>()=>{ho(f.current)},[]);let H=go(()=>{g.update(()=>{Co(o)?.remove()})},[g,o]),ee=$?.labels?.singular?na($.labels.singular,W):$?.slug,pt=go(j=>{x().then(te=>{let z=te?.fields?.[a.name]?.collapsed,oe=z&&z?.length?z:[];j?oe.includes(e.id)||oe.push(e.id):oe.includes(e.id)&&oe.splice(oe.indexOf(e.id),1),E(a.name,{collapsed:oe,hello:"hi"})})},[x,a.name,E,e.id]),ie=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__editButton`,disabled:u,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),D(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:J("lexical:blocks:inlineBlocks:edit",{label:ee})}),[ee,u,J,D]),Ie=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),H()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,H]),ft=Ye(()=>({children:j,editButton:te,errorCount:K,fieldHasErrors:z,Label:oe,removeButton:xe})=>X("div",{className:re+" "+re+"-"+e.blockType,children:X(js,{className:[`${re}__row`,z?`${re}__row--has-errors`:`${re}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:Lt("div",{className:`${re}__block-header`,children:[oe??S?oe??S:Lt("div",{children:[X(Zs,{className:`${re}__block-pill ${re}__block-pill-${e?.blockType}`,pillStyle:"white",children:ee}),X(Ys,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),z&&X(Ws,{count:K??0,i18n:W,withMessage:!0})]}),Lt("div",{children:[T&&te!==!1||!T&&te?X(ie,{}):null,xe!==!1&&g.isEditable()?X(Ie,{}):null]})]}),isCollapsed:L,onToggle:ye=>{pt(ye),A(ye)},children:j},0)}),[T,S,ie,Ie,ee,g,e.blockType,W,L,pt,a?.admin?.readOnly]),ht=Ye(()=>()=>X(Us,{children:X(Gs,{className:"",slug:v,title:J(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:ee??J("lexical:blocks:inlineBlocks:label")}),children:k?Lt(Hs,{children:[X(Xs,{fields:$.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:c,readOnly:!1}),X(zs,{children:J("fields:saveChanges")})]}):null})}),[k,v,ee,J,$.fields,N,c]);return Ye(()=>k?X(Vs,{beforeSubmit:[async({formState:j})=>await U({formState:j,submit:!0})],fields:$.fields,initialState:k,onChange:[U],onSubmit:j=>{let te=Fr(j);te.blockType=e.blockType,g.update(()=>{let K=Co(o);K&&Rt(K)&&K.setFields(te)}),D()},submitted:r,uuid:ia(),children:X(Mr,{baseClass:re,BlockDrawer:ht,Collapsible:ft,CustomBlock:T,EditButton:ie,errorCount:C,formSchema:$.fields,initialState:k,nodeKey:o,RemoveButton:Ie})}):null,[ft,ht,T,Ie,ie,g,C,D,$.fields,k,o,U,r])};var ue=class extends Ze{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=St(e.fields);return o.setFormat(e.format),o}decorate(e,o){return la(Pr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function St(t){return new ue({fields:{...t,id:t?.id||new sa.default().toHexString()}})}function Rt(t){return t instanceof ue}import{createCommand as Br}from"lexical";var Je=Br("INSERT_BLOCK_COMMAND"),qe=Br("INSERT_INLINE_BLOCK_COMMAND");import{c as aa}from"react/compiler-runtime";import{useLexicalComposerContext as ca}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ua,$wrapNodeInElement as da,mergeRegister as ma}from"@lexical/utils";import{formatDrawerSlug as pa,useEditDepth as fa}from"@payloadcms/ui";import{$createParagraphNode as ha,$getNodeByKey as ga,$getPreviousSelection as Ca,$getSelection as xa,$insertNodes as ba,$isParagraphNode as Hr,$isRangeSelection as _a,$isRootOrShadowRoot as Ta,COMMAND_PRIORITY_EDITOR as jr}from"lexical";import{useEffect as Ea,useState as wa}from"react";var Gr=()=>{let t=aa(10),[e]=ca(),[o,r]=wa(null),{uuid:n}=B(),i=fa(),l="lexical-inlineBlocks-create-"+n,s;t[0]!==l||t[1]!==i?(s=pa({slug:l,depth:i}),t[0]=l,t[1]=i,t[2]=s):s=t[2];let a=s,{toggleDrawer:d}=ce(a,!0),c;t[3]!==e||t[4]!==o?(c=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ma(e.registerCommand(Je,m=>(e.update(()=>{let p=xa()||Ca();if(_a(p)){let f=St(m);ua(f);let{focus:h}=p,C=h.getNode();Hr(C)&&C.getTextContentSize()===0&&C.getParentOrThrow().getChildren().filter(w=>Hr(w)).length>1&&C.remove()}}),!0),jr),e.registerCommand(qe,m=>{if(o){let f=ga(o);return!f||!io(f)?!1:(f.setFields(m),r(null),!0)}let p=no(m);return ba([p]),Ta(p.getParentOrThrow())&&da(p,ha).selectEnd(),!0},jr))},t[3]=e,t[4]=o,t[5]=c):c=t[5];let u;return t[6]!==e||t[7]!==o||t[8]!==d?(u=[e,o,d],t[6]=e,t[7]=o,t[8]=d,t[9]=u):u=t[9],Ea(c,u),null};var ka=y(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let r=`${o}.lexical_internal_feature.blocks.lexical_blocks`,n=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,u])=>u[0]),s=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,u])=>u[0]),a=l.map(c=>c.blocks[0]),d=s.map(c=>c.blocks[0]);return{nodes:[ue,ro],plugins:[{Component:Gr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:wt,key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:u})=>c?.labels?.singular?It(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(Je,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,d?.length?{items:d.map(c=>({Icon:kt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:u})=>c?.labels?.singular?It(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(qe,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:wt,items:a.map((c,u)=>({ChildComponent:wt,isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?It(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:c.slug})},order:u})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:kt,items:d.map((c,u)=>({ChildComponent:kt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?It(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:c.slug})},order:u})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Na}from"react/compiler-runtime";import{jsx as ke,jsxs as _o}from"react/jsx-runtime";import{useLexicalComposerContext as La}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ra,$createTextNode as Sa,$getRoot as Ia}from"lexical";import*as Kr from"react";import{useCallback as we,useEffect as xo,useLayoutEffect as Ur,useRef as bo,useState as yt}from"react";var ya=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)},va=(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)},Ma=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);
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(wr(i)){i.splice(i.getChildrenSize(),0,[Ns(),...e]),i.select(0,0),t.remove();return}}let n=ws();n.append(...e),t.replace(n),n.select(0,0)}};var Lr=[q([{ChildComponent:po,isActive:({selection:t})=>{if(!Rs(t))return!1;for(let e of t.getNodes())if(!Nr(e)&&!Nr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})},order:20}])],Is=y({markdownTransformers:[kr],nodes:[Ls],slashMenu:{groups:[Z([{Icon:po,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})}}])]},toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{getTranslation as St}from"@payloadcms/translations";import{jsx as fo,jsxs as Ss}from"react/jsx-runtime";import"react";var wt=()=>Ss("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:[fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as yr}from"react/jsx-runtime";import"react";var kt=()=>yr("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:yr("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 ia}from"react/jsx-runtime";import la from"bson-objectid";import"react";import{DecoratorBlockNode as ys}from"@lexical/react/LexicalDecoratorBlockNode.js";import vs from"bson-objectid";var Ze=class extends ys{__fields;constructor({fields:e,format:o,key:r}){super(o,r),this.__fields=e}static clone(e){return new this({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=Ms(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=this.getWritable();o.__fields=e}};function Ms(t){return new Ze({fields:{...t,id:t?.id||new vs.default().toHexString()}})}import{jsx as X,jsxs as Lt,Fragment as Bs}from"react/jsx-runtime";import{Button as Ar,Collapsible as Hs,Drawer as js,EditDepthProvider as Gs,ErrorPill as Us,Form as Ws,formatDrawerSlug as Vs,FormSubmit as Ks,Pill as zs,RenderFields as Zs,SectionTitle as Xs,useDocumentInfo as Or,useEditDepth as Ys,useFormSubmitted as Js,useServerFunctions as qs,useTranslation as Qs}from"@payloadcms/ui";import{abortAndIgnore as ho}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as ea,reduceFieldsToValues as Fr}from"payload/shared";import Xe,{useCallback as go,useEffect as $r,useMemo as Ye,useRef as ta}from"react";import{useLexicalComposerContext as oa}from"@lexical/react/LexicalComposerContext";import{getTranslation as ra}from"@payloadcms/translations";import{$getNodeByKey as Co}from"lexical";import{v4 as na}from"uuid";import{c as Ds}from"react/compiler-runtime";import{jsx as Nt,jsxs as As}from"react/jsx-runtime";import{RenderFields as Os,useFormSubmitted as Fs}from"@payloadcms/ui";import $s,{createContext as Ps}from"react";var vr=Ps({initialState:!1}),ve=()=>$s.useContext(vr),Mr=t=>{let e=Ds(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:d,RemoveButton:c}=t,m=Fs()&&l>0,p,f;e[0]!==r||e[1]!==l||e[2]!==m?(f=w=>Nt(r,{editButton:w.editButton,errorCount:l,fieldHasErrors:m,Label:w.Label,removeButton:w.removeButton,children:w.children}),e[0]=r,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,C;return e[4]!==n||e[5]!==h||e[6]!==i||e[7]!==a||e[8]!==d||e[9]!==c||e[10]!==o||e[11]!==s?(C=n?As(vr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:d,RemoveButton:c},children:[n,Nt(o,{})]}):Nt(h,{children:Nt(Os,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=n,e[5]=h,e[6]=i,e[7]=a,e[8]=d,e[9]=c,e[10]=o,e[11]=s,e[12]=C):C=e[12],C};function Dr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var re="lexical-block",Pr=t=>{let{formData:e,nodeKey:o}=t,r=Js(),{id:n,collectionSlug:i,globalSlug:l}=Or(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:d,permissions:c,readOnly:u,schemaPath:m},uuid:p}=B(),f=ta(new AbortController),h=Ys(),[C,w]=Xe.useState(0),v=Vs({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:D}=ce(v),{getDocPreferences:x,setDocFieldPreferences:E}=Or(),[g]=oa(),{getFormState:_}=qs(),N=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[k,R]=Xe.useState(d?.[e.id]?.formState?{...d?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1),[I,b]=Xe.useState(k?._components?.customComponents?.BlockLabel),[T,S]=Xe.useState(k?._components?.customComponents?.Block);$r(()=>{let j=new AbortController;return e&&!k&&(async()=>{let{state:K}=await _({id:n,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await x(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:N,signal:j.signal});K&&(K.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},R(K),b(K._components?.customComponents?.BlockLabel),S(K._components?.customComponents?.Block))})(),()=>{ho(j)}},[_,N,n,e,k,i,l,x]);let[L,A]=Xe.useState(d?.[e.id]?.collapsed??!1),M=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,$=s.blocks[M][0].blocks[0],{i18n:W,t:J}=Qs(),U=go(async({formState:j,submit:te})=>{ho(f.current);let K=new AbortController;f.current=K;let{state:z}=await _({id:n,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),formState:j,globalSlug:l,operation:"update",renderAllFields:!!te,schemaPath:N,signal:K.signal});if(!z)return j;z.blockName=j.blockName;let oe=Fr(Dr({fields:ea(z)}),!0);if(setTimeout(()=>{g.update(()=>{let xe=Co(o);if(xe&&Rt(xe)){let we=oe;we.blockType=e.blockType,xe.setFields(we)}})},0),te){b(z._components?.customComponents?.BlockLabel),S(z._components?.customComponents?.Block);let xe=0;for(let we of Object.values(z))we?.valid===!1&&xe++;w(xe)}return z},[_,n,i,x,l,N,e.blockType,g,o]);$r(()=>()=>{ho(f.current)},[]);let H=go(()=>{g.update(()=>{Co(o)?.remove()})},[g,o]),ee=$?.labels?.singular?ra($.labels.singular,W):$?.slug,pt=go(j=>{x().then(te=>{let z=te?.fields?.[a.name]?.collapsed,oe=z&&z?.length?z:[];j?oe.includes(e.id)||oe.push(e.id):oe.includes(e.id)&&oe.splice(oe.indexOf(e.id),1),E(a.name,{collapsed:oe,hello:"hi"})})},[x,a.name,E,e.id]),ie=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__editButton`,disabled:u,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),D(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:J("lexical:blocks:inlineBlocks:edit",{label:ee})}),[ee,u,J,D]),ye=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),H()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,H]),ft=Ye(()=>({children:j,editButton:te,errorCount:K,fieldHasErrors:z,Label:oe,removeButton:xe})=>X("div",{className:re+" "+re+"-"+e.blockType,children:X(Hs,{className:[`${re}__row`,z?`${re}__row--has-errors`:`${re}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:Lt("div",{className:`${re}__block-header`,children:[oe??I?oe??I:Lt("div",{children:[X(zs,{className:`${re}__block-pill ${re}__block-pill-${e?.blockType}`,pillStyle:"white",children:ee}),X(Xs,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),z&&X(Us,{count:K??0,i18n:W,withMessage:!0})]}),Lt("div",{children:[T&&te!==!1||!T&&te?X(ie,{}):null,xe!==!1&&g.isEditable()?X(ye,{}):null]})]}),isCollapsed:L,onToggle:we=>{pt(we),A(we)},children:j},0)}),[T,I,ie,ye,ee,g,e.blockType,W,L,pt,a?.admin?.readOnly]),ht=Ye(()=>()=>X(Gs,{children:X(js,{className:"",slug:v,title:J(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:ee??J("lexical:blocks:inlineBlocks:label")}),children:k?Lt(Bs,{children:[X(Zs,{fields:$.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:c,readOnly:!1}),X(Ks,{children:J("fields:saveChanges")})]}):null})}),[k,v,ee,J,$.fields,N,c]);return Ye(()=>k?X(Ws,{beforeSubmit:[async({formState:j})=>await U({formState:j,submit:!0})],fields:$.fields,initialState:k,onChange:[U],onSubmit:j=>{let te=Fr(j);te.blockType=e.blockType,g.update(()=>{let K=Co(o);K&&Rt(K)&&K.setFields(te)}),D()},submitted:r,uuid:na(),children:X(Mr,{baseClass:re,BlockDrawer:ht,Collapsible:ft,CustomBlock:T,EditButton:ie,errorCount:C,formSchema:$.fields,initialState:k,nodeKey:o,RemoveButton:ye})}):null,[ft,ht,T,ye,ie,g,C,D,$.fields,k,o,U,r])};var ue=class extends Ze{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=It(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ia(Pr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function It(t){return new ue({fields:{...t,id:t?.id||new la.default().toHexString()}})}function Rt(t){return t instanceof ue}import{createCommand as Br}from"lexical";var Je=Br("INSERT_BLOCK_COMMAND"),qe=Br("INSERT_INLINE_BLOCK_COMMAND");import{c as sa}from"react/compiler-runtime";import{useLexicalComposerContext as aa}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ca,$wrapNodeInElement as ua,mergeRegister as da}from"@lexical/utils";import{formatDrawerSlug as ma,useEditDepth as pa}from"@payloadcms/ui";import{$createParagraphNode as fa,$getNodeByKey as ha,$getPreviousSelection as ga,$getSelection as Ca,$insertNodes as xa,$isParagraphNode as Hr,$isRangeSelection as ba,$isRootOrShadowRoot as _a,COMMAND_PRIORITY_EDITOR as jr}from"lexical";import{useEffect as Ta,useState as Ea}from"react";var Gr=()=>{let t=sa(10),[e]=aa(),[o,r]=Ea(null),{uuid:n}=B(),i=pa(),l="lexical-inlineBlocks-create-"+n,s;t[0]!==l||t[1]!==i?(s=ma({slug:l,depth:i}),t[0]=l,t[1]=i,t[2]=s):s=t[2];let a=s,{toggleDrawer:d}=ce(a,!0),c;t[3]!==e||t[4]!==o?(c=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return da(e.registerCommand(Je,m=>(e.update(()=>{let p=Ca()||ga();if(ba(p)){let f=It(m);ca(f);let{focus:h}=p,C=h.getNode();Hr(C)&&C.getTextContentSize()===0&&C.getParentOrThrow().getChildren().filter(w=>Hr(w)).length>1&&C.remove()}}),!0),jr),e.registerCommand(qe,m=>{if(o){let f=ha(o);return!f||!io(f)?!1:(f.setFields(m),r(null),!0)}let p=no(m);return xa([p]),_a(p.getParentOrThrow())&&ua(p,fa).selectEnd(),!0},jr))},t[3]=e,t[4]=o,t[5]=c):c=t[5];let u;return t[6]!==e||t[7]!==o||t[8]!==d?(u=[e,o,d],t[6]=e,t[7]=o,t[8]=d,t[9]=u):u=t[9],Ta(c,u),null};var wa=y(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let r=`${o}.lexical_internal_feature.blocks.lexical_blocks`,n=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,u])=>u[0]),s=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,u])=>u[0]),a=l.map(c=>c.blocks[0]),d=s.map(c=>c.blocks[0]);return{nodes:[ue,ro],plugins:[{Component:Gr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:wt,key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:u})=>c?.labels?.singular?St(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(Je,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,d?.length?{items:d.map(c=>({Icon:kt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:u})=>c?.labels?.singular?St(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(qe,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:wt,items:a.map((c,u)=>({ChildComponent:wt,isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:c.slug})},order:u})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:kt,items:d.map((c,u)=>({ChildComponent:kt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:c.slug})},order:u})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as ka}from"react/compiler-runtime";import{jsx as Ne,jsxs as _o}from"react/jsx-runtime";import{useLexicalComposerContext as Na}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as La,$createTextNode as Ra,$getRoot as Ia}from"lexical";import*as Kr from"react";import{useCallback as ke,useEffect as xo,useLayoutEffect as Ur,useRef as bo,useState as yt}from"react";var Sa=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)},ya=(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)},va=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);
4
4
  await assertSelection(page, {
5
5
  anchorPath: [${n.anchorPath.toString()}],
6
6
  anchorOffset: ${n.anchorOffset},
@@ -10,7 +10,7 @@
10
10
  `;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(`
11
11
  `);default:return` await repeat(${t.count}, async () => {
12
12
  ${o}
13
- );`}};function Da(t){return t.key.toLowerCase()==="a"&&(mr?t.metaKey:t.ctrlKey)}function Aa(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 Wr(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 Vr=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Oa(t){let[e,o]=yt([]),[r,n]=yt(!1),[,i]=yt(""),[l,s]=yt(""),a=bo(null),d=bo(!1),c=bo(null),u=we(()=>t,[t]),m=we(()=>{let x=t.getRootElement(),E=window.getSelection();return x==null||E==null||E.anchorNode==null||E.focusNode==null||!x.contains(E.anchorNode)||!x.contains(E.focusNode)?null:`
13
+ );`}};function Ma(t){return t.key.toLowerCase()==="a"&&(mr?t.metaKey:t.ctrlKey)}function Da(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 Wr(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 Vr=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Aa(t){let[e,o]=yt([]),[r,n]=yt(!1),[,i]=yt(""),[l,s]=yt(""),a=bo(null),d=bo(!1),c=bo(null),u=ke(()=>t,[t]),m=ke(()=>{let x=t.getRootElement(),E=window.getSelection();return x==null||E==null||E.anchorNode==null||E.focusNode==null||!x.contains(E.anchorNode)||!x.contains(E.focusNode)?null:`
14
14
  import {
15
15
  initializeE2E,
16
16
  assertHTMLSnapshot,
@@ -27,16 +27,16 @@ describe('Test case', () => {
27
27
  const {page} = e2e;
28
28
 
29
29
  await page.focus('div[contenteditable="true"]');
30
- ${e.map(Ma).join(`
30
+ ${e.map(va).join(`
31
31
  `)}
32
32
  });
33
33
  });
34
- `},[t,e]),p=we((x,E)=>{o(g=>{let _=e.length-1,N=e[_];if(N&&N.name===x){if(x==="type")return[...e.slice(0,_),{...N,value:N.value+E}];if(N.value===E)return[...e.slice(0,_),{...N,count:N.count+1}]}return[...g,{name:x,count:1,value:E}]})},[e,o]);Ur(()=>{let x=g=>{if(!r)return;let _=g.key;Da(g)?p("selectAll",""):Vr.has(_)?p("press",g.key):[..._].length>1?p("keydown",g.key):p("type",g.key)},E=g=>{if(!r)return;let _=g.key;!Vr.has(_)&&[..._].length>1&&p("keyup",g.key)};return t.registerRootListener((g,_)=>{_!==null&&(_.removeEventListener("keydown",x),_.removeEventListener("keyup",E)),g!==null&&(g.addEventListener("keydown",x),g.addEventListener("keyup",E))})},[t,r,p]),Ur(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),xo(()=>{if(e){let x=m();x!==null&&s(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),xo(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:g,editorState:_})=>{if(!r)return;let N=_._selection,k=a.current,R=d.current;if(k!==N){if(g.size===0&&E.size===0&&!R){let b=window.getSelection();if(b&&(b.anchorNode==null||b.focusNode==null))return}a.current=N}d.current=!1;let S=m();S!==null&&s(S)}),[t,m,r,p]),xo(()=>r?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,r]);let f=we(x=>{r||(x.update(()=>{let E=Ia();E.clear();let g=Sa();E.append(Ra().append(g)),g.select()}),o([])),n(E=>!E)},[r]),h=we(()=>{if(!r)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:E,anchorOffset:g,focusNode:_,focusOffset:N}=Aa(x),k=u().getRootElement(),R;E!==null&&(R=Wr(E,k));let S;_!==null&&(S=Wr(_,k)),p("snapshot",{anchorNode:E,anchorOffset:g,anchorPath:R,focusNode:_,focusOffset:N,focusPath:S})},[p,r,u]),C=we(()=>{ya(m())},[m]),w=we(()=>{va("test.js",m())},[m]);return[ke("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{f(u()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?_o("div",{className:"test-recorder-output",children:[_o("div",{className:"test-recorder-toolbar",children:[ke("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ke("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{C(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ke("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{w(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ke("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var zr=()=>{let t=Na(3),[e]=La(),[o,r]=Oa(e),n;return t[0]!==o||t[1]!==r?(n=_o(Kr.Fragment,{children:[ke("p",{children:"HI"}),o,r,ke("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Fa=y({plugins:[{Component:zr,position:"bottom"}]});import{c as $a}from"react/compiler-runtime";import{jsx as Pa}from"react/jsx-runtime";import{useLexicalComposerContext as Ba}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ha}from"@lexical/react/LexicalTreeView.js";import"react";var Zr=()=>{let t=$a(2),[e]=Ba(),o;return t[0]!==e?(o=Pa(Ha,{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 ja=y({plugins:[{Component:Zr,position:"bottom"}]});import{$isTableSelection as Ga}from"@lexical/table";import{$isRangeSelection as Ua,FORMAT_TEXT_COMMAND as Wa}from"lexical";import{jsx as Xr}from"react/jsx-runtime";import"react";var Yr=()=>Xr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Xr("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var Jr={type:"text-format",format:["bold","italic"],tag:"***"},qr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Qr={type:"text-format",format:["bold"],tag:"**"},en={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var tn=[Y([{ChildComponent:Yr,isActive:({selection:t})=>Ua(t)||Ga(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Wa,"bold")},order:1}])],Va=y(({featureProviderMap:t})=>{let e=[Qr,en];return t.get("italic")&&e.push(qr,Jr),{markdownTransformers:e,toolbarFixed:{groups:tn},toolbarInline:{groups:tn}}});import{$isTableSelection as za}from"@lexical/table";import{$isRangeSelection as Za,FORMAT_TEXT_COMMAND as Xa}from"lexical";import{jsx as on,jsxs as Ka}from"react/jsx-runtime";import"react";var rn=()=>Ka("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[on("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),on("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var nn={type:"text-format",format:["code"],tag:"`"};var ln=[Y([{ChildComponent:rn,isActive:({selection:t})=>Za(t)||za(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Xa,"code")},order:7}])],Ya=y({markdownTransformers:[nn],toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{$isTableSelection as Ja}from"@lexical/table";import{$isRangeSelection as qa,FORMAT_TEXT_COMMAND as Qa}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var an=()=>sn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var cn={type:"text-format",format:["italic"],tag:"*"},un={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var dn=[Y([{ChildComponent:an,isActive:({selection:t})=>qa(t)||Ja(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Qa,"italic")},order:2}])],ec=y({markdownTransformers:[cn,un],toolbarFixed:{groups:dn},toolbarInline:{groups:dn}});import{$isTableSelection as oc}from"@lexical/table";import{$isRangeSelection as rc,FORMAT_TEXT_COMMAND as nc}from"lexical";import{jsx as mn,jsxs as tc}from"react/jsx-runtime";import"react";var pn=()=>tc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),mn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var fn={type:"text-format",format:["strikethrough"],tag:"~~"};var hn=[Y([{ChildComponent:pn,isActive:({selection:t})=>rc(t)||oc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(nc,"strikethrough")},order:4}])],ic=y({markdownTransformers:[fn],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$isTableSelection as lc}from"@lexical/table";import{$isRangeSelection as sc,FORMAT_TEXT_COMMAND as ac}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var Cn=()=>gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var xn=[Y([{ChildComponent:Cn,isActive:({selection:t})=>sc(t)||lc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(ac,"subscript")},order:5}])],cc=y({toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$isTableSelection as uc}from"@lexical/table";import{$isRangeSelection as dc,FORMAT_TEXT_COMMAND as mc}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Tn=[Y([{ChildComponent:_n,isActive:({selection:t})=>dc(t)||uc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(mc,"superscript")},order:6}])],pc=y({toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as hc}from"@lexical/table";import{$isRangeSelection as gc,FORMAT_TEXT_COMMAND as Cc}from"lexical";import{jsx as En,jsxs as fc}from"react/jsx-runtime";import"react";var wn=()=>fc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[En("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),En("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kn=[Y([{ChildComponent:wn,isActive:({selection:t})=>gc(t)||hc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Cc,"underline")},order:3}])],xc=y({toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});import{$createHeadingNode as Ec,$isHeadingNode as Pn,HeadingNode as wc}from"@lexical/rich-text";import{$setBlocksType as kc}from"@lexical/selection";import{$getSelection as Nc,$isRangeSelection as Lc}from"lexical";import{jsx as Nn}from"react/jsx-runtime";import"react";var Ln=()=>Nn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Nn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Rn}from"react/jsx-runtime";import"react";var Sn=()=>Rn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Rn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as In}from"react/jsx-runtime";import"react";var yn=()=>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",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Dn}from"react/jsx-runtime";import"react";var An=()=>Dn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Dn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as On}from"react/jsx-runtime";import"react";var Fn=()=>On("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:On("path",{d:"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 bc,$isHeadingNode as _c,HeadingNode as Tc}from"@lexical/rich-text";var To=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var $n=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Tc],export:(n,i)=>{if(!_c(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:To(n=>{let i="h"+n[1].length;return bc(i)})}};var Bn=t=>{let e=Nc();kc(e,()=>Ec(t))},Hn={h1:Ln,h2:Sn,h3:yn,h4:Mn,h5:An,h6:Fn},Rc=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[q(e.map((r,n)=>({ChildComponent:Hn[r],isActive:({selection:i})=>{if(!Lc(i))return!1;for(let l of i.getNodes()){if(Pn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Pn(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Bn(r)})},order:n+2})))];return{markdownTransformers:[$n(e)],nodes:[wc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Hn[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(()=>{Bn(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Fc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Eo=()=>jn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Gn,jsxs as Sc}from"react/jsx-runtime";import"react";var Un=()=>Sc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gn("path",{d:"M5 10h10",stroke:"currentColor"}),Gn("path",{d:"M10 15V5",stroke:"currentColor"})]});var de=t=>({type:"dropdown",ChildComponent:Un,items:t,key:"add",order:10});var Wn={type:"element",dependencies:[gt],export:(t,e)=>xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ct();e&&t.replace(e)}};import{c as Ic}from"react/compiler-runtime";import{useLexicalComposerContext as yc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as vc}from"@lexical/utils";import{$getSelection as Mc,$isRangeSelection as Dc,COMMAND_PRIORITY_EDITOR as Ac}from"lexical";import{useEffect as Oc}from"react";var Vn=()=>{let t=Ic(3),[e]=yc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Be,n=>{let i=Mc();if(!Dc(i))return!1;if(i.focus.getNode()!==null){let s=Ct();vc(s)}return!0},Ac),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Oc(o,r),null};var $c=y({markdownTransformers:[Wn],nodes:[gt],plugins:[{Component:Vn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Eo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]},toolbarFixed:{groups:[de([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Fc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Hc,OUTDENT_CONTENT_COMMAND as jc}from"lexical";import{jsx as vt,jsxs as Pc}from"react/jsx-runtime";import"react";var Kn=()=>Pc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[vt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Mt,jsxs as Bc}from"react/jsx-runtime";import"react";var zn=()=>Bc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Zn=t=>({type:"buttons",items:t,key:"indent",order:35});var Xn=[Zn([{ChildComponent:Kn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(jc,void 0)},order:1},{ChildComponent:zn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Hc,void 0)},order:2}])],Gc=y({toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$findMatchingParent as Qu}from"@lexical/utils";import{$getSelection as yo,$isRangeSelection as Li}from"lexical";import{jsx as Yn}from"react/jsx-runtime";import"react";var Jn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as qn}from"@lexical/selection";function Me(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?qn(o)?r:n:qn(e)?r:n}var wo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Qc,$isTextNode as eu}from"lexical";import{addClassNamesToElement as Uc,isHTMLAnchorElement as Wc}from"@lexical/utils";import Lo from"bson-objectid";import{$applyNodeReplacement as Vc,$createTextNode as Qn,$getSelection as Kc,$isElementNode as ei,$isRangeSelection as No,createCommand as zc,ElementNode as Zc}from"lexical";var Xc=new Set(["http:","https:","mailto:","sms:","tel:"]),Q=class t extends Zc{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Yc,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Lo.default().toHexString(),e.version=3);let o=me({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener")),Uc(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,r){if(!No(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&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(ei(r)){let n=me({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Xc.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=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=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ko(o.rel,"remove","noopener"))),!1}};function Yc(t){let e=null;if(Wc(t)){let o=t.textContent;o!==null&&o!==""&&(e=me({id:new Lo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function me({id:t,fields:e}){return Vc(new Q({id:t??new Lo.default().toHexString(),fields:e}))}function V(t){return t instanceof Q}var le=zc("TOGGLE_LINK_COMMAND");function ti(t){let e=Kc();if(!No(e)&&!t.selectedNodes?.length)return;let o=No(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(r=>{let n=r.getParent();if(V(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o?.length===1){let i=o[0],l=V(i)?i:Jc(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Qn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||ei(i)&&!i.isInline())){if(V(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Qn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=me({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),V(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function Jc(t){return qc(t,e=>V(e))}function qc(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ko(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var oi={type:"text-match",dependencies:[Q],export:(t,e,o)=>{if(!V(t))return null;let r=t,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&eu(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=me({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Qc(o);i.setFormat(t.getFormat()),n.append(i),t.replace(n)},trigger:")"};import{$applyNodeReplacement as tu,$isElementNode as ou}from"lexical";var pe=class t extends Q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Qe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ou(r)){let n=Qe({fields:this.__fields});return r.append(n),n}return null}};function Qe({fields:t}){return tu(new pe({id:"",fields:t}))}function fe(t){return t instanceof pe}import{c as ru}from"react/compiler-runtime";import{useLexicalComposerContext as nu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as iu}from"@lexical/utils";import{$createTextNode as ri,$getSelection as lu,$isElementNode as ii,$isLineBreakNode as li,$isNodeSelection as su,$isRangeSelection as au,$isTextNode as et,TextNode as cu}from"lexical";import{useEffect as uu}from"react";function ni(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=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var du=/[.,;\s]/;function At(t){return du.test(t)}function ai(t){return At(t[t.length-1])}function So(t){return At(t[0])}function mu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ci(t){let e=t.getPreviousSibling();return ii(e)&&(e=e.getLastDescendant()),e===null||li(e)||et(e)&&ai(e.getTextContent())}function ui(t){let e=t.getNextSibling();return ii(e)&&(e=e.getFirstDescendant()),e===null||li(e)||et(e)&&So(e.getTextContent())}function pu(t,e,o,r){return(t>0?At(o[t-1]):ci(r[0]))?e<o.length?At(o[e]):ui(r[r.length-1]):!1}function fu(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let d=a[0],u=d.getTextContent().length,m=s;s+u<=e?(r.push(d),l+=u):m>=o?i.push(d):n.push(d),s+=u,a.shift()}return[l,r,n,i]}function hu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Qe({fields:n});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=ri(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let d=[],c;for(let f=1;f<t.length;f++){let h=t[f],w=h.getTextContent().length,v=s,D=s+w;if(v<o)if(D<=o)d.push(h);else{let[x,E]=h.splitText(o-v);d.push(x),c=E}s+=w}let u=lu(),m=u?u.getNodes().find(et):void 0,p=ri(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...d),m&&m===a&&(au(u)?p.select(u.anchor.offset,u.focus.offset):su(u)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function gu(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=si(i,e))!=null&&l!==null;){let a=l.index,d=l.length,c=a+d;if(pu(s+a,s+c,n,r)){let[m,,p,f]=fu(r,s+a,s+c),h=s+a-m,C=s+c-m,w=hu(p,h,C,l);r=w?[w,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Ro(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let d=r[a];if(!et(d)||!d.isSimpleText()){Dt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=si(i,e);if(l===null||l.text!==i){Dt(t),o(null,t.getFields()?.url??null);return}if(!ci(t)||!ui(t)){Dt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Cu(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(fe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!So(i)||mu(i,l))&&(r.append(t),Ro(r,e,o),o(null,r.getFields()?.url??null))}fe(n)&&!ai(i)&&(Dt(n),Ro(n,e,o),o(null,n.getFields()?.url??null))}function Dt(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 xu(t){let e=[t],o=t.getNextSibling();for(;o!==null&&et(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function bu(t,e,o){let r=ru(5),n,i;r[0]!==t||r[1]!==o||r[2]!==e?(n=()=>{if(!t.hasNodes([pe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return iu(t.registerNodeTransform(cu,s=>{let a=s.getParentOrThrow(),d=s.getPreviousSibling();if(fe(a))Ro(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(So(s.getTextContent())||!fe(d))){let c=xu(s);gu(c,e,l)}Cu(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=n,r[4]=i):(n=r[3],i=r[4]),uu(n,i)}var _u=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Tu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Eu=[ni(_u,t=>t.startsWith("http")?t:`https://${t}`),ni(Tu,t=>`mailto:${t}`)],di=()=>{let[t]=nu();return bu(t,Eu),null};import{jsx as wu}from"react/jsx-runtime";import{ClickableLinkPlugin as ku}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var mi=()=>wu(ku,{});import{jsx as ju}from"react/jsx-runtime";import"react";import{createPortal as Gu}from"react-dom";import{jsx as he,jsxs as tt,Fragment as Lu}from"react/jsx-runtime";import{useLexicalComposerContext as Ru}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as pi,mergeRegister as fi}from"@lexical/utils";import{getTranslation as Io}from"@payloadcms/translations";import{CloseMenuIcon as Su,EditIcon as Iu,ExternalLinkIcon as hi,formatDrawerSlug as yu,useConfig as vu,useEditDepth as Mu,useLocale as Du,useTranslation as Au}from"@payloadcms/ui";import{requests as Ou}from"@payloadcms/ui/shared";import{$getSelection as gi,$isLineBreakNode as Fu,$isRangeSelection as Ci,COMMAND_PRIORITY_HIGH as $u,COMMAND_PRIORITY_LOW as xi,KEY_ESCAPE_COMMAND as Pu,SELECTION_CHANGE_COMMAND as Bu}from"lexical";import bi,{useCallback as _i,useEffect as $t,useRef as Hu,useState as Ne}from"react";function Ot(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),d=t.top-r,c=t.left-n;d<a.top&&(d+=l.height+t.height+r*2),c+l.width>a.right&&(c=a.right-l.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Nu}from"lexical";var Ft=Nu("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ti({anchorElem:t}){let[e]=Ru(),[o,r]=Ne(),n=Hu(null),[i,l]=Ne(null),[s,a]=Ne(null),{fieldProps:{schemaPath:d},uuid:c}=B(),{config:u}=vu(),{i18n:m,t:p}=Au(),[f,h]=Ne(),C=Mu(),[w,v]=Ne(!1),[D,x]=Ne([]),E=Du(),[g,_]=Ne(!1),N=yu({slug:"lexical-rich-text-link-"+c,depth:C}),{toggleDrawer:k}=ce(N),R=_i(()=>{v(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),_(!1),l(null),a(null),x([]),h(void 0)},[v,l,a,x]),S=_i(()=>{let b=gi(),T;if(!Ci(b)||!b){R();return}let I=Me(b);T=e.getElementByKey(I.getKey())?.getBoundingClientRect();let L=pi(I,V),A=b.getNodes().filter(U=>!Fu(U)).find(U=>{let H=pi(U,V);return L&&!L.is(H)||H&&!H.is(L)});if(L==null||A){R();return}r(L);let M=L.getFields(),F={...M,id:L.getID(),text:L.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let U=u.collections.find(H=>H.slug===M?.doc?.relationTo);if(!U)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let H=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,ee=M.doc?.relationTo;if(!H||!ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let pt=p("fields:linkedTo",{label:`${Io(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(pt),Ou.get(`${u.serverURL}${u.routes.api}/${ee}/${H}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:E?.code}}).then(async ie=>{if(!ie.ok)throw new Error(`HTTP error! Status: ${ie.status}`);let Ie=await ie.json(),ft=U?.admin?.useAsTitle||"id",ht=Ie[ft],dr=p("fields:linkedTo",{label:`${Io(U.labels.singular,m)} - ${ht}`}).replace(/<[^>]*>?/g,"");a(dr)}).catch(()=>{let ie=p("fields:linkedTo",{label:`${Io(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${H}`}).replace(/<[^>]*>?/g,"");a(ie)})}}h(F),v(!0),x(b?b?.getNodes():[]),fe(L)?_(!0):_(!1);let G=n.current,$=window.getSelection(),{activeElement:W}=document;if(G===null)return;let J=e.getRootElement();return $!==null&&J!==null&&J.contains($.anchorNode)?(T||(T=$.getRangeAt(0).getBoundingClientRect()),T!=null&&(T.y+=40,Ot(T,G,t))):(W==null||W.className!=="link-input")&&(J!==null&&Ot(null,G,t),l(null),a(null)),!0},[e,R,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,E?.code,t]);return $t(()=>fi(e.registerCommand(Ft,b=>(e.dispatchCommand(le,b),S(),k(),!0),xi)),[e,S,k,N]),$t(()=>{let b=t.parentElement,T=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",T),b?.addEventListener("scroll",T),()=>{window.removeEventListener("resize",T),b?.removeEventListener("scroll",T)}},[t.parentElement,e,S]),$t(()=>fi(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{S()})}),e.registerCommand(Bu,()=>(S(),!0),xi),e.registerCommand(Pu,()=>w?(R(),!0):!1,$u)),[e,S,w,R]),$t(()=>{e.getEditorState().read(()=>{S()})},[e,S]),tt(bi.Fragment,{children:[he("div",{className:"link-editor",ref:n,children:tt("div",{className:"link-input",children:[i&&i.length>0?tt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?he(hi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?tt(Lu,{children:[o?.__fields.newTab?he(hi,{}):null,he("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&tt(bi.Fragment,{children:[he("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{k()},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:he(Iu,{})}),!g&&he("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(le,null)},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:he(Su,{})})]})]})}),he(He,{className:"lexical-link-edit-drawer",data:f,drawerSlug:N,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(b,T)=>{let I=T,L={...I};delete L.text,e.update(()=>{let A=gi(),M=null;if(Ci(A)?M=Me(A).getParent():D.length&&(M=D[0].getParent()),M&&fe(M)){let F=me({fields:L});M.replace(F,!0)}}),e.dispatchCommand(le,{fields:L,selectedNodes:D,text:I.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var Ei=t=>{let{anchorElem:e=document.body}=t;return Gu(ju(Ti,{anchorElem:e}),e)};import{c as Vu}from"react/compiler-runtime";import{useLexicalComposerContext as Ku}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as zu}from"@lexical/utils";import{$getSelection as Zu,$isElementNode as Xu,$isRangeSelection as Yu,COMMAND_PRIORITY_LOW as ki,PASTE_COMMAND as Ju}from"lexical";import{useEffect as qu}from"react";var Uu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Wu=/^[\w\-./]*(?:#\w[\w-]*)?$/;function wi(t){if(!t)return!1;if(t==="https://"||Uu.test(t)||Wu.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ni=()=>{let t=Vu(3),[e]=Ku(),o,r;return t[0]!==e?(o=()=>{if(!e.hasNodes([Q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return zu(e.registerCommand(le,n=>(ti(n),!0),ki),e.registerCommand(Ju,n=>{let i=Zu();if(!Yu(i)||i.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let l=n.clipboardData.getData("text");if(!wi(l))return!1;if(!i.getNodes().some(s=>Xu(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(le,{fields:s,text:null}),n.preventDefault(),!0}return!1},ki))},r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),qu(o,r),null};var Ri=[wo([{ChildComponent:Jn,isActive:({selection:t})=>{if(Li(t)){let e=Me(t);return Qu(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Li(t)&&yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(le,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=yo()?.getTextContent(),r=yo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Ft,{fields:n,selectedNodes:r,text:o})}},order:1}])],ed=y({markdownTransformers:[oi],nodes:[Q,pe],plugins:[{Component:Ni,position:"normal"},{Component:di,position:"normal"},{Component:mi,position:"normal"},{Component:Ei,position:"floatingAnchorElem"}],toolbarFixed:{groups:Ri},toolbarInline:{groups:Ri}});import{$isListNode as Do,INSERT_CHECK_LIST_COMMAND as Di,ListItemNode as md,ListNode as pd}from"@lexical/list";import{$isRangeSelection as fd}from"lexical";import{jsx as Si,jsxs as td}from"react/jsx-runtime";import"react";var vo=()=>td("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:[Si("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Si("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as od}from"react/jsx-runtime";import{ListPlugin as rd}from"@lexical/react/LexicalListPlugin.js";import"react";var De=()=>od(rd,{});function Ae(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as sd,ListItemNode as ad,ListNode as cd}from"@lexical/list";import{$createListItemNode as nd,$createListNode as id,$isListItemNode as ld,$isListNode as Mo}from"@lexical/list";var Ii=4,Oe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=nd(t==="check"?r[3]==="x":void 0);if(Mo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Mo(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=id(t,t==="number"?Number(r[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Ii);s&&l.setIndent(s)},Le=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(ld(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if(Mo(c)){r.push(Le(c,e,o+1));continue}}let s=" ".repeat(o*Ii),a=t.getListType(),d=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+d+e(l)),i++}return r.join(`
35
- `)};var yi={type:"element",dependencies:[cd,ad],export:(t,e)=>sd(t)?Le(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Oe("check")};import{jsx as ud}from"react/jsx-runtime";import{CheckListPlugin as dd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var vi=()=>ud(dd,{});var Mi=[q([{ChildComponent:vo,isActive:({selection:t})=>{if(!fd(t))return!1;for(let e of t.getNodes()){if(Do(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Do(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Do(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Di,void 0)},order:12}])],hd=y(({featureProviderMap:t})=>{let e=[{Component:vi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:De,position:"normal"}),{markdownTransformers:[yi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[pd,md],plugins:e,slashMenu:{groups:[Ae([{Icon:vo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Di,void 0)}}])]},toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}});import{$isListNode as Oo,INSERT_ORDERED_LIST_COMMAND as Fi,ListItemNode as _d,ListNode as Td}from"@lexical/list";import{$isRangeSelection as Ed}from"lexical";import{jsx as ot,jsxs as gd}from"react/jsx-runtime";import"react";var Ao=()=>gd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ot("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),ot("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),ot("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Cd,ListItemNode as xd,ListNode as bd}from"@lexical/list";var Ai={type:"element",dependencies:[bd,xd],export:(t,e)=>Cd(t)?Le(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Oe("number")};var Oi=[q([{ChildComponent:Ao,isActive:({selection:t})=>{if(!Ed(t))return!1;for(let e of t.getNodes()){if(Oo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Oo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Oo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Fi,void 0)},order:10}])],wd=y(({featureProviderMap:t})=>({markdownTransformers:[Ai],nodes:t.has("orderedList")?[]:[Td,_d],plugins:t.has("orderedList")?[]:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Fi,void 0)}}])]},toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}}));import{$isListNode as $o,INSERT_UNORDERED_LIST_COMMAND as Bi,ListItemNode as Sd,ListNode as Id}from"@lexical/list";import{$isRangeSelection as yd}from"lexical";import{jsx as Fe,jsxs as kd}from"react/jsx-runtime";import"react";var Fo=()=>kd("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:[Fe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Fe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Fe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Fe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Fe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Fe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Nd,ListItemNode as Ld,ListNode as Rd}from"@lexical/list";var $i={type:"element",dependencies:[Rd,Ld],export:(t,e)=>Nd(t)?Le(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Oe("bullet")};var Pi=[q([{ChildComponent:Fo,isActive:({selection:t})=>{if(!yd(t))return!1;for(let e of t.getNodes()){if($o(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($o(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!($o(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)},order:11}])],vd=y({markdownTransformers:[$i],nodes:[Id,Sd],plugins:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Fo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}});import{jsx as Md}from"react/jsx-runtime";import{addClassNamesToElement as Dd}from"@lexical/utils";import{DecoratorNode as Ad}from"lexical";import*as Hi from"react";var Od=Hi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),rt=class t extends Ad{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Fd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Dd(o,"unknownConverted"),o}decorate(){return Md(Od,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Fd({data:t}){return new rt({data:t})}var $d=y(()=>({nodes:[rt]}));import{jsx as Pd}from"react/jsx-runtime";import{addClassNamesToElement as Bd}from"@lexical/utils";import{DecoratorNode as Hd}from"lexical";import*as ji from"react";var jd=ji.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends Hd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Gd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Bd(o,"unknownConverted"),o}decorate(){return Pd(jd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Gd({data:t}){return new nt({data:t})}var Ud=y(()=>({nodes:[nt]}));import{$setBlocksType as Wi}from"@lexical/selection";import{$createParagraphNode as Vi,$getSelection as Ki,$isParagraphNode as Gi,$isRangeSelection as Wd}from"lexical";var Ui=[q([{ChildComponent:ze,isActive:({selection:t})=>{if(!Wd(t))return!1;for(let e of t.getNodes())if(!Gi(e)&&!Gi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})},order:1}])],Vd=y({slashMenu:{groups:[Z([{Icon:ze,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}});import{$isNodeSelection as bm}from"lexical";import{jsx as it,jsxs as Kd}from"react/jsx-runtime";import"react";var Po=()=>Kd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[it("g",{clipPath:"url(#clip0_4397_10817)",children:it("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),it("defs",{children:it("clipPath",{id:"clip0_4397_10817",children:it("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as sm}from"react/compiler-runtime";import{jsx as am}from"react/jsx-runtime";import{useLexicalComposerContext as cm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as um}from"@lexical/utils";import{useConfig as dm}from"@payloadcms/ui";import{$getPreviousSelection as mm,$getSelection as pm,$isParagraphNode as qi,$isRangeSelection as fm,COMMAND_PRIORITY_EDITOR as hm,createCommand as gm}from"lexical";import{useEffect as Cm}from"react";import{c as om}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as rm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as nm,COMMAND_PRIORITY_EDITOR as im}from"lexical";import{useEffect as Zi,useState as Xi}from"react";import{c as zd}from"react/compiler-runtime";import{jsx as Zd}from"react/jsx-runtime";import{useLexicalComposerContext as Xd}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Yd,useModal as Jd}from"@payloadcms/ui";import{$getPreviousSelection as qd,$getSelection as Qd,$setSelection as em}from"lexical";import{useEffect as tm,useState as zi}from"react";var lt=t=>{let e=zd(23),[o]=Xd(),[r,n]=zi(null),[i,l]=zi(!1),[s,a,d]=Yd(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=Jd(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=Qd()??qd();n(R)},e[0]=h):h=e[0];let C=h,w;e[1]!==r||e[2]!==o?(w=()=>{r&&o.update(()=>{em(r.clone())},{discrete:!0,skipTransforms:!0})},e[1]=r,e[2]=o,e[3]=w):w=e[3];let v=w,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let x=D,E,g;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==v?(E=()=>{if(!i)return;let R=f[u];R&&!R?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},g=[f,u,v,i],e[6]=i,e[7]=f,e[8]=u,e[9]=v,e[10]=E,e[11]=g):(E=e[10],g=e[11]),tm(E,g);let _;e[12]!==a?(_=R=>Zd(a,{...R,onClick:()=>{C()}}),e[12]=a,e[13]=_):_=e[13];let N;e[14]!==p?(N=()=>{C(),p(),l(!0)},e[14]=p,e[15]=N):N=e[15];let k;return e[16]!==x||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==_||e[21]!==N?(k={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:_,openListDrawer:N},e[16]=x,e[17]=m,e[18]=s,e[19]=u,e[20]=_,e[21]=N,e[22]=k):k=e[22],k};var lm=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=nm(o);n&&n.replace(Ue({relationTo:e,value:r}))}):t.dispatchCommand(Bo,{relationTo:e,value:r})},Yi=t=>{let e=om(21),{enabledCollectionSlugs:o}=t,[r]=rm(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=Xi(n),[s,a]=Xi(null),d=o||void 0,c;e[2]!==d||e[3]!==i?(c={collectionSlugs:d,selectedCollection:i},e[2]=d,e[3]=i,e[4]=c):c=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=lt(c),h,C;e[5]!==r||e[6]!==f?(h=()=>r.registerCommand(je,g=>(a(g?.replace?g?.replace.nodeKey:null),f(),!0),im),C=[r,f],e[5]=r,e[6]=f,e[7]=h,e[8]=C):(h=e[7],C=e[8]),Zi(h,C);let w;e[9]!==r||e[10]!==s||e[11]!==u?(w=g=>{let{collectionSlug:_,docID:N}=g;lm({editor:r,relationTo:_,replaceNodeKey:s,value:N}),u()},e[9]=r,e[10]=s,e[11]=u,e[12]=w):w=e[12];let v=w,D;e[13]!==o?(D=()=>{l(o?.[0])},e[13]=o,e[14]=D):D=e[14];let x;e[15]!==m||e[16]!==o?(x=[m,o],e[15]=m,e[16]=o,e[17]=x):x=e[17],Zi(D,x);let E;return e[18]!==v||e[19]!==p?(E=Pt(p,{onSelect:v}),e[18]=v,e[19]=p,e[20]=E):E=e[20],E},Ji=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Pt(Yi,{...t}):Pt(bt,{...t,children:Pt(Yi,{...t})});var Bo=gm("INSERT_RELATIONSHIP_COMMAND"),Qi=t=>{let e=sm(10),{clientProps:o}=t,[r]=cm(),{config:n}=dm(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],c=i.filter(u).map(xm),e[0]=o,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([Ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Bo,c=>{let u=pm()||mm();if(fm(u)){let m=Ue(c);um(m);let{focus:p}=u,f=p.getNode();qi(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>qi(h)).length>1&&f.remove()}return!0},hm)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Cm(s,a);let d;return e[8]!==l?(d=am(Ji,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function xm(t){let{slug:e}=t;return e}var _m=y({nodes:[Ge],plugins:[{Component:Qi,position:"normal"}],slashMenu:{groups:[Z([{Icon:Po,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Po,isActive:({selection:t})=>{if(!bm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]}});import{c as ll}from"react/compiler-runtime";import{jsx as ne,jsxs as $m}from"react/jsx-runtime";import{useLexicalComposerContext as Pm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Bm,useThrottledEffect as Hm,useTranslation as jm}from"@payloadcms/ui";import*as ge from"react";import{useMemo as Gm}from"react";import{c as Tm}from"react/compiler-runtime";import{jsx as Em}from"react/jsx-runtime";import{mergeRegister as wm}from"@lexical/utils";import{$addUpdateTag as km,$getSelection as Nm}from"lexical";import{useEffect as Bt,useState as Ho}from"react";var jo="toolbar-popup__button",st=t=>{let e=Tm(34),{children:o,editor:r,item:n}=t,[i,l]=Ho(!0),[s,a]=Ho(!1),[d,c]=Ho(jo),u=B(),m;e[0]!==r||e[1]!==n||e[2]!==u||e[3]!==s||e[4]!==i?(m=()=>{r.getEditorState().read(()=>{let N=Nm();if(N){if(n.isActive){let k=n.isActive({editor:r,editorConfigContext:u,selection:N});s!==k&&a(k)}if(n.isEnabled){let k=n.isEnabled({editor:r,editorConfigContext:u,selection:N});i!==k&&l(k)}}})},e[0]=r,e[1]=n,e[2]=u,e[3]=s,e[4]=i,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Bt(f,h);let C,w;e[9]!==p?(C=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),w=[p],e[9]=p,e[10]=C,e[11]=w):(C=e[10],w=e[11]),Bt(C,w);let v,D;e[12]!==r||e[13]!==p?(v=()=>wm(r.registerUpdateListener(()=>{p()})),D=[r,p],e[12]=r,e[13]=p,e[14]=v,e[15]=D):(v=e[14],D=e[15]),Bt(v,D);let x;e[16]!==i||e[17]!==s||e[18]!==n?(x=()=>{c([jo,i===!1?"disabled":"",s?"active":"",n?.key?`${jo}-`+n.key:""].filter(Boolean).join(" "))},e[16]=i,e[17]=s,e[18]=n,e[19]=x):x=e[19];let E;e[20]!==i||e[21]!==s||e[22]!==d||e[23]!==n.key?(E=[i,s,d,n.key],e[20]=i,e[21]=s,e[22]=d,e[23]=n.key,e[24]=E):E=e[24],Bt(x,E);let g;e[25]!==i||e[26]!==r||e[27]!==n.onSelect||e[28]!==s?(g=()=>{if(i!==!1)return r.focus(()=>{r.update(()=>{km("toolbar")}),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=i,e[26]=r,e[27]=n.onSelect,e[28]=s,e[29]=g):g=e[29];let _;return e[30]!==d||e[31]!==g||e[32]!==o?(_=Em("button",{className:d,onClick:g,onMouseDown:Lm,type:"button",children:o}),e[30]=d,e[31]=g,e[32]=o,e[33]=_):_=e[33],_};function Lm(t){t.preventDefault()}import{c as il}from"react/compiler-runtime";import{jsx as $e}from"react/jsx-runtime";import Wo,{useEffect as nl}from"react";import{mergeRegister as Dm}from"@lexical/utils";import{useTranslation as Am}from"@payloadcms/ui";import{$getSelection as Om}from"lexical";import{jsx as Te,jsxs as el}from"react/jsx-runtime";import{Button as Rm}from"@payloadcms/ui";import{$addUpdateTag as Sm}from"lexical";import Ht,{useCallback as Im,useEffect as at,useMemo as ym,useRef as Uo,useState as jt}from"react";import{createPortal as vm}from"react-dom";var Go="toolbar-popup__dropdown-item",tl=Ht.createContext(null);function ol({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=jt(Go);at(()=>{a([Go,r===!1?"disabled":"",t?"active":"",i?.key?`${Go}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let d=Uo(null),c=Ht.useContext(tl);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return at(()=>{d?.current!=null&&u(d)},[d,u]),Te(Rm,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Sm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function Mm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=jt(),[l,s]=jt(),a=Im(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},c=ym(()=>({registerItem:a}),[a]);return at(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Te(tl.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function rl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Uo(null),d=Uo(null),[c,u]=jt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};at(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:C,top:w}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${w+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),at(()=>{let f=d.current;if(f!==null&&c){let h=C=>{let{target:w}=C;s!=null&&a.current!=null&&a.current.contains(w)||f.contains(w)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=vm(Te(Mm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return el(Ht.Fragment,{children:[el("button",{"aria-label":t,className:e+(c?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[n&&Te(n,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Ht.Fragment,{children:p})]})}var Vo="toolbar-popup__dropdown",Fm=t=>{let e=il(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Am(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(f=l?.Component&&$e(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=r,e[3]=n,e[4]=i,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==l||e[7]!==d||e[8]!==s||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=l,e[7]=d,e[8]=s,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==n||e[15]!==i||e[16]!==u?(p=$e(ol,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?$e(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:$e("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=n,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},Re=t=>{let e=il(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Wo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=Wo.useState(f),[w,v]=Wo.useState(!0),D=B(),{items:x,key:E}=i,g;e[2]!==n||e[3]!==x||e[4]!==d||e[5]!==D||e[6]!==i||e[7]!==c?(g=()=>{n.getEditorState().read(()=>{let $=Om();if(!$)return;let W=[],J=[],U=[];for(let H of x)H.isActive&&(!d||W.length<d)&&H.isActive({editor:n,editorConfigContext:D,selection:$})&&(W.push(H.key),J.push(H)),H.isEnabled?H.isEnabled({editor:n,editorConfigContext:D,selection:$})&&U.push(H.key):U.push(H.key);i.isEnabled&&v(i.isEnabled({editor:n,editorConfigContext:D,selection:$})),p(W),C(U),c&&c({activeItems:J})})},e[2]=n,e[3]=x,e[4]=d,e[5]=D,e[6]=i,e[7]=c,e[8]=g):g=e[8];let _=g,N,k;e[9]!==_?(N=()=>{_()},k=[_],e[9]=_,e[10]=N,e[11]=k):(N=e[10],k=e[11]),nl(N,k);let R,S;e[12]!==n||e[13]!==_?(R=()=>Dm(n.registerUpdateListener(()=>{_()})),S=[n,_],e[12]=n,e[13]=_,e[14]=R,e[15]=S):(R=e[14],S=e[15]),nl(R,S);let b=`${E} dropdown`,T=`${Vo}-${E}`,I;e[16]!==r?(I=r||[],e[16]=r,e[17]=I):I=e[17];let L;e[18]!==T||e[19]!==I?(L=[Vo,T,...I].filter(Boolean),e[18]=T,e[19]=I,e[20]=L):L=e[20];let A=L.join(" "),M=!w,F;e[21]!==s?(F=s||[],e[21]=s,e[22]=F):F=e[22];let G;return e[23]!==F||e[24]!==x||e[25]!==m||e[26]!==o||e[27]!==n||e[28]!==h||e[29]!==b||e[30]!==A||e[31]!==M||e[32]!==l||e[33]!==a||e[34]!==E?(G=$e(rl,{buttonAriaLabel:b,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Vo}-items`,...F],label:a,children:x.length?x.map($=>$e(Fm,{active:m.includes($.key),anchorElem:o,editor:n,enabled:h.includes($.key),item:$},$.key)):null},E),e[23]=F,e[24]=x,e[25]=m,e[26]=o,e[27]=n,e[28]=h,e[29]=b,e[30]=A,e[31]=M,e[32]=l,e[33]=a,e[34]=E,e[35]=G):G=e[35],G};function Um({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function Wm(t){let e=ll(18),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=jm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=ge.useState(void 0),[p,f]=ge.useState(void 0),h,C;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},C=[i],e[0]=i,e[1]=h,e[2]=C):(h=e[1],C=e[2]),ge.useEffect(h,C);let w;e[3]!==i||e[4]!==d||e[5]!==s||e[6]!==c?(w=E=>{let{activeItems:g}=E;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let _=g[0],N=_.key;_.label&&(N=typeof _.label=="function"?_.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):_.label),N.length>25&&(N=N.substring(0,25)+"..."),g.length===1?(m(N),f(()=>_.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[3]=i,e[4]=d,e[5]=s,e[6]=c,e[7]=w):w=e[7];let v=w,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==r||e[12]!==u||e[13]!==v||e[14]!==n.features.toolbarFixed||e[15]!==l||e[16]!==D?(x=$m("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?ne(Re,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):ne(Re,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):null,i.type==="buttons"&&i.items.length?i.items.map(E=>ne(Um,{anchorElem:o,editor:r,item:E},E.key)):null,l<n.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[8]=i,e[9]=p,e[10]=o,e[11]=r,e[12]=u,e[13]=v,e[14]=n.features.toolbarFixed,e[15]=l,e[16]=D,e[17]=x):x=e[17],x}function Vm({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=ge.useRef(null),{y:l}=Bm(),s=Gm(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let d=n.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Hm(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(ge.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,d)=>ne(Wm,{anchorElem:t,editor:o,editorConfig:r,group:a,index:d},a.key))})})}var sl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return sl(t.parentEditor)}return!1},al=t=>{let e=ll(6),{clientProps:o}=t,[r]=Pm(),n=B(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,a,d;if(e[0]!==n||e[1]!==o?.disableIfParentHasFixedToolbar||e[2]!==s||e[3]!==l){d=Symbol.for("react.early_return_sentinel");e:{let c=sl(n);if(o?.disableIfParentHasFixedToolbar&&c){d=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){d=null;break e}a=ne(Vm,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=n,e[1]=o?.disableIfParentHasFixedToolbar,e[2]=s,e[3]=l,e[4]=a,e[5]=d}else a=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:a};var Km=y({plugins:[{Component:al,position:"aboveContainer"}]});import{c as dl}from"react/compiler-runtime";import{jsx as se,jsxs as ml}from"react/jsx-runtime";import{useLexicalComposerContext as zm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as pl}from"@lexical/utils";import{$getSelection as fl,$isRangeSelection as cl,$isTextNode as Zm,COMMAND_PRIORITY_LOW as Xm,SELECTION_CHANGE_COMMAND as Ym}from"lexical";import{useCallback as Ut,useEffect as ct,useRef as ul,useState as Jm}from"react";import*as Wt from"react";import{createPortal as qm}from"react-dom";function Ko(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 Gt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let C=0;return!e&&f<p.top&&!s&&(C=u.height+a.height+d*2,f+=C),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),C}function Qm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(st,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function ep(t){let e=dl(14),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=Wt.useState(),d,c;e[0]!==n?(d=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},c=[n],e[0]=n,e[1]=d,e[2]=c):(d=e[1],c=e[2]),Wt.useEffect(d,c);let u;e[3]!==n?(u=h=>{let{activeItems:C}=h;if(!C.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let w=C[0];a(()=>w.ChildComponent)},e[3]=n,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[5]!==n||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==m||e[10]!==l.features.toolbarInline||e[11]!==i||e[12]!==p?(f=ml("div",{className:p,children:[n.type==="dropdown"&&n.items.length?s?se(Re,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):se(Re,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>se(Qm,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&se("div",{className:"divider"})]},n.key),e[5]=n,e[6]=s,e[7]=o,e[8]=r,e[9]=m,e[10]=l.features.toolbarInline,e[11]=i,e[12]=p,e[13]=f):f=e[13],f}function tp({anchorElem:t,editor:e}){let o=ul(null),r=ul(null),{editorConfig:n}=B(),i=Ut(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ut(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ut(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ut(()=>{let d=fl(),c=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Ko(c,p),h=Gt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Gt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),pl(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(Ym,()=>(a(),!1),Xm))),[e,a]),ml("div",{className:"inline-toolbar-popup",ref:o,children:[se("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((d,c)=>se(ep,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function op(t,e){let o=dl(12),[r,n]=Jm(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=fl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!cl(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!cl(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),w=!1;for(let v of C)if(Zm(v)){n(!0),w=!0;break}w||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>pl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ct(d,c),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=qm(se(tp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var hl=t=>{let{anchorElem:e}=t,[o]=zm();return op(o,e)};var rp=y({plugins:[{Component:hl,position:"floatingAnchorElem"}]});import{TableCellNode as Wf,TableNode as Vf,TableRowNode as Kf}from"@lexical/table";import{jsx as gl}from"react/jsx-runtime";import"react";var zo=()=>gl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as mp,$createTableNode as pp,$createTableRowNode as fp,$isTableCellNode as kl,$isTableNode as Zo,$isTableRowNode as Xo,TableCellHeaderStates as Vt,TableCellNode as hp,TableNode as gp,TableRowNode as Cp}from"@lexical/table";import{$isParagraphNode as xp,$isTextNode as bp}from"lexical";var Cl=/^[\t ]*$/,np=/^(\s*)(\d+)\.\s/,ip=/^(\s*)[-*+]\s/,lp=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,xl=/^(#{1,6})\s/,sp=/^>\s/,bl=/^[ \t]*```(\w+)?/,_l=/[ \t]*```$/,ap=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,cp=/^\|(.+)\|\s?$/,up=/^(\| ?:?-*:? ?)+\|\s?$/,Tl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,El=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function dp(t,e=!1){let o=t.split(`
36
- `),r=!1,n=[];for(let i=0;i<o.length;i++){let l=o[i],s=n[n.length-1];if(ap.test(l)){n.push(l);continue}if((bl.test(l)&&!r||_l.test(l)&&r)&&(r=!r),bl.test(l)||_l.test(l)){n.push(l);continue}if(r){n.push(l);continue}Cl.test(l)||Cl.test(s)||!s||xl.test(s)||xl.test(l)||sp.test(l)||np.test(l)||ip.test(l)||lp.test(l)||cp.test(l)||up.test(l)||!e||Tl.test(l)||El.test(l)||Tl.test(s)||El.test(s)?n.push(l):n[n.length-1]=s+" "+l.trim()}return n.join(`
37
- `)}function wl(t,e=pr,o,r=!1,n=!0){let i=r?t:dp(t,n);return fr(i,e,o)}var Ll=/^\|(.+)\|\s?$/,_p=/^(\| ?:?-*:? ?)+\|\s?$/,Rl=({allTransformers:t})=>({type:"element",dependencies:[gp,Cp,hp],export:e=>{if(!Zo(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Xo(r))continue;let i=!1;for(let l of r.getChildren())kl(l)&&(n.push(hr(t,l).replace(/\n/g,"\\n")),l.__headerState===Vt.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
38
- `)},regExp:Ll,replace:(e,o,r)=>{if(_p.test(r[0])){let c=e.getPreviousSibling();if(!c||!Zo(c))return;let u=c.getChildren(),m=u[u.length-1];if(!m||!Xo(m))return;m.getChildren().forEach(p=>{kl(p)&&p.setHeaderStyles(Vt.ROW,Vt.ROW)}),e.remove();return}let n=Nl(r[0],t);if(n==null)return;let i=[n],l=e.getPreviousSibling(),s=n.length;for(;l&&!(!xp(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!bp(c))break;let u=Nl(c.getTextContent(),t);if(u==null)break;s=Math.max(s,u.length),i.unshift(u);let m=l.getPreviousSibling();l.remove(),l=m}let a=pp();for(let c of i){let u=fp();a.append(u);for(let m=0;m<s;m++)u.append(m<c.length?c[m]:Sl("",t))}let d=e.getPreviousSibling();Zo(d)&&Tp(d)===s?(d.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Tp(t){let e=t.getFirstChild();return Xo(e)?e.getChildrenSize():0}var Sl=(t,e)=>{t=t.replace(/\\n/g,`
39
- `);let o=mp(Vt.NO_STATUS);return wl(t,e,o),o},Nl=(t,e)=>{let o=t.match(Ll);return!o||!o[1]?null:o[1].split("|").map(r=>Sl(r,e))};import{c as wp}from"react/compiler-runtime";import{jsx as P,jsxs as Ce}from"react/jsx-runtime";import{useLexicalComposerContext as Ml}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as kp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Np,$deleteTableRow__EXPERIMENTAL as Lp,$getNodeTriplet as Rp,$getTableCellNodeFromLexicalNode as Sp,$getTableColumnIndexFromTableCellNode as Ip,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as yp,$insertTableColumn__EXPERIMENTAL as vp,$insertTableRow__EXPERIMENTAL as Mp,$isTableCellNode as Kt,$isTableRowNode as yl,$isTableSelection as Zt,$unmergeCell as Dp,getTableObserverFromTableElement as Ap,TableCellHeaderStates as Ee,TableCellNode as Op}from"@lexical/table";import{useScrollInfo as Fp}from"@payloadcms/ui";import{$createParagraphNode as $p,$getRoot as Pp,$getSelection as Xt,$isElementNode as Bp,$isParagraphNode as Dl,$isRangeSelection as qo,$isTextNode as Hp}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as Se,useRef as zt,useState as Pe}from"react";import{createPortal as Al}from"react-dom";import{jsx as Yo,jsxs as Ep}from"react/jsx-runtime";import"react";var Il=()=>Ep("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Yo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Yo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function jp(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Rp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function vl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Dl(e)||!e.isEmpty())}function Gp(t){let e=t.getLastDescendant();Hp(e)?e.select():Bp(e)?e.selectEnd():e!==null&&e.selectNext()}function Up({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Ml(),l=zt(null),[s,a]=Pe(n),[d,c]=Pe({columns:1,rows:1}),[u,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=Fp();Se(()=>i.registerMutationListener(Op,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),Se(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(jp())})},[i]),Se(()=>{let b=e.current,T=l.current,I=i.getRootElement();if(b!=null&&T!=null&&I!=null){let L=I.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),F=5,G=A.right+F;if(G+M.width>window.innerWidth||G+M.width>L.right){let W=A.left-M.width-F;G=(W<0?F:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?F:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),Se(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&r(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[r,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),I=i.getElementByKey(T.getKey());if(!I)throw new Error("Expected to find tableElement in DOM");let L=Ap(I);L!==null&&L.clearHighlight(),T.markDirty(),a(s.getLatest())}Pp().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:I}=Jo(b),L=b.getNodes(),A=null;for(let M=0;M<L.length;M++){let F=L[M];if(Kt(F))if(A===null){F.setColSpan(T).setRowSpan(I),A=F;let G=vl(F),$;G&&Dl($=F.getFirstChild())&&$.remove()}else Kt(A)&&(vl(F)||A.append(...F.getChildren()),F.remove())}A!==null&&(A.getChildrenSize()===0&&A.append($p()),Gp(A)),o()}})},v=()=>{i.update(()=>{Dp()})},D=ae(b=>{i.update(()=>{Mp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<d.columns;T++)vp(b);o()})},[i,o,d.columns]),E=ae(()=>{i.update(()=>{Lp(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Np(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=yp(s),I=b.getChildren();if(T>=I.length||T<0)throw new Error("Expected table cell to be inside of table row.");let L=I[T];if(!yl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Ip(s),I=b.getChildren(),L=Math.max(...I.map(M=>M.getChildren().length));if(T>=L||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<I.length;M++){let F=I[M];if(!yl(F))throw new Error("Expected table row");let G=F.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),R=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),S=null;return t&&(u?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Al(Ce("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[S?Ce(Qo.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Wp({anchorElem:t,cellMerge:e}){let[o]=Ml(),r=zt(null),n=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),d=ae(()=>{let u=r.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Sp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);Se(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{d()})})),Se(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=u.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${w}px, ${C}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,t]);let c=zt(s);return Se(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ce(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Il,{})}),i&&P(Up,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Ol=t=>{let e=wp(3),{anchorElem:o}=t,r=kp(),n;return e[0]!==r||e[1]!==o?(n=Al(r?P(Wp,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Vp}from"react/compiler-runtime";import{jsx as Jt,jsxs as Kp}from"react/jsx-runtime";import{useLexicalComposerContext as zp}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Zp}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Xp,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as Yp,$isTableCellNode as Fl,$isTableRowNode as Jp,getDOMCellFromTarget as qp,TableNode as Qp}from"@lexical/table";import{calculateZoomLevel as $l}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Bl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as ef}from"react-dom";var tf=33,Pl=92;function of({editor:t}){let e=Yt(null),o=Yt(null),r=Yt(null),n=B(),i=Yt(null),[l,s]=mt(null),[a,d]=mt(null),[c,u]=mt(!1),[m,p]=mt(null),f=dt(()=>{d(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(Qp,k=>{if(k.getColWidths())return k;let R=k.getColumnCount(),S=Pl;return k.setColWidths(Array(R).fill(S)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let I=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(u(h(T)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let L=qp(I);L&&a!==L?t.update(()=>{let A=tr(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),F=t.getElementByKey(M.getKey());if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=F.getBoundingClientRect(),d(L)}):L==null&&f()}},0)},R=T=>{setTimeout(()=>{u(!0)},0)},S=T=>{setTimeout(()=>{u(!1)},0)},b=t.registerRootListener((T,I)=>{I?.removeEventListener("mousemove",k),I?.removeEventListener("mousedown",R),I?.removeEventListener("mouseup",S),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",R),T?.addEventListener("mouseup",S)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Fl(R))throw new Error("TableCellResizer: Table cell node not found.");let S=er(R),b=Yp(R)+R.getRowSpan()-1,T=S.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let I=T[b];if(!Jp(I))throw new Error("Expected table row");let L=I.getHeight();if(L===void 0){let M=I.getChildren();L=Math.min(...M.map(F=>v(F,t)??1/0))}let A=Math.max(L+k,tf);I.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,R)=>R.getElementByKey(k.getKey())?.clientHeight,D=(k,R)=>{for(let S=0;S<R.length;S++)for(let b=0;b<R[S].length;b++)if(R[S][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Fl(R))throw new Error("TableCellResizer: Table cell node not found.");let S=er(R),[b]=Xp(S,null,null),T=D(R,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let I=S.getColWidths();if(!I)return;let L=I[T];if(L===void 0)return;let A=[...I],M=Math.max(L+k,Pl);A[T]=M,S.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let R=S=>{if(S.preventDefault(),S.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let I=$l(S.target);if(C(k)){let L=(S.clientY-T)/I;w(L)}else{let L=(S.clientX-b)/I;x(L)}f(),document.removeEventListener("mouseup",R)}};return R},[a,f,x,w]),g=dt(k=>R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:R,top:S,width:b}=a.elem.getBoundingClientRect(),T=$l(a.elem),I=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+S+k-I/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+R+b-I/2}px`,top:`${window.scrollY+S}px`,width:`${I}px`}},A=r.current;m&&l&&A&&(C(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/T}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/T}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),N(L)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&Kp(Bl.Fragment,{children:[Jt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Hl=()=>{let t=Vp(3),[e]=zp(),o=Zp(),r,n;return t[0]!==o||t[1]!==e?(n=o?ef(Jt(of,{editor:e}),document.body):null,t[0]=o,t[1]=e,t[2]=n):n=t[2],r=n,r};import{c as df}from"react/compiler-runtime";import{jsx as rr,jsxs as mf,Fragment as pf}from"react/jsx-runtime";import{useLexicalComposerContext as Zl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as ff,$getTableRowIndexFromTableCellNode as hf,$insertTableColumn__EXPERIMENTAL as gf,$insertTableRow__EXPERIMENTAL as Cf,$isTableCellNode as xf,$isTableNode as Ul,TableNode as bf}from"@lexical/table";import{$findMatchingParent as _f,mergeRegister as Tf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Wl}from"lexical";import{useEffect as Vl,useMemo as Ef,useRef as Kl,useState as qt}from"react";import"react";import{createPortal as wf}from"react-dom";import{c as af}from"react/compiler-runtime";import{useEffect as cf,useRef as uf}from"react";var rf="Expected a function",nf=Math.max,lf=Math.min;function sf(t,e,o){let r,n,i=0,l,s=!1,a=!1,d,c,u,m=!0;if(typeof t!="function")throw new TypeError(rf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,d=a?nf(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(g){let _=r,N=l;return r=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,u=setTimeout(w,e),s?p(g):c}function h(g){let _=g-n,N=g-i,k=e-_;return a?lf(k,d-N):k}function C(g){let _=g-n,N=g-i;return n===void 0||_>=e||_<0||a&&N>=d}function w(){let g=Date.now();if(C(g))return v(g);u=setTimeout(w,h(g))}function v(g){return u=void 0,m&&r?p(g):(r=l=void 0,c)}function D(){u!==void 0&&clearTimeout(u),i=0,r=n=l=u=void 0}function x(){return u===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(r=arguments,l=this,n=g,_){if(u===void 0)return f(n);if(a)return clearTimeout(u),u=setTimeout(w,e),p(n)}return u===void 0&&(u=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var jl=sf;function Gl(t,e,o){let r=af(6),n=uf(null),i,l;r[0]!==t||r[1]!==e||r[2]!==o?(i=()=>(n.current=jl(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=i,r[4]=l):(i=r[3],l=r[4]),cf(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...d)=>{let c=d;n.current&&n.current(...c)},r[5]=s):s=r[5],s}var zl=20;function kf({anchorElem:t}){let[e]=Zl(),o=B(),[r,n]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[d,c]=qt({}),u=Kl(new Set),m=Kl(null),p=Gl(C=>{let{isOutside:w,tableDOMNode:v}=Nf(C,o.editorConfig?.lexical);if(w){n(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=Wl(v);if(xf(g)){let _=_f(g,N=>Ul(N));if(!Ul(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),R=hf(g),S=ff(g);R===N-1?D=g:S===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:R,y:S}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),n(!0),c({height:zl,left:N-b,top:g-T+5,width:R})):x&&(l(!0),n(!1),c({height:_,left:k-b+5,top:S-T,width:zl}))}},50,250),f=Ef(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Vl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Vl(()=>Tf(e.registerMutationListener(bf,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":u.current.add(w),a(u.current.size>0),D&&f.observe(D);break;case"destroyed":u.current.delete(w),a(u.current.size>0),f.disconnect(),u.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(Wl(m.current)?.selectEnd(),C?(Cf(),n(!1)):(gf(),l(!1)))})};return e?.isEditable()?mf(pf,{children:[r&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...d},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...d},type:"button"})]}):null}function Nf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){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 Xl(t){let e=df(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Zl();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=wf(rr(kf,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as Lf}from"react/compiler-runtime";import{jsx as nr,jsxs as Rf}from"react/jsx-runtime";import{useLexicalComposerContext as Sf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as If}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as yf,TableNode as vf}from"@lexical/table";import{mergeRegister as Mf}from"@lexical/utils";import{formatDrawerSlug as Df,useEditDepth as Af}from"@payloadcms/ui";import{$getSelection as Of,$isRangeSelection as Ff,COMMAND_PRIORITY_EDITOR as $f,createCommand as Pf}from"lexical";import{createContext as Bf,useContext as Hf,useEffect as jf,useMemo as Gf,useState as Uf}from"react";import*as Yl from"react";var Qt=Pf("OPEN_EMBED_DRAWER_COMMAND"),Jl=Bf({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ql({children:t}){let[e,o]=Uf({cellEditorConfig:null,cellEditorPlugins:null});return nr(Jl.Provider,{value:Gf(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ql=()=>{let t=Lf(16),[e]=Sf(),o=Hf(Jl),r=Af(),{fieldProps:n,uuid:i}=B(),{schemaPath:l}=n,s="lexical-table-create-"+i,a;t[0]!==s||t[1]!==r?(a=Df({slug:s,depth:r}),t[0]=s,t[1]=r,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=ce(d,!0),u;t[3]!==e||t[4]!==c?(u=()=>{if(!e.hasNodes([vf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Mf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=Of();Ff(C)&&(h=C)}),h&&c(),!0},$f))},t[3]=e,t[4]=c,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],jf(u,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(yf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==d||t[13]!==p||t[14]!==l?(f=Rf(Yl.Fragment,{children:[nr(He,{drawerSlug:d,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(If,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=d,t[13]=p,t[14]=l,t[15]=f):f=t[15],f};var zf=y({markdownTransformers:[Rl],nodes:[Vf,Wf,Kf],plugins:[{Component:Ql,position:"normal"},{Component:Hl,position:"normal"},{Component:Ol,position:"floatingAnchorElem"},{Component:Xl,position:"floatingAnchorElem"}],providers:[ql],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[de([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as g1}from"lexical";import{jsx as ir,jsxs as Zf}from"react/jsx-runtime";import"react";var lr=()=>Zf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as r1}from"react/compiler-runtime";import{jsx as n1}from"react/jsx-runtime";import{useLexicalComposerContext as i1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as l1,mergeRegister as s1}from"@lexical/utils";import{useConfig as a1}from"@payloadcms/ui";import{$getPreviousSelection as c1,$getSelection as u1,$isParagraphNode as ts,$isRangeSelection as d1,COMMAND_PRIORITY_EDITOR as m1,createCommand as p1}from"lexical";import{useEffect as f1}from"react";import{c as Xf}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as Yf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Jf,COMMAND_PRIORITY_EDITOR as qf}from"lexical";import{useEffect as Qf,useState as e1}from"react";var t1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Jf(o);n&&n.replace(Ke({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:r})},o1=t=>{let e=Xf(13),{enabledCollectionSlugs:o}=t,[r]=Yf(),[n,i]=e1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:d}=lt(l),c,u;e[2]!==r||e[3]!==d?(c=()=>r.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),d(),!0),qf),u=[r,d],e[2]=r,e[3]=d,e[4]=c,e[5]=u):(c=e[4],u=e[5]),Qf(c,u);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),t1({editor:r,relationTo:C,replaceNodeKey:n,value:w})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==p||e[11]!==a?(f=sr(a,{onSelect:p}),e[10]=p,e[11]=a,e[12]=f):f=e[12],f},es=t=>sr(bt,{...t,uploads:!0,children:sr(o1,{...t})});var ar=p1("INSERT_UPLOAD_COMMAND"),os=t=>{let e=r1(5),[o]=i1(),{config:r}=a1(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return s1(o.registerCommand(ar,a=>(o.update(()=>{let d=u1()||c1();if(d1(d)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});l1(c);let{focus:u}=d,m=u.getNode();ts(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(p=>ts(p)).length>1&&m.remove()}}),!0),m1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),f1(i,l);let s;return e[3]!==n?(s=n1(es,{enabledCollectionSlugs:n.map(h1)}),e[3]=n,e[4]=s):s=e[4],s};function h1(t){let{slug:e}=t;return e}var C1=y({nodes:[Ve],plugins:[{Component:os,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:lr,isActive:({selection:t})=>{if(!g1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as x1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as b1}from"@payloadcms/ui";import{lazy as _1,Suspense as T1,useEffect as E1,useState as w1}from"react";var rs={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:rs};function ns({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:r}){for(let s of r.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");r.features=r.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let n=new Map;for(let s of r.features)n.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of r.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:n,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:r}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var is=t=>{let e={enabledFeatures:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function cr(t,e,o){return{admin:o,features:is(t),lexical:e,resolvedFeatureMap:t}}var k1=_1(()=>import("./Field-OHQPCDNR.js").then(t=>({default:t.RichText}))),N1=t=>{let e=x1(14),{admin:o,clientFeatures:r,featureClientSchemaMap:n,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let d=a,c=l===void 0?eo:l,[u,m]=w1(null),p,f;e[2]!==u||e[3]!==r||e[4]!==c||e[5]!==n||e[6]!==i||e[7]!==s||e[8]!==d?(p=()=>{if(u)return;let C=[];for(let[D,x]of Object.entries(r))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ns({featureClientSchemaMap:n,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,d))},f=[c,d,u,r,n,i,s],e[2]=u,e[3]=r,e[4]=c,e[5]=n,e[6]=i,e[7]=s,e[8]=d,e[9]=p,e[10]=f):(p=e[9],f=e[10]),E1(p,f);let h;return e[11]!==u||e[12]!==t?(h=ur(T1,{fallback:ur(b1,{height:"35vh"}),children:u&&ur(k1,{...t,editorConfig:u})}),e[11]=u,e[12]=t,e[13]=h):h=e[13],h};function L1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function ls(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=ls(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=ls(l);for(let d of r)a!==null&&d([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},to.set(t,o)}return o.listeners.add(e),()=>{R1(t,e)}}function R1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function S1(t,e){return oo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function I1(t,e){return oo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function y1(t,e){return oo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function v1(t,e){return oo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}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},M1=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,D1="\xA0",A1=`
34
+ `},[t,e]),p=ke((x,E)=>{o(g=>{let _=e.length-1,N=e[_];if(N&&N.name===x){if(x==="type")return[...e.slice(0,_),{...N,value:N.value+E}];if(N.value===E)return[...e.slice(0,_),{...N,count:N.count+1}]}return[...g,{name:x,count:1,value:E}]})},[e,o]);Ur(()=>{let x=g=>{if(!r)return;let _=g.key;Ma(g)?p("selectAll",""):Vr.has(_)?p("press",g.key):[..._].length>1?p("keydown",g.key):p("type",g.key)},E=g=>{if(!r)return;let _=g.key;!Vr.has(_)&&[..._].length>1&&p("keyup",g.key)};return t.registerRootListener((g,_)=>{_!==null&&(_.removeEventListener("keydown",x),_.removeEventListener("keyup",E)),g!==null&&(g.addEventListener("keydown",x),g.addEventListener("keyup",E))})},[t,r,p]),Ur(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),xo(()=>{if(e){let x=m();x!==null&&s(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),xo(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:g,editorState:_})=>{if(!r)return;let N=_._selection,k=a.current,R=d.current;if(k!==N){if(g.size===0&&E.size===0&&!R){let b=window.getSelection();if(b&&(b.anchorNode==null||b.focusNode==null))return}a.current=N}d.current=!1;let I=m();I!==null&&s(I)}),[t,m,r,p]),xo(()=>r?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,r]);let f=ke(x=>{r||(x.update(()=>{let E=Ia();E.clear();let g=Ra();E.append(La().append(g)),g.select()}),o([])),n(E=>!E)},[r]),h=ke(()=>{if(!r)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:E,anchorOffset:g,focusNode:_,focusOffset:N}=Da(x),k=u().getRootElement(),R;E!==null&&(R=Wr(E,k));let I;_!==null&&(I=Wr(_,k)),p("snapshot",{anchorNode:E,anchorOffset:g,anchorPath:R,focusNode:_,focusOffset:N,focusPath:I})},[p,r,u]),C=ke(()=>{Sa(m())},[m]),w=ke(()=>{ya("test.js",m())},[m]);return[Ne("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{f(u()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?_o("div",{className:"test-recorder-output",children:[_o("div",{className:"test-recorder-toolbar",children:[Ne("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ne("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{C(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ne("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{w(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ne("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var zr=()=>{let t=ka(3),[e]=Na(),[o,r]=Aa(e),n;return t[0]!==o||t[1]!==r?(n=_o(Kr.Fragment,{children:[Ne("p",{children:"HI"}),o,r,Ne("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Oa=y({plugins:[{Component:zr,position:"bottom"}]});import{c as Fa}from"react/compiler-runtime";import{jsx as $a}from"react/jsx-runtime";import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ba}from"@lexical/react/LexicalTreeView.js";import"react";var Zr=()=>{let t=Fa(2),[e]=Pa(),o;return t[0]!==e?(o=$a(Ba,{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 Ha=y({plugins:[{Component:Zr,position:"bottom"}]});import{$isTableSelection as ja}from"@lexical/table";import{$isRangeSelection as Ga,FORMAT_TEXT_COMMAND as Ua}from"lexical";import{jsx as Xr}from"react/jsx-runtime";import"react";var Yr=()=>Xr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Xr("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var Jr={type:"text-format",format:["bold","italic"],tag:"***"},qr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Qr={type:"text-format",format:["bold"],tag:"**"},en={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var tn=[Y([{ChildComponent:Yr,isActive:({selection:t})=>Ga(t)||ja(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Ua,"bold")},order:1}])],Wa=y(({featureProviderMap:t})=>{let e=[Qr,en];return t.get("italic")&&e.push(qr,Jr),{markdownTransformers:e,toolbarFixed:{groups:tn},toolbarInline:{groups:tn}}});import{$isTableSelection as Ka}from"@lexical/table";import{$isRangeSelection as za,FORMAT_TEXT_COMMAND as Za}from"lexical";import{jsx as on,jsxs as Va}from"react/jsx-runtime";import"react";var rn=()=>Va("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[on("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),on("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var nn={type:"text-format",format:["code"],tag:"`"};var ln=[Y([{ChildComponent:rn,isActive:({selection:t})=>za(t)||Ka(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Za,"code")},order:7}])],Xa=y({markdownTransformers:[nn],toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{$isTableSelection as Ya}from"@lexical/table";import{$isRangeSelection as Ja,FORMAT_TEXT_COMMAND as qa}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var an=()=>sn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var cn={type:"text-format",format:["italic"],tag:"*"},un={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var dn=[Y([{ChildComponent:an,isActive:({selection:t})=>Ja(t)||Ya(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(qa,"italic")},order:2}])],Qa=y({markdownTransformers:[cn,un],toolbarFixed:{groups:dn},toolbarInline:{groups:dn}});import{$isTableSelection as tc}from"@lexical/table";import{$isRangeSelection as oc,FORMAT_TEXT_COMMAND as rc}from"lexical";import{jsx as mn,jsxs as ec}from"react/jsx-runtime";import"react";var pn=()=>ec("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),mn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var fn={type:"text-format",format:["strikethrough"],tag:"~~"};var hn=[Y([{ChildComponent:pn,isActive:({selection:t})=>oc(t)||tc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(rc,"strikethrough")},order:4}])],nc=y({markdownTransformers:[fn],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$isTableSelection as ic}from"@lexical/table";import{$isRangeSelection as lc,FORMAT_TEXT_COMMAND as sc}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var Cn=()=>gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var xn=[Y([{ChildComponent:Cn,isActive:({selection:t})=>lc(t)||ic(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(sc,"subscript")},order:5}])],ac=y({toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$isTableSelection as cc}from"@lexical/table";import{$isRangeSelection as uc,FORMAT_TEXT_COMMAND as dc}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Tn=[Y([{ChildComponent:_n,isActive:({selection:t})=>uc(t)||cc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(dc,"superscript")},order:6}])],mc=y({toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as fc}from"@lexical/table";import{$isRangeSelection as hc,FORMAT_TEXT_COMMAND as gc}from"lexical";import{jsx as En,jsxs as pc}from"react/jsx-runtime";import"react";var wn=()=>pc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[En("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),En("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kn=[Y([{ChildComponent:wn,isActive:({selection:t})=>hc(t)||fc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(gc,"underline")},order:3}])],Cc=y({toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});import{$createHeadingNode as Tc,$isHeadingNode as Pn,HeadingNode as Ec}from"@lexical/rich-text";import{$setBlocksType as wc}from"@lexical/selection";import{$getSelection as kc,$isRangeSelection as Nc}from"lexical";import{jsx as Nn}from"react/jsx-runtime";import"react";var Ln=()=>Nn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Nn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Rn}from"react/jsx-runtime";import"react";var In=()=>Rn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Rn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Sn}from"react/jsx-runtime";import"react";var yn=()=>Sn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Dn}from"react/jsx-runtime";import"react";var An=()=>Dn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Dn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as On}from"react/jsx-runtime";import"react";var Fn=()=>On("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:On("path",{d:"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 xc,$isHeadingNode as bc,HeadingNode as _c}from"@lexical/rich-text";var To=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var $n=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[_c],export:(n,i)=>{if(!bc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:To(n=>{let i="h"+n[1].length;return xc(i)})}};var Bn=t=>{let e=kc();wc(e,()=>Tc(t))},Hn={h1:Ln,h2:In,h3:yn,h4:Mn,h5:An,h6:Fn},Lc=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[q(e.map((r,n)=>({ChildComponent:Hn[r],isActive:({selection:i})=>{if(!Nc(i))return!1;for(let l of i.getNodes()){if(Pn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Pn(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Bn(r)})},order:n+2})))];return{markdownTransformers:[$n(e)],nodes:[Ec],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Hn[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(()=>{Bn(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Oc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Eo=()=>jn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Gn,jsxs as Rc}from"react/jsx-runtime";import"react";var Un=()=>Rc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gn("path",{d:"M5 10h10",stroke:"currentColor"}),Gn("path",{d:"M10 15V5",stroke:"currentColor"})]});var de=t=>({type:"dropdown",ChildComponent:Un,items:t,key:"add",order:10});var Wn={type:"element",dependencies:[gt],export:(t,e)=>xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ct();e&&t.replace(e)}};import{c as Ic}from"react/compiler-runtime";import{useLexicalComposerContext as Sc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as yc}from"@lexical/utils";import{$getSelection as vc,$isRangeSelection as Mc,COMMAND_PRIORITY_EDITOR as Dc}from"lexical";import{useEffect as Ac}from"react";var Vn=()=>{let t=Ic(3),[e]=Sc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Be,n=>{let i=vc();if(!Mc(i))return!1;if(i.focus.getNode()!==null){let s=Ct();yc(s)}return!0},Dc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ac(o,r),null};var Fc=y({markdownTransformers:[Wn],nodes:[gt],plugins:[{Component:Vn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Eo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]},toolbarFixed:{groups:[de([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Oc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Bc,OUTDENT_CONTENT_COMMAND as Hc}from"lexical";import{jsx as vt,jsxs as $c}from"react/jsx-runtime";import"react";var Kn=()=>$c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[vt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Mt,jsxs as Pc}from"react/jsx-runtime";import"react";var zn=()=>Pc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Zn=t=>({type:"buttons",items:t,key:"indent",order:35});var Xn=[Zn([{ChildComponent:Kn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Hc,void 0)},order:1},{ChildComponent:zn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bc,void 0)},order:2}])],jc=y({toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$findMatchingParent as qu}from"@lexical/utils";import{$getSelection as yo,$isRangeSelection as Li}from"lexical";import{jsx as Yn}from"react/jsx-runtime";import"react";var Jn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as qn}from"@lexical/selection";function Me(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?qn(o)?r:n:qn(e)?r:n}var wo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as qc,$isTextNode as Qc}from"lexical";import{addClassNamesToElement as Gc,isHTMLAnchorElement as Uc}from"@lexical/utils";import Lo from"bson-objectid";import{$applyNodeReplacement as Wc,$createTextNode as Qn,$getSelection as Vc,$isElementNode as ei,$isRangeSelection as No,createCommand as Kc,ElementNode as zc}from"lexical";var Zc=new Set(["http:","https:","mailto:","sms:","tel:"]),Q=class t extends zc{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Xc,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Lo.default().toHexString(),e.version=3);let o=me({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener")),Gc(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,r){if(!No(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&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(ei(r)){let n=me({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Zc.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=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=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ko(o.rel,"remove","noopener"))),!1}};function Xc(t){let e=null;if(Uc(t)){let o=t.textContent;o!==null&&o!==""&&(e=me({id:new Lo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function me({id:t,fields:e}){return Wc(new Q({id:t??new Lo.default().toHexString(),fields:e}))}function V(t){return t instanceof Q}var le=Kc("TOGGLE_LINK_COMMAND");function ti(t){let e=Vc();if(!No(e)&&!t.selectedNodes?.length)return;let o=No(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(r=>{let n=r.getParent();if(V(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o?.length===1){let i=o[0],l=V(i)?i:Yc(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Qn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||ei(i)&&!i.isInline())){if(V(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Qn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=me({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),V(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function Yc(t){return Jc(t,e=>V(e))}function Jc(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ko(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var oi={type:"text-match",dependencies:[Q],export:(t,e,o)=>{if(!V(t))return null;let r=t,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Qc(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=me({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=qc(o);i.setFormat(t.getFormat()),n.append(i),t.replace(n)},trigger:")"};import{$applyNodeReplacement as eu,$isElementNode as tu}from"lexical";var pe=class t extends Q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Qe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(tu(r)){let n=Qe({fields:this.__fields});return r.append(n),n}return null}};function Qe({fields:t}){return eu(new pe({id:"",fields:t}))}function fe(t){return t instanceof pe}import{c as ou}from"react/compiler-runtime";import{useLexicalComposerContext as ru}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as nu}from"@lexical/utils";import{$createTextNode as ri,$getSelection as iu,$isElementNode as ii,$isLineBreakNode as li,$isNodeSelection as lu,$isRangeSelection as su,$isTextNode as et,TextNode as au}from"lexical";import{useEffect as cu}from"react";function ni(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=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var uu=/[.,;\s]/;function At(t){return uu.test(t)}function ai(t){return At(t[t.length-1])}function Io(t){return At(t[0])}function du(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ci(t){let e=t.getPreviousSibling();return ii(e)&&(e=e.getLastDescendant()),e===null||li(e)||et(e)&&ai(e.getTextContent())}function ui(t){let e=t.getNextSibling();return ii(e)&&(e=e.getFirstDescendant()),e===null||li(e)||et(e)&&Io(e.getTextContent())}function mu(t,e,o,r){return(t>0?At(o[t-1]):ci(r[0]))?e<o.length?At(o[e]):ui(r[r.length-1]):!1}function pu(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let d=a[0],u=d.getTextContent().length,m=s;s+u<=e?(r.push(d),l+=u):m>=o?i.push(d):n.push(d),s+=u,a.shift()}return[l,r,n,i]}function fu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Qe({fields:n});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=ri(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let d=[],c;for(let f=1;f<t.length;f++){let h=t[f],w=h.getTextContent().length,v=s,D=s+w;if(v<o)if(D<=o)d.push(h);else{let[x,E]=h.splitText(o-v);d.push(x),c=E}s+=w}let u=iu(),m=u?u.getNodes().find(et):void 0,p=ri(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...d),m&&m===a&&(su(u)?p.select(u.anchor.offset,u.focus.offset):lu(u)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function hu(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=si(i,e))!=null&&l!==null;){let a=l.index,d=l.length,c=a+d;if(mu(s+a,s+c,n,r)){let[m,,p,f]=pu(r,s+a,s+c),h=s+a-m,C=s+c-m,w=fu(p,h,C,l);r=w?[w,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Ro(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let d=r[a];if(!et(d)||!d.isSimpleText()){Dt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=si(i,e);if(l===null||l.text!==i){Dt(t),o(null,t.getFields()?.url??null);return}if(!ci(t)||!ui(t)){Dt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function gu(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(fe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!Io(i)||du(i,l))&&(r.append(t),Ro(r,e,o),o(null,r.getFields()?.url??null))}fe(n)&&!ai(i)&&(Dt(n),Ro(n,e,o),o(null,n.getFields()?.url??null))}function Dt(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 Cu(t){let e=[t],o=t.getNextSibling();for(;o!==null&&et(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function xu(t,e,o){let r=ou(5),n,i;r[0]!==t||r[1]!==o||r[2]!==e?(n=()=>{if(!t.hasNodes([pe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return nu(t.registerNodeTransform(au,s=>{let a=s.getParentOrThrow(),d=s.getPreviousSibling();if(fe(a))Ro(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(Io(s.getTextContent())||!fe(d))){let c=Cu(s);hu(c,e,l)}gu(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=n,r[4]=i):(n=r[3],i=r[4]),cu(n,i)}var bu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,_u=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Tu=[ni(bu,t=>t.startsWith("http")?t:`https://${t}`),ni(_u,t=>`mailto:${t}`)],di=()=>{let[t]=ru();return xu(t,Tu),null};import{jsx as Eu}from"react/jsx-runtime";import{ClickableLinkPlugin as wu}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var mi=()=>Eu(wu,{});import{jsx as Hu}from"react/jsx-runtime";import"react";import{createPortal as ju}from"react-dom";import{jsx as he,jsxs as tt,Fragment as Nu}from"react/jsx-runtime";import{useLexicalComposerContext as Lu}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as pi,mergeRegister as fi}from"@lexical/utils";import{getTranslation as So}from"@payloadcms/translations";import{CloseMenuIcon as Ru,EditIcon as Iu,ExternalLinkIcon as hi,formatDrawerSlug as Su,useConfig as yu,useEditDepth as vu,useLocale as Mu,useTranslation as Du}from"@payloadcms/ui";import{requests as Au}from"@payloadcms/ui/shared";import{$getSelection as gi,$isLineBreakNode as Ou,$isRangeSelection as Ci,COMMAND_PRIORITY_HIGH as Fu,COMMAND_PRIORITY_LOW as xi,KEY_ESCAPE_COMMAND as $u,SELECTION_CHANGE_COMMAND as Pu}from"lexical";import bi,{useCallback as _i,useEffect as $t,useRef as Bu,useState as Le}from"react";function Ot(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),d=t.top-r,c=t.left-n;d<a.top&&(d+=l.height+t.height+r*2),c+l.width>a.right&&(c=a.right-l.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as ku}from"lexical";var Ft=ku("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ti({anchorElem:t}){let[e]=Lu(),[o,r]=Le(),n=Bu(null),[i,l]=Le(null),[s,a]=Le(null),{fieldProps:{schemaPath:d},uuid:c}=B(),{config:u}=yu(),{i18n:m,t:p}=Du(),[f,h]=Le(),C=vu(),[w,v]=Le(!1),[D,x]=Le([]),E=Mu(),[g,_]=Le(!1),N=Su({slug:"lexical-rich-text-link-"+c,depth:C}),{toggleDrawer:k}=ce(N),R=_i(()=>{v(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),_(!1),l(null),a(null),x([]),h(void 0)},[v,l,a,x]),I=_i(()=>{let b=gi(),T;if(!Ci(b)||!b){R();return}let S=Me(b);T=e.getElementByKey(S.getKey())?.getBoundingClientRect();let L=pi(S,V),A=b.getNodes().filter(U=>!Ou(U)).find(U=>{let H=pi(U,V);return L&&!L.is(H)||H&&!H.is(L)});if(L==null||A){R();return}r(L);let M=L.getFields(),F={...M,id:L.getID(),text:L.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let U=u.collections.find(H=>H.slug===M?.doc?.relationTo);if(!U)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let H=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,ee=M.doc?.relationTo;if(!H||!ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let pt=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(pt),Au.get(`${u.serverURL}${u.routes.api}/${ee}/${H}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:E?.code}}).then(async ie=>{if(!ie.ok)throw new Error(`HTTP error! Status: ${ie.status}`);let ye=await ie.json(),ft=U?.admin?.useAsTitle||"id",ht=ye[ft],dr=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${ht}`}).replace(/<[^>]*>?/g,"");a(dr)}).catch(()=>{let ie=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${H}`}).replace(/<[^>]*>?/g,"");a(ie)})}}h(F),v(!0),x(b?b?.getNodes():[]),fe(L)?_(!0):_(!1);let G=n.current,$=window.getSelection(),{activeElement:W}=document;if(G===null)return;let J=e.getRootElement();return $!==null&&J!==null&&J.contains($.anchorNode)?(T||(T=$.getRangeAt(0).getBoundingClientRect()),T!=null&&(T.y+=40,Ot(T,G,t))):(W==null||W.className!=="link-input")&&(J!==null&&Ot(null,G,t),l(null),a(null)),!0},[e,R,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,E?.code,t]);return $t(()=>fi(e.registerCommand(Ft,b=>(e.dispatchCommand(le,b),I(),k(),!0),xi)),[e,I,k,N]),$t(()=>{let b=t.parentElement,T=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",T),b?.addEventListener("scroll",T),()=>{window.removeEventListener("resize",T),b?.removeEventListener("scroll",T)}},[t.parentElement,e,I]),$t(()=>fi(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{I()})}),e.registerCommand(Pu,()=>(I(),!0),xi),e.registerCommand($u,()=>w?(R(),!0):!1,Fu)),[e,I,w,R]),$t(()=>{e.getEditorState().read(()=>{I()})},[e,I]),tt(bi.Fragment,{children:[he("div",{className:"link-editor",ref:n,children:tt("div",{className:"link-input",children:[i&&i.length>0?tt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?he(hi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?tt(Nu,{children:[o?.__fields.newTab?he(hi,{}):null,he("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&tt(bi.Fragment,{children:[he("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{k()},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:he(Iu,{})}),!g&&he("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(le,null)},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:he(Ru,{})})]})]})}),he(He,{className:"lexical-link-edit-drawer",data:f,drawerSlug:N,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(b,T)=>{let S=T,L={...S};delete L.text,e.update(()=>{let A=gi(),M=null;if(Ci(A)?M=Me(A).getParent():D.length&&(M=D[0].getParent()),M&&fe(M)){let F=me({fields:L});M.replace(F,!0)}}),e.dispatchCommand(le,{fields:L,selectedNodes:D,text:S.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var Ei=t=>{let{anchorElem:e=document.body}=t;return ju(Hu(Ti,{anchorElem:e}),e)};import{c as Wu}from"react/compiler-runtime";import{useLexicalComposerContext as Vu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ku}from"@lexical/utils";import{$getSelection as zu,$isElementNode as Zu,$isRangeSelection as Xu,COMMAND_PRIORITY_LOW as ki,PASTE_COMMAND as Yu}from"lexical";import{useEffect as Ju}from"react";var Gu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Uu=/^[\w\-./]*(?:#\w[\w-]*)?$/;function wi(t){if(!t)return!1;if(t==="https://"||Gu.test(t)||Uu.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ni=()=>{let t=Wu(3),[e]=Vu(),o,r;return t[0]!==e?(o=()=>{if(!e.hasNodes([Q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Ku(e.registerCommand(le,n=>(ti(n),!0),ki),e.registerCommand(Yu,n=>{let i=zu();if(!Xu(i)||i.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let l=n.clipboardData.getData("text");if(!wi(l))return!1;if(!i.getNodes().some(s=>Zu(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(le,{fields:s,text:null}),n.preventDefault(),!0}return!1},ki))},r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ju(o,r),null};var Ri=[wo([{ChildComponent:Jn,isActive:({selection:t})=>{if(Li(t)){let e=Me(t);return qu(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Li(t)&&yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(le,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=yo()?.getTextContent(),r=yo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Ft,{fields:n,selectedNodes:r,text:o})}},order:1}])],Qu=y({markdownTransformers:[oi],nodes:[Q,pe],plugins:[{Component:Ni,position:"normal"},{Component:di,position:"normal"},{Component:mi,position:"normal"},{Component:Ei,position:"floatingAnchorElem"}],toolbarFixed:{groups:Ri},toolbarInline:{groups:Ri}});import{$isListNode as Do,INSERT_CHECK_LIST_COMMAND as Di,ListItemNode as dd,ListNode as md}from"@lexical/list";import{$isRangeSelection as pd}from"lexical";import{jsx as Ii,jsxs as ed}from"react/jsx-runtime";import"react";var vo=()=>ed("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ii("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ii("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as td}from"react/jsx-runtime";import{ListPlugin as od}from"@lexical/react/LexicalListPlugin.js";import"react";var De=()=>td(od,{});function Ae(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as ld,ListItemNode as sd,ListNode as ad}from"@lexical/list";import{$createListItemNode as rd,$createListNode as nd,$isListItemNode as id,$isListNode as Mo}from"@lexical/list";var Si=4,Oe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=rd(t==="check"?r[3]==="x":void 0);if(Mo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Mo(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=nd(t,t==="number"?Number(r[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Si);s&&l.setIndent(s)},Re=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(id(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if(Mo(c)){r.push(Re(c,e,o+1));continue}}let s=" ".repeat(o*Si),a=t.getListType(),d=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+d+e(l)),i++}return r.join(`
35
+ `)};var yi={type:"element",dependencies:[ad,sd],export:(t,e)=>ld(t)?Re(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Oe("check")};import{jsx as cd}from"react/jsx-runtime";import{CheckListPlugin as ud}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var vi=()=>cd(ud,{});var Mi=[q([{ChildComponent:vo,isActive:({selection:t})=>{if(!pd(t))return!1;for(let e of t.getNodes()){if(Do(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Do(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Do(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Di,void 0)},order:12}])],fd=y(({featureProviderMap:t})=>{let e=[{Component:vi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:De,position:"normal"}),{markdownTransformers:[yi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[md,dd],plugins:e,slashMenu:{groups:[Ae([{Icon:vo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Di,void 0)}}])]},toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}});import{$isListNode as Oo,INSERT_ORDERED_LIST_COMMAND as Fi,ListItemNode as bd,ListNode as _d}from"@lexical/list";import{$isRangeSelection as Td}from"lexical";import{jsx as ot,jsxs as hd}from"react/jsx-runtime";import"react";var Ao=()=>hd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ot("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),ot("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),ot("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as gd,ListItemNode as Cd,ListNode as xd}from"@lexical/list";var Ai={type:"element",dependencies:[xd,Cd],export:(t,e)=>gd(t)?Re(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Oe("number")};var Oi=[q([{ChildComponent:Ao,isActive:({selection:t})=>{if(!Td(t))return!1;for(let e of t.getNodes()){if(Oo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Oo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Oo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Fi,void 0)},order:10}])],Ed=y(({featureProviderMap:t})=>({markdownTransformers:[Ai],nodes:t.has("orderedList")?[]:[_d,bd],plugins:t.has("orderedList")?[]:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Fi,void 0)}}])]},toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}}));import{$isListNode as $o,INSERT_UNORDERED_LIST_COMMAND as Bi,ListItemNode as Rd,ListNode as Id}from"@lexical/list";import{$isRangeSelection as Sd}from"lexical";import{jsx as Fe,jsxs as wd}from"react/jsx-runtime";import"react";var Fo=()=>wd("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:[Fe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Fe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Fe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Fe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Fe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Fe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as kd,ListItemNode as Nd,ListNode as Ld}from"@lexical/list";var $i={type:"element",dependencies:[Ld,Nd],export:(t,e)=>kd(t)?Re(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Oe("bullet")};var Pi=[q([{ChildComponent:Fo,isActive:({selection:t})=>{if(!Sd(t))return!1;for(let e of t.getNodes()){if($o(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($o(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!($o(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)},order:11}])],yd=y({markdownTransformers:[$i],nodes:[Id,Rd],plugins:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Fo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}});import{jsx as vd}from"react/jsx-runtime";import{addClassNamesToElement as Md}from"@lexical/utils";import{DecoratorNode as Dd}from"lexical";import*as Hi from"react";var Ad=Hi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),rt=class t extends Dd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Od({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Md(o,"unknownConverted"),o}decorate(){return vd(Ad,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Od({data:t}){return new rt({data:t})}var Fd=y(()=>({nodes:[rt]}));import{jsx as $d}from"react/jsx-runtime";import{addClassNamesToElement as Pd}from"@lexical/utils";import{DecoratorNode as Bd}from"lexical";import*as ji from"react";var Hd=ji.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends Bd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return jd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Pd(o,"unknownConverted"),o}decorate(){return $d(Hd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function jd({data:t}){return new nt({data:t})}var Gd=y(()=>({nodes:[nt]}));import{$setBlocksType as Wi}from"@lexical/selection";import{$createParagraphNode as Vi,$getSelection as Ki,$isParagraphNode as Gi,$isRangeSelection as Ud}from"lexical";var Ui=[q([{ChildComponent:ze,isActive:({selection:t})=>{if(!Ud(t))return!1;for(let e of t.getNodes())if(!Gi(e)&&!Gi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})},order:1}])],Wd=y({slashMenu:{groups:[Z([{Icon:ze,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ki();Wi(e,()=>Vi())})}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}});import{$isNodeSelection as xm}from"lexical";import{jsx as it,jsxs as Vd}from"react/jsx-runtime";import"react";var Po=()=>Vd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[it("g",{clipPath:"url(#clip0_4397_10817)",children:it("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),it("defs",{children:it("clipPath",{id:"clip0_4397_10817",children:it("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as lm}from"react/compiler-runtime";import{jsx as sm}from"react/jsx-runtime";import{useLexicalComposerContext as am}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as cm}from"@lexical/utils";import{useConfig as um}from"@payloadcms/ui";import{$getPreviousSelection as dm,$getSelection as mm,$isParagraphNode as qi,$isRangeSelection as pm,COMMAND_PRIORITY_EDITOR as fm,createCommand as hm}from"lexical";import{useEffect as gm}from"react";import{c as tm}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as om}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as rm,COMMAND_PRIORITY_EDITOR as nm}from"lexical";import{useEffect as Zi,useState as Xi}from"react";import{c as Kd}from"react/compiler-runtime";import{jsx as zd}from"react/jsx-runtime";import{useLexicalComposerContext as Zd}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Xd,useModal as Yd}from"@payloadcms/ui";import{$getPreviousSelection as Jd,$getSelection as qd,$setSelection as Qd}from"lexical";import{useEffect as em,useState as zi}from"react";var lt=t=>{let e=Kd(23),[o]=Zd(),[r,n]=zi(null),[i,l]=zi(!1),[s,a,d]=Xd(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=Yd(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=qd()??Jd();n(R)},e[0]=h):h=e[0];let C=h,w;e[1]!==r||e[2]!==o?(w=()=>{r&&o.update(()=>{Qd(r.clone())},{discrete:!0,skipTransforms:!0})},e[1]=r,e[2]=o,e[3]=w):w=e[3];let v=w,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let x=D,E,g;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==v?(E=()=>{if(!i)return;let R=f[u];R&&!R?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},g=[f,u,v,i],e[6]=i,e[7]=f,e[8]=u,e[9]=v,e[10]=E,e[11]=g):(E=e[10],g=e[11]),em(E,g);let _;e[12]!==a?(_=R=>zd(a,{...R,onClick:()=>{C()}}),e[12]=a,e[13]=_):_=e[13];let N;e[14]!==p?(N=()=>{C(),p(),l(!0)},e[14]=p,e[15]=N):N=e[15];let k;return e[16]!==x||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==_||e[21]!==N?(k={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:_,openListDrawer:N},e[16]=x,e[17]=m,e[18]=s,e[19]=u,e[20]=_,e[21]=N,e[22]=k):k=e[22],k};var im=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=rm(o);n&&n.replace(Ue({relationTo:e,value:r}))}):t.dispatchCommand(Bo,{relationTo:e,value:r})},Yi=t=>{let e=tm(21),{enabledCollectionSlugs:o}=t,[r]=om(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=Xi(n),[s,a]=Xi(null),d=o||void 0,c;e[2]!==d||e[3]!==i?(c={collectionSlugs:d,selectedCollection:i},e[2]=d,e[3]=i,e[4]=c):c=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=lt(c),h,C;e[5]!==r||e[6]!==f?(h=()=>r.registerCommand(je,g=>(a(g?.replace?g?.replace.nodeKey:null),f(),!0),nm),C=[r,f],e[5]=r,e[6]=f,e[7]=h,e[8]=C):(h=e[7],C=e[8]),Zi(h,C);let w;e[9]!==r||e[10]!==s||e[11]!==u?(w=g=>{let{collectionSlug:_,docID:N}=g;im({editor:r,relationTo:_,replaceNodeKey:s,value:N}),u()},e[9]=r,e[10]=s,e[11]=u,e[12]=w):w=e[12];let v=w,D;e[13]!==o?(D=()=>{l(o?.[0])},e[13]=o,e[14]=D):D=e[14];let x;e[15]!==m||e[16]!==o?(x=[m,o],e[15]=m,e[16]=o,e[17]=x):x=e[17],Zi(D,x);let E;return e[18]!==v||e[19]!==p?(E=Pt(p,{onSelect:v}),e[18]=v,e[19]=p,e[20]=E):E=e[20],E},Ji=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Pt(Yi,{...t}):Pt(bt,{...t,children:Pt(Yi,{...t})});var Bo=hm("INSERT_RELATIONSHIP_COMMAND"),Qi=t=>{let e=lm(10),{clientProps:o}=t,[r]=am(),{config:n}=um(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],c=i.filter(u).map(Cm),e[0]=o,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([Ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Bo,c=>{let u=mm()||dm();if(pm(u)){let m=Ue(c);cm(m);let{focus:p}=u,f=p.getNode();qi(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>qi(h)).length>1&&f.remove()}return!0},fm)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),gm(s,a);let d;return e[8]!==l?(d=sm(Ji,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function Cm(t){let{slug:e}=t;return e}var bm=y({nodes:[Ge],plugins:[{Component:Qi,position:"normal"}],slashMenu:{groups:[Z([{Icon:Po,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Po,isActive:({selection:t})=>{if(!xm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]}});import{c as ll}from"react/compiler-runtime";import{jsx as ne,jsxs as Fm}from"react/jsx-runtime";import{useLexicalComposerContext as $m}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Pm,useThrottledEffect as Bm,useTranslation as Hm}from"@payloadcms/ui";import*as ge from"react";import{useMemo as jm}from"react";import{c as _m}from"react/compiler-runtime";import{jsx as Tm}from"react/jsx-runtime";import{mergeRegister as Em}from"@lexical/utils";import{$addUpdateTag as wm,$getSelection as km}from"lexical";import{useEffect as Bt,useState as Ho}from"react";var jo="toolbar-popup__button",st=t=>{let e=_m(34),{children:o,editor:r,item:n}=t,[i,l]=Ho(!0),[s,a]=Ho(!1),[d,c]=Ho(jo),u=B(),m;e[0]!==r||e[1]!==n||e[2]!==u||e[3]!==s||e[4]!==i?(m=()=>{r.getEditorState().read(()=>{let N=km();if(N){if(n.isActive){let k=n.isActive({editor:r,editorConfigContext:u,selection:N});s!==k&&a(k)}if(n.isEnabled){let k=n.isEnabled({editor:r,editorConfigContext:u,selection:N});i!==k&&l(k)}}})},e[0]=r,e[1]=n,e[2]=u,e[3]=s,e[4]=i,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Bt(f,h);let C,w;e[9]!==p?(C=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),w=[p],e[9]=p,e[10]=C,e[11]=w):(C=e[10],w=e[11]),Bt(C,w);let v,D;e[12]!==r||e[13]!==p?(v=()=>Em(r.registerUpdateListener(()=>{p()})),D=[r,p],e[12]=r,e[13]=p,e[14]=v,e[15]=D):(v=e[14],D=e[15]),Bt(v,D);let x;e[16]!==i||e[17]!==s||e[18]!==n?(x=()=>{c([jo,i===!1?"disabled":"",s?"active":"",n?.key?`${jo}-`+n.key:""].filter(Boolean).join(" "))},e[16]=i,e[17]=s,e[18]=n,e[19]=x):x=e[19];let E;e[20]!==i||e[21]!==s||e[22]!==d||e[23]!==n.key?(E=[i,s,d,n.key],e[20]=i,e[21]=s,e[22]=d,e[23]=n.key,e[24]=E):E=e[24],Bt(x,E);let g;e[25]!==i||e[26]!==r||e[27]!==n.onSelect||e[28]!==s?(g=()=>{if(i!==!1)return r.focus(()=>{r.update(()=>{wm("toolbar")}),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=i,e[26]=r,e[27]=n.onSelect,e[28]=s,e[29]=g):g=e[29];let _;return e[30]!==d||e[31]!==g||e[32]!==o?(_=Tm("button",{className:d,onClick:g,onMouseDown:Nm,type:"button",children:o}),e[30]=d,e[31]=g,e[32]=o,e[33]=_):_=e[33],_};function Nm(t){t.preventDefault()}import{c as il}from"react/compiler-runtime";import{jsx as $e}from"react/jsx-runtime";import Wo,{useEffect as nl}from"react";import{mergeRegister as Mm}from"@lexical/utils";import{useTranslation as Dm}from"@payloadcms/ui";import{$getSelection as Am}from"lexical";import{jsx as Te,jsxs as el}from"react/jsx-runtime";import{Button as Lm}from"@payloadcms/ui";import{$addUpdateTag as Rm}from"lexical";import Ht,{useCallback as Im,useEffect as at,useMemo as Sm,useRef as Uo,useState as jt}from"react";import{createPortal as ym}from"react-dom";var Go="toolbar-popup__dropdown-item",tl=Ht.createContext(null);function ol({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=jt(Go);at(()=>{a([Go,r===!1?"disabled":"",t?"active":"",i?.key?`${Go}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let d=Uo(null),c=Ht.useContext(tl);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return at(()=>{d?.current!=null&&u(d)},[d,u]),Te(Lm,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Rm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function vm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=jt(),[l,s]=jt(),a=Im(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},c=Sm(()=>({registerItem:a}),[a]);return at(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Te(tl.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function rl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Uo(null),d=Uo(null),[c,u]=jt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};at(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:C,top:w}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${w+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),at(()=>{let f=d.current;if(f!==null&&c){let h=C=>{let{target:w}=C;s!=null&&a.current!=null&&a.current.contains(w)||f.contains(w)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=ym(Te(vm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return el(Ht.Fragment,{children:[el("button",{"aria-label":t,className:e+(c?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[n&&Te(n,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Ht.Fragment,{children:p})]})}var Vo="toolbar-popup__dropdown",Om=t=>{let e=il(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Dm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(f=l?.Component&&$e(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=r,e[3]=n,e[4]=i,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==l||e[7]!==d||e[8]!==s||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=l,e[7]=d,e[8]=s,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==n||e[15]!==i||e[16]!==u?(p=$e(ol,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?$e(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:$e("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=n,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},Ie=t=>{let e=il(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Wo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=Wo.useState(f),[w,v]=Wo.useState(!0),D=B(),{items:x,key:E}=i,g;e[2]!==n||e[3]!==x||e[4]!==d||e[5]!==D||e[6]!==i||e[7]!==c?(g=()=>{n.getEditorState().read(()=>{let $=Am();if(!$)return;let W=[],J=[],U=[];for(let H of x)H.isActive&&(!d||W.length<d)&&H.isActive({editor:n,editorConfigContext:D,selection:$})&&(W.push(H.key),J.push(H)),H.isEnabled?H.isEnabled({editor:n,editorConfigContext:D,selection:$})&&U.push(H.key):U.push(H.key);i.isEnabled&&v(i.isEnabled({editor:n,editorConfigContext:D,selection:$})),p(W),C(U),c&&c({activeItems:J})})},e[2]=n,e[3]=x,e[4]=d,e[5]=D,e[6]=i,e[7]=c,e[8]=g):g=e[8];let _=g,N,k;e[9]!==_?(N=()=>{_()},k=[_],e[9]=_,e[10]=N,e[11]=k):(N=e[10],k=e[11]),nl(N,k);let R,I;e[12]!==n||e[13]!==_?(R=()=>Mm(n.registerUpdateListener(()=>{_()})),I=[n,_],e[12]=n,e[13]=_,e[14]=R,e[15]=I):(R=e[14],I=e[15]),nl(R,I);let b=`${E} dropdown`,T=`${Vo}-${E}`,S;e[16]!==r?(S=r||[],e[16]=r,e[17]=S):S=e[17];let L;e[18]!==T||e[19]!==S?(L=[Vo,T,...S].filter(Boolean),e[18]=T,e[19]=S,e[20]=L):L=e[20];let A=L.join(" "),M=!w,F;e[21]!==s?(F=s||[],e[21]=s,e[22]=F):F=e[22];let G;return e[23]!==F||e[24]!==x||e[25]!==m||e[26]!==o||e[27]!==n||e[28]!==h||e[29]!==b||e[30]!==A||e[31]!==M||e[32]!==l||e[33]!==a||e[34]!==E?(G=$e(rl,{buttonAriaLabel:b,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Vo}-items`,...F],label:a,children:x.length?x.map($=>$e(Om,{active:m.includes($.key),anchorElem:o,editor:n,enabled:h.includes($.key),item:$},$.key)):null},E),e[23]=F,e[24]=x,e[25]=m,e[26]=o,e[27]=n,e[28]=h,e[29]=b,e[30]=A,e[31]=M,e[32]=l,e[33]=a,e[34]=E,e[35]=G):G=e[35],G};function Gm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function Um(t){let e=ll(18),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Hm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=ge.useState(void 0),[p,f]=ge.useState(void 0),h,C;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},C=[i],e[0]=i,e[1]=h,e[2]=C):(h=e[1],C=e[2]),ge.useEffect(h,C);let w;e[3]!==i||e[4]!==d||e[5]!==s||e[6]!==c?(w=E=>{let{activeItems:g}=E;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let _=g[0],N=_.key;_.label&&(N=typeof _.label=="function"?_.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):_.label),N.length>25&&(N=N.substring(0,25)+"..."),g.length===1?(m(N),f(()=>_.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[3]=i,e[4]=d,e[5]=s,e[6]=c,e[7]=w):w=e[7];let v=w,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==r||e[12]!==u||e[13]!==v||e[14]!==n.features.toolbarFixed||e[15]!==l||e[16]!==D?(x=Fm("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?ne(Ie,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):ne(Ie,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):null,i.type==="buttons"&&i.items.length?i.items.map(E=>ne(Gm,{anchorElem:o,editor:r,item:E},E.key)):null,l<n.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[8]=i,e[9]=p,e[10]=o,e[11]=r,e[12]=u,e[13]=v,e[14]=n.features.toolbarFixed,e[15]=l,e[16]=D,e[17]=x):x=e[17],x}function Wm({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=ge.useRef(null),{y:l}=Pm(),s=jm(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let d=n.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Bm(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(ge.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,d)=>ne(Um,{anchorElem:t,editor:o,editorConfig:r,group:a,index:d},a.key))})})}var sl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return sl(t.parentEditor)}return!1},al=t=>{let e=ll(6),{clientProps:o}=t,[r]=$m(),n=B(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,a,d;if(e[0]!==n||e[1]!==o?.disableIfParentHasFixedToolbar||e[2]!==s||e[3]!==l){d=Symbol.for("react.early_return_sentinel");e:{let c=sl(n);if(o?.disableIfParentHasFixedToolbar&&c){d=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){d=null;break e}a=ne(Wm,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=n,e[1]=o?.disableIfParentHasFixedToolbar,e[2]=s,e[3]=l,e[4]=a,e[5]=d}else a=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:a};var Vm=y({plugins:[{Component:al,position:"aboveContainer"}]});import{c as dl}from"react/compiler-runtime";import{jsx as se,jsxs as ml}from"react/jsx-runtime";import{useLexicalComposerContext as Km}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as pl}from"@lexical/utils";import{$getSelection as fl,$isRangeSelection as cl,$isTextNode as zm,COMMAND_PRIORITY_LOW as Zm,SELECTION_CHANGE_COMMAND as Xm}from"lexical";import{useCallback as Ut,useEffect as ct,useRef as ul,useState as Ym}from"react";import*as Wt from"react";import{createPortal as Jm}from"react-dom";function Ko(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 Gt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let C=0;return!e&&f<p.top&&!s&&(C=u.height+a.height+d*2,f+=C),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),C}function qm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(st,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function Qm(t){let e=dl(14),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=Wt.useState(),d,c;e[0]!==n?(d=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},c=[n],e[0]=n,e[1]=d,e[2]=c):(d=e[1],c=e[2]),Wt.useEffect(d,c);let u;e[3]!==n?(u=h=>{let{activeItems:C}=h;if(!C.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let w=C[0];a(()=>w.ChildComponent)},e[3]=n,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[5]!==n||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==m||e[10]!==l.features.toolbarInline||e[11]!==i||e[12]!==p?(f=ml("div",{className:p,children:[n.type==="dropdown"&&n.items.length?s?se(Ie,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):se(Ie,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>se(qm,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&se("div",{className:"divider"})]},n.key),e[5]=n,e[6]=s,e[7]=o,e[8]=r,e[9]=m,e[10]=l.features.toolbarInline,e[11]=i,e[12]=p,e[13]=f):f=e[13],f}function ep({anchorElem:t,editor:e}){let o=ul(null),r=ul(null),{editorConfig:n}=B(),i=Ut(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ut(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ut(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ut(()=>{let d=fl(),c=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Ko(c,p),h=Gt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Gt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),pl(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(Xm,()=>(a(),!1),Zm))),[e,a]),ml("div",{className:"inline-toolbar-popup",ref:o,children:[se("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((d,c)=>se(Qm,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function tp(t,e){let o=dl(12),[r,n]=Ym(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=fl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!cl(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!cl(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),w=!1;for(let v of C)if(zm(v)){n(!0),w=!0;break}w||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>pl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ct(d,c),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=Jm(se(ep,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var hl=t=>{let{anchorElem:e}=t,[o]=Km();return tp(o,e)};var op=y({plugins:[{Component:hl,position:"floatingAnchorElem"}]});import{TableCellNode as Uf,TableNode as Wf,TableRowNode as Vf}from"@lexical/table";import{jsx as gl}from"react/jsx-runtime";import"react";var zo=()=>gl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as dp,$createTableNode as mp,$createTableRowNode as pp,$isTableCellNode as kl,$isTableNode as Zo,$isTableRowNode as Xo,TableCellHeaderStates as Vt,TableCellNode as fp,TableNode as hp,TableRowNode as gp}from"@lexical/table";import{$isParagraphNode as Cp,$isTextNode as xp}from"lexical";var Cl=/^[\t ]*$/,rp=/^(\s*)(\d+)\.\s/,np=/^(\s*)[-*+]\s/,ip=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,xl=/^(#{1,6})\s/,lp=/^>\s/,bl=/^[ \t]*```(\w+)?/,_l=/[ \t]*```$/,sp=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,ap=/^\|(.+)\|\s?$/,cp=/^(\| ?:?-*:? ?)+\|\s?$/,Tl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,El=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function up(t,e=!1){let o=t.split(`
36
+ `),r=!1,n=[];for(let i=0;i<o.length;i++){let l=o[i],s=n[n.length-1];if(sp.test(l)){n.push(l);continue}if((bl.test(l)&&!r||_l.test(l)&&r)&&(r=!r),bl.test(l)||_l.test(l)){n.push(l);continue}if(r){n.push(l);continue}Cl.test(l)||Cl.test(s)||!s||xl.test(s)||xl.test(l)||lp.test(l)||rp.test(l)||np.test(l)||ip.test(l)||ap.test(l)||cp.test(l)||!e||Tl.test(l)||El.test(l)||Tl.test(s)||El.test(s)?n.push(l):n[n.length-1]=s+" "+l.trim()}return n.join(`
37
+ `)}function wl(t,e=pr,o,r=!1,n=!0){let i=r?t:up(t,n);return fr(i,e,o)}var Ll=/^\|(.+)\|\s?$/,bp=/^(\| ?:?-*:? ?)+\|\s?$/,Rl=({allTransformers:t})=>({type:"element",dependencies:[hp,gp,fp],export:e=>{if(!Zo(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Xo(r))continue;let i=!1;for(let l of r.getChildren())kl(l)&&(n.push(hr(t,l).replace(/\n/g,"\\n")),l.__headerState===Vt.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
38
+ `)},regExp:Ll,replace:(e,o,r)=>{if(bp.test(r[0])){let c=e.getPreviousSibling();if(!c||!Zo(c))return;let u=c.getChildren(),m=u[u.length-1];if(!m||!Xo(m))return;m.getChildren().forEach(p=>{kl(p)&&p.setHeaderStyles(Vt.ROW,Vt.ROW)}),e.remove();return}let n=Nl(r[0],t);if(n==null)return;let i=[n],l=e.getPreviousSibling(),s=n.length;for(;l&&!(!Cp(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!xp(c))break;let u=Nl(c.getTextContent(),t);if(u==null)break;s=Math.max(s,u.length),i.unshift(u);let m=l.getPreviousSibling();l.remove(),l=m}let a=mp();for(let c of i){let u=pp();a.append(u);for(let m=0;m<s;m++)u.append(m<c.length?c[m]:Il("",t))}let d=e.getPreviousSibling();Zo(d)&&_p(d)===s?(d.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function _p(t){let e=t.getFirstChild();return Xo(e)?e.getChildrenSize():0}var Il=(t,e)=>{t=t.replace(/\\n/g,`
39
+ `);let o=dp(Vt.NO_STATUS);return wl(t,e,o),o},Nl=(t,e)=>{let o=t.match(Ll);return!o||!o[1]?null:o[1].split("|").map(r=>Il(r,e))};import{c as Ep}from"react/compiler-runtime";import{jsx as P,jsxs as Ce}from"react/jsx-runtime";import{useLexicalComposerContext as Ml}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as wp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as kp,$deleteTableRow__EXPERIMENTAL as Np,$getNodeTriplet as Lp,$getTableCellNodeFromLexicalNode as Rp,$getTableColumnIndexFromTableCellNode as Ip,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as Sp,$insertTableColumn__EXPERIMENTAL as yp,$insertTableRow__EXPERIMENTAL as vp,$isTableCellNode as Kt,$isTableRowNode as yl,$isTableSelection as Zt,$unmergeCell as Mp,getTableObserverFromTableElement as Dp,TableCellHeaderStates as Ee,TableCellNode as Ap}from"@lexical/table";import{useScrollInfo as Op}from"@payloadcms/ui";import{$createParagraphNode as Fp,$getRoot as $p,$getSelection as Xt,$isElementNode as Pp,$isParagraphNode as Dl,$isRangeSelection as qo,$isTextNode as Bp}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as Se,useRef as zt,useState as Pe}from"react";import{createPortal as Al}from"react-dom";import{jsx as Yo,jsxs as Tp}from"react/jsx-runtime";import"react";var Sl=()=>Tp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Yo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Yo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Hp(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Lp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function vl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Dl(e)||!e.isEmpty())}function jp(t){let e=t.getLastDescendant();Bp(e)?e.select():Pp(e)?e.selectEnd():e!==null&&e.selectNext()}function Gp({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Ml(),l=zt(null),[s,a]=Pe(n),[d,c]=Pe({columns:1,rows:1}),[u,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=Op();Se(()=>i.registerMutationListener(Ap,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),Se(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(Hp())})},[i]),Se(()=>{let b=e.current,T=l.current,S=i.getRootElement();if(b!=null&&T!=null&&S!=null){let L=S.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),F=5,G=A.right+F;if(G+M.width>window.innerWidth||G+M.width>L.right){let W=A.left-M.width-F;G=(W<0?F:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?F:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),Se(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&r(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[r,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),S=i.getElementByKey(T.getKey());if(!S)throw new Error("Expected to find tableElement in DOM");let L=Dp(S);L!==null&&L.clearHighlight(),T.markDirty(),a(s.getLatest())}$p().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:S}=Jo(b),L=b.getNodes(),A=null;for(let M=0;M<L.length;M++){let F=L[M];if(Kt(F))if(A===null){F.setColSpan(T).setRowSpan(S),A=F;let G=vl(F),$;G&&Dl($=F.getFirstChild())&&$.remove()}else Kt(A)&&(vl(F)||A.append(...F.getChildren()),F.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(Fp()),jp(A)),o()}})},v=()=>{i.update(()=>{Mp()})},D=ae(b=>{i.update(()=>{vp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<d.columns;T++)yp(b);o()})},[i,o,d.columns]),E=ae(()=>{i.update(()=>{Np(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{kp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=Sp(s),S=b.getChildren();if(T>=S.length||T<0)throw new Error("Expected table cell to be inside of table row.");let L=S[T];if(!yl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Ip(s),S=b.getChildren(),L=Math.max(...S.map(M=>M.getChildren().length));if(T>=L||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<S.length;M++){let F=S[M];if(!yl(F))throw new Error("Expected table row");let G=F.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),R=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),I=null;return t&&(u?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Al(Ce("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?Ce(Qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Up({anchorElem:t,cellMerge:e}){let[o]=Ml(),r=zt(null),n=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),d=ae(()=>{let u=r.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Rp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);Se(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{d()})})),Se(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=u.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${w}px, ${C}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,t]);let c=zt(s);return Se(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ce(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Sl,{})}),i&&P(Gp,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Ol=t=>{let e=Ep(3),{anchorElem:o}=t,r=wp(),n;return e[0]!==r||e[1]!==o?(n=Al(r?P(Up,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Wp}from"react/compiler-runtime";import{jsx as Jt,jsxs as Vp}from"react/jsx-runtime";import{useLexicalComposerContext as Kp}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as zp}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Zp,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as Xp,$isTableCellNode as Fl,$isTableRowNode as Yp,getDOMCellFromTarget as Jp,TableNode as qp}from"@lexical/table";import{calculateZoomLevel as $l}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Bl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as Qp}from"react-dom";var ef=33,Pl=92;function tf({editor:t}){let e=Yt(null),o=Yt(null),r=Yt(null),n=B(),i=Yt(null),[l,s]=mt(null),[a,d]=mt(null),[c,u]=mt(!1),[m,p]=mt(null),f=dt(()=>{d(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(qp,k=>{if(k.getColWidths())return k;let R=k.getColumnCount(),I=Pl;return k.setColWidths(Array(R).fill(I)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let S=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(u(h(T)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let L=Jp(S);L&&a!==L?t.update(()=>{let A=tr(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),F=t.getElementByKey(M.getKey());if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=F.getBoundingClientRect(),d(L)}):L==null&&f()}},0)},R=T=>{setTimeout(()=>{u(!0)},0)},I=T=>{setTimeout(()=>{u(!1)},0)},b=t.registerRootListener((T,S)=>{S?.removeEventListener("mousemove",k),S?.removeEventListener("mousedown",R),S?.removeEventListener("mouseup",I),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",R),T?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Fl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),b=Xp(R)+R.getRowSpan()-1,T=I.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let S=T[b];if(!Yp(S))throw new Error("Expected table row");let L=S.getHeight();if(L===void 0){let M=S.getChildren();L=Math.min(...M.map(F=>v(F,t)??1/0))}let A=Math.max(L+k,ef);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,R)=>R.getElementByKey(k.getKey())?.clientHeight,D=(k,R)=>{for(let I=0;I<R.length;I++)for(let b=0;b<R[I].length;b++)if(R[I][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Fl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),[b]=Zp(I,null,null),T=D(R,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let S=I.getColWidths();if(!S)return;let L=S[T];if(L===void 0)return;let A=[...S],M=Math.max(L+k,Pl);A[T]=M,I.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let R=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let S=$l(I.target);if(C(k)){let L=(I.clientY-T)/S;w(L)}else{let L=(I.clientX-b)/S;x(L)}f(),document.removeEventListener("mouseup",R)}};return R},[a,f,x,w]),g=dt(k=>R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:R,top:I,width:b}=a.elem.getBoundingClientRect(),T=$l(a.elem),S=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+I+k-S/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+R+b-S/2}px`,top:`${window.scrollY+I}px`,width:`${S}px`}},A=r.current;m&&l&&A&&(C(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/T}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/T}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),N(L)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&Vp(Bl.Fragment,{children:[Jt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Hl=()=>{let t=Wp(3),[e]=Kp(),o=zp(),r,n;return t[0]!==o||t[1]!==e?(n=o?Qp(Jt(tf,{editor:e}),document.body):null,t[0]=o,t[1]=e,t[2]=n):n=t[2],r=n,r};import{c as uf}from"react/compiler-runtime";import{jsx as rr,jsxs as df,Fragment as mf}from"react/jsx-runtime";import{useLexicalComposerContext as Zl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as pf,$getTableRowIndexFromTableCellNode as ff,$insertTableColumn__EXPERIMENTAL as hf,$insertTableRow__EXPERIMENTAL as gf,$isTableCellNode as Cf,$isTableNode as Ul,TableNode as xf}from"@lexical/table";import{$findMatchingParent as bf,mergeRegister as _f}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Wl}from"lexical";import{useEffect as Vl,useMemo as Tf,useRef as Kl,useState as qt}from"react";import"react";import{createPortal as Ef}from"react-dom";import{c as sf}from"react/compiler-runtime";import{useEffect as af,useRef as cf}from"react";var of="Expected a function",rf=Math.max,nf=Math.min;function lf(t,e,o){let r,n,i=0,l,s=!1,a=!1,d,c,u,m=!0;if(typeof t!="function")throw new TypeError(of);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,d=a?rf(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(g){let _=r,N=l;return r=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,u=setTimeout(w,e),s?p(g):c}function h(g){let _=g-n,N=g-i,k=e-_;return a?nf(k,d-N):k}function C(g){let _=g-n,N=g-i;return n===void 0||_>=e||_<0||a&&N>=d}function w(){let g=Date.now();if(C(g))return v(g);u=setTimeout(w,h(g))}function v(g){return u=void 0,m&&r?p(g):(r=l=void 0,c)}function D(){u!==void 0&&clearTimeout(u),i=0,r=n=l=u=void 0}function x(){return u===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(r=arguments,l=this,n=g,_){if(u===void 0)return f(n);if(a)return clearTimeout(u),u=setTimeout(w,e),p(n)}return u===void 0&&(u=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var jl=lf;function Gl(t,e,o){let r=sf(6),n=cf(null),i,l;r[0]!==t||r[1]!==e||r[2]!==o?(i=()=>(n.current=jl(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=i,r[4]=l):(i=r[3],l=r[4]),af(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...d)=>{let c=d;n.current&&n.current(...c)},r[5]=s):s=r[5],s}var zl=20;function wf({anchorElem:t}){let[e]=Zl(),o=B(),[r,n]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[d,c]=qt({}),u=Kl(new Set),m=Kl(null),p=Gl(C=>{let{isOutside:w,tableDOMNode:v}=kf(C,o.editorConfig?.lexical);if(w){n(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=Wl(v);if(Cf(g)){let _=bf(g,N=>Ul(N));if(!Ul(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),R=ff(g),I=pf(g);R===N-1?D=g:I===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:R,y:I}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),n(!0),c({height:zl,left:N-b,top:g-T+5,width:R})):x&&(l(!0),n(!1),c({height:_,left:k-b+5,top:I-T,width:zl}))}},50,250),f=Tf(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Vl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Vl(()=>_f(e.registerMutationListener(xf,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":u.current.add(w),a(u.current.size>0),D&&f.observe(D);break;case"destroyed":u.current.delete(w),a(u.current.size>0),f.disconnect(),u.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(Wl(m.current)?.selectEnd(),C?(gf(),n(!1)):(hf(),l(!1)))})};return e?.isEditable()?df(mf,{children:[r&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...d},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...d},type:"button"})]}):null}function kf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){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 Xl(t){let e=uf(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Zl();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=Ef(rr(wf,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as Nf}from"react/compiler-runtime";import{jsx as nr,jsxs as Lf}from"react/jsx-runtime";import{useLexicalComposerContext as Rf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as If}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Sf,TableNode as yf}from"@lexical/table";import{mergeRegister as vf}from"@lexical/utils";import{formatDrawerSlug as Mf,useEditDepth as Df}from"@payloadcms/ui";import{$getSelection as Af,$isRangeSelection as Of,COMMAND_PRIORITY_EDITOR as Ff,createCommand as $f}from"lexical";import{createContext as Pf,useContext as Bf,useEffect as Hf,useMemo as jf,useState as Gf}from"react";import*as Yl from"react";var Qt=$f("OPEN_EMBED_DRAWER_COMMAND"),Jl=Pf({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ql({children:t}){let[e,o]=Gf({cellEditorConfig:null,cellEditorPlugins:null});return nr(Jl.Provider,{value:jf(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ql=()=>{let t=Nf(16),[e]=Rf(),o=Bf(Jl),r=Df(),{fieldProps:n,uuid:i}=B(),{schemaPath:l}=n,s="lexical-table-create-"+i,a;t[0]!==s||t[1]!==r?(a=Mf({slug:s,depth:r}),t[0]=s,t[1]=r,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=ce(d,!0),u;t[3]!==e||t[4]!==c?(u=()=>{if(!e.hasNodes([yf]))throw new Error("TablePlugin: TableNode is not registered on editor");return vf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=Af();Of(C)&&(h=C)}),h&&c(),!0},Ff))},t[3]=e,t[4]=c,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],Hf(u,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(Sf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==d||t[13]!==p||t[14]!==l?(f=Lf(Yl.Fragment,{children:[nr(He,{drawerSlug:d,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(If,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=d,t[13]=p,t[14]=l,t[15]=f):f=t[15],f};var Kf=y({markdownTransformers:[Rl],nodes:[Wf,Uf,Vf],plugins:[{Component:Ql,position:"normal"},{Component:Hl,position:"normal"},{Component:Ol,position:"floatingAnchorElem"},{Component:Xl,position:"floatingAnchorElem"}],providers:[ql],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[de([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as h1}from"lexical";import{jsx as ir,jsxs as zf}from"react/jsx-runtime";import"react";var lr=()=>zf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as o1}from"react/compiler-runtime";import{jsx as r1}from"react/jsx-runtime";import{useLexicalComposerContext as n1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as i1,mergeRegister as l1}from"@lexical/utils";import{useConfig as s1}from"@payloadcms/ui";import{$getPreviousSelection as a1,$getSelection as c1,$isParagraphNode as ts,$isRangeSelection as u1,COMMAND_PRIORITY_EDITOR as d1,createCommand as m1}from"lexical";import{useEffect as p1}from"react";import{c as Zf}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as Xf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Yf,COMMAND_PRIORITY_EDITOR as Jf}from"lexical";import{useEffect as qf,useState as Qf}from"react";var e1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Yf(o);n&&n.replace(Ke({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:r})},t1=t=>{let e=Zf(13),{enabledCollectionSlugs:o}=t,[r]=Xf(),[n,i]=Qf(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:d}=lt(l),c,u;e[2]!==r||e[3]!==d?(c=()=>r.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),d(),!0),Jf),u=[r,d],e[2]=r,e[3]=d,e[4]=c,e[5]=u):(c=e[4],u=e[5]),qf(c,u);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),e1({editor:r,relationTo:C,replaceNodeKey:n,value:w})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==p||e[11]!==a?(f=sr(a,{onSelect:p}),e[10]=p,e[11]=a,e[12]=f):f=e[12],f},es=t=>sr(bt,{...t,uploads:!0,children:sr(t1,{...t})});var ar=m1("INSERT_UPLOAD_COMMAND"),os=t=>{let e=o1(5),[o]=n1(),{config:r}=s1(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return l1(o.registerCommand(ar,a=>(o.update(()=>{let d=c1()||a1();if(u1(d)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});i1(c);let{focus:u}=d,m=u.getNode();ts(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(p=>ts(p)).length>1&&m.remove()}}),!0),d1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),p1(i,l);let s;return e[3]!==n?(s=r1(es,{enabledCollectionSlugs:n.map(f1)}),e[3]=n,e[4]=s):s=e[4],s};function f1(t){let{slug:e}=t;return e}var g1=y({nodes:[Ve],plugins:[{Component:os,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:lr,isActive:({selection:t})=>{if(!h1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as C1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as x1}from"@payloadcms/ui";import{lazy as b1,Suspense as _1,useEffect as T1,useState as E1}from"react";var rs={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:rs};function ns({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:r}){for(let s of r.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");r.features=r.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let n=new Map;for(let s of r.features)n.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of r.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:n,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:r}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var is=t=>{let e={enabledFeatures:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function cr(t,e,o){return{admin:o,features:is(t),lexical:e,resolvedFeatureMap:t}}var w1=b1(()=>import("./Field-US3A77DK.js").then(t=>({default:t.RichText}))),k1=t=>{let e=C1(14),{admin:o,clientFeatures:r,featureClientSchemaMap:n,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let d=a,c=l===void 0?eo:l,[u,m]=E1(null),p,f;e[2]!==u||e[3]!==r||e[4]!==c||e[5]!==n||e[6]!==i||e[7]!==s||e[8]!==d?(p=()=>{if(u)return;let C=[];for(let[D,x]of Object.entries(r))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ns({featureClientSchemaMap:n,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,d))},f=[c,d,u,r,n,i,s],e[2]=u,e[3]=r,e[4]=c,e[5]=n,e[6]=i,e[7]=s,e[8]=d,e[9]=p,e[10]=f):(p=e[9],f=e[10]),T1(p,f);let h;return e[11]!==u||e[12]!==t?(h=ur(_1,{fallback:ur(x1,{height:"35vh"}),children:u&&ur(w1,{...t,editorConfig:u})}),e[11]=u,e[12]=t,e[13]=h):h=e[13],h};function N1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function ls(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=ls(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=ls(l);for(let d of r)a!==null&&d([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},to.set(t,o)}return o.listeners.add(e),()=>{L1(t,e)}}function L1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function R1(t,e){return oo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function I1(t,e){return oo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function S1(t,e){return oo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function y1(t,e){return oo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}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},v1=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,M1="\xA0",D1=`
40
40
 
41
- `,ss="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",as="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",O1=new RegExp("^[^"+as+"]*["+ss+"]"),F1=new RegExp("^[^"+ss+"]*["+as+"]"),$1={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},P1={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},B1={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},H1={[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"},j1={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},G1={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};import{c as U1}from"react/compiler-runtime";import{jsx as W1}from"react/jsx-runtime";import"react";var V1=()=>{let t=U1(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?W1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as K1}from"react/compiler-runtime";import{jsx as z1}from"react/jsx-runtime";import"react";var Z1=()=>{let t=K1(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?z1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as X1}from"react/compiler-runtime";import{jsx as Y1}from"react/jsx-runtime";import"react";var J1=()=>{let t=X1(2),{Label:e}=be(),o;return t[0]!==e?(o=e?Y1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as q1}from"react/compiler-runtime";import{jsx as Q1}from"react/jsx-runtime";import"react";var eh=t=>{let e=q1(3),{children:o}=t,{InlineBlockContainer:r}=be(),n;return e[0]!==r||e[1]!==o?(n=r?Q1(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as th}from"react/compiler-runtime";import{jsx as oh}from"react/jsx-runtime";import"react";var rh=t=>{let e=th(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=ve(),s;return e[0]!==l||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==o?(s=l?oh(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=s):s=e[5],s};import{c as nh}from"react/compiler-runtime";import{jsx as ih}from"react/jsx-runtime";import"react";var lh=()=>{let t=nh(2),{EditButton:e}=ve(),o;return t[0]!==e?(o=e?ih(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as sh}from"react/compiler-runtime";import{jsx as ah}from"react/jsx-runtime";import"react";var ch=()=>{let t=sh(2),{RemoveButton:e}=ve(),o;return t[0]!==e?(o=e?ah(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{Qe as $createAutoLinkNode,St as $createBlockNode,no as $createInlineBlockNode,me as $createLinkNode,Ue as $createRelationshipNode,Ke as $createUploadNode,fe as $isAutoLinkNode,Rt as $isBlockNode,io as $isInlineBlockNode,V as $isLinkNode,lo as $isRelationshipNode,so as $isUploadNode,Es as AlignFeatureClient,pe as AutoLinkNode,rh as BlockCollapsible,lh as BlockEditButton,ue as BlockNode,ch as BlockRemoveButton,Ss as BlockquoteFeatureClient,ka as BlocksFeatureClient,Va as BoldFeatureClient,us as CAN_USE_DOM,hd as ChecklistFeatureClient,P1 as DETAIL_TYPE_TO_DETAIL,A1 as DOUBLE_LINE_BREAK,H1 as ELEMENT_FORMAT_TO_TYPE,B1 as ELEMENT_TYPE_TO_FORMAT,hs as ENABLE_SLASH_MENU_COMMAND,cs as EditorConfigProvider,He as FieldsDrawer,Km as FixedToolbarFeatureClient,Rc as HeadingFeatureClient,$c as HorizontalRuleFeatureClient,M1 as IS_ALL_FORMATTING,Gc as IndentFeatureClient,eh as InlineBlockContainer,V1 as InlineBlockEditButton,J1 as InlineBlockLabel,ro as InlineBlockNode,Z1 as InlineBlockRemoveButton,Ya as InlineCodeFeatureClient,rp as InlineToolbarFeatureClient,ec as ItalicFeatureClient,F1 as LTR_REGEX,$d as LexicalPluginToLexicalFeatureClient,ed as LinkFeatureClient,Q as LinkNode,D1 as NON_BREAKING_SPACE,O as NodeFormat,wd as OrderedListFeatureClient,Vd as ParagraphFeatureClient,ps as Point,O1 as RTL_REGEX,gs as Rect,_m as RelationshipFeatureClient,Ge as RelationshipNode,N1 as RichTextField,Ud as SlateToLexicalFeatureClient,ic as StrikethroughFeatureClient,cc as SubscriptFeatureClient,pc as SuperscriptFeatureClient,j1 as TEXT_MODE_TO_TYPE,$1 as TEXT_TYPE_TO_FORMAT,G1 as TEXT_TYPE_TO_MODE,le as TOGGLE_LINK_COMMAND,zf as TableFeatureClient,Fa as TestRecorderFeatureClient,st as ToolbarButton,Re as ToolbarDropdown,ja as TreeViewFeatureClient,xc as UnderlineFeatureClient,vd as UnorderedListFeatureClient,C1 as UploadFeatureClient,Ve as UploadNode,v1 as addSwipeDownListener,S1 as addSwipeLeftListener,I1 as addSwipeRightListener,y1 as addSwipeUpListener,To as createBlockNode,y as createClientFeature,eo as defaultEditorLexicalConfig,Ko as getDOMRangeRect,Cs as getEnabledNodes,Me as getSelectedNode,ms as isHTMLElement,fs as isPoint,L1 as joinClasses,cr as sanitizeClientEditorConfig,is as sanitizeClientFeatures,Gt as setFloatingElemPosition,Ot as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,de as toolbarAddDropdownGroupWithItems,wo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,q as toolbarTextDropdownGroupWithItems,B as useEditorConfigContext,ds as useLexicalDocumentDrawer,ce as useLexicalDrawer,lt as useLexicalListDrawer};
41
+ `,ss="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",as="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",A1=new RegExp("^[^"+as+"]*["+ss+"]"),O1=new RegExp("^[^"+ss+"]*["+as+"]"),F1={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},$1={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},P1={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},B1={[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"},H1={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},j1={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};import{c as G1}from"react/compiler-runtime";import{jsx as U1}from"react/jsx-runtime";import"react";var W1=()=>{let t=G1(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?U1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as V1}from"react/compiler-runtime";import{jsx as K1}from"react/jsx-runtime";import"react";var z1=()=>{let t=V1(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?K1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Z1}from"react/compiler-runtime";import{jsx as X1}from"react/jsx-runtime";import"react";var Y1=()=>{let t=Z1(2),{Label:e}=be(),o;return t[0]!==e?(o=e?X1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as J1}from"react/compiler-runtime";import{jsx as q1}from"react/jsx-runtime";import"react";var Q1=t=>{let e=J1(3),{children:o}=t,{InlineBlockContainer:r}=be(),n;return e[0]!==r||e[1]!==o?(n=r?q1(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as eh}from"react/compiler-runtime";import{jsx as th}from"react/jsx-runtime";import"react";var oh=t=>{let e=eh(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=ve(),s;return e[0]!==l||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==o?(s=l?th(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=s):s=e[5],s};import{c as rh}from"react/compiler-runtime";import{jsx as nh}from"react/jsx-runtime";import"react";var ih=()=>{let t=rh(2),{EditButton:e}=ve(),o;return t[0]!==e?(o=e?nh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lh}from"react/compiler-runtime";import{jsx as sh}from"react/jsx-runtime";import"react";var ah=()=>{let t=lh(2),{RemoveButton:e}=ve(),o;return t[0]!==e?(o=e?sh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{Qe as $createAutoLinkNode,It as $createBlockNode,no as $createInlineBlockNode,me as $createLinkNode,Ue as $createRelationshipNode,Ke as $createUploadNode,fe as $isAutoLinkNode,Rt as $isBlockNode,io as $isInlineBlockNode,V as $isLinkNode,lo as $isRelationshipNode,so as $isUploadNode,Es as AlignFeatureClient,pe as AutoLinkNode,oh as BlockCollapsible,ih as BlockEditButton,ue as BlockNode,ah as BlockRemoveButton,Is as BlockquoteFeatureClient,wa as BlocksFeatureClient,Wa as BoldFeatureClient,us as CAN_USE_DOM,fd as ChecklistFeatureClient,$1 as DETAIL_TYPE_TO_DETAIL,D1 as DOUBLE_LINE_BREAK,B1 as ELEMENT_FORMAT_TO_TYPE,P1 as ELEMENT_TYPE_TO_FORMAT,hs as ENABLE_SLASH_MENU_COMMAND,cs as EditorConfigProvider,He as FieldsDrawer,Vm as FixedToolbarFeatureClient,Lc as HeadingFeatureClient,Fc as HorizontalRuleFeatureClient,v1 as IS_ALL_FORMATTING,jc as IndentFeatureClient,Q1 as InlineBlockContainer,W1 as InlineBlockEditButton,Y1 as InlineBlockLabel,ro as InlineBlockNode,z1 as InlineBlockRemoveButton,Xa as InlineCodeFeatureClient,op as InlineToolbarFeatureClient,Qa as ItalicFeatureClient,O1 as LTR_REGEX,Fd as LexicalPluginToLexicalFeatureClient,Qu as LinkFeatureClient,Q as LinkNode,M1 as NON_BREAKING_SPACE,O as NodeFormat,Ed as OrderedListFeatureClient,Wd as ParagraphFeatureClient,ps as Point,A1 as RTL_REGEX,gs as Rect,bm as RelationshipFeatureClient,Ge as RelationshipNode,k1 as RichTextField,Gd as SlateToLexicalFeatureClient,nc as StrikethroughFeatureClient,ac as SubscriptFeatureClient,mc as SuperscriptFeatureClient,H1 as TEXT_MODE_TO_TYPE,F1 as TEXT_TYPE_TO_FORMAT,j1 as TEXT_TYPE_TO_MODE,le as TOGGLE_LINK_COMMAND,Kf as TableFeatureClient,Oa as TestRecorderFeatureClient,st as ToolbarButton,Ie as ToolbarDropdown,Ha as TreeViewFeatureClient,Cc as UnderlineFeatureClient,yd as UnorderedListFeatureClient,g1 as UploadFeatureClient,Ve as UploadNode,y1 as addSwipeDownListener,R1 as addSwipeLeftListener,I1 as addSwipeRightListener,S1 as addSwipeUpListener,To as createBlockNode,y as createClientFeature,eo as defaultEditorLexicalConfig,Ko as getDOMRangeRect,Cs as getEnabledNodes,Me as getSelectedNode,ms as isHTMLElement,fs as isPoint,N1 as joinClasses,cr as sanitizeClientEditorConfig,is as sanitizeClientFeatures,Gt as setFloatingElemPosition,Ot as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,de as toolbarAddDropdownGroupWithItems,wo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,q as toolbarTextDropdownGroupWithItems,B as useEditorConfigContext,ds as useLexicalDocumentDrawer,ce as useLexicalDrawer,lt as useLexicalListDrawer};
42
42
  //# sourceMappingURL=index.js.map